客戶端tns裡host配置主機名的方法

fei890910發表於2014-03-21

安裝完客戶端以後如果你想讓自己的客戶端訪問固定的例項,並且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


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29108064/viewspace-1126964/,如需轉載,請註明出處,否則將追究法律責任。

相關文章