客户端tns里host配置主机名的方法
-
fei890910
2014-03-21 19:24:38
-
Oracle
-
原创
安装完客户端以后如果你想让自己的客户端访问固定的实例,并且host里写主机名的话,那么tns里面应该如此配置
PROD2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node2)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = prod)
)
)
而且还必须在客户端所在的操作系统里配置hosts文件
如果是linux系统则在/etc/hosts文件里
[root@node2 ~]# more /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost
192.168.10.22 node2
如果是windows操作系统的话 配置
C:\Windows\System32\Drivers\etc\hosts文件
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
192.168.10.22 node2