了解oracle tns

 Oracle中TNS的完整定义:transparence Network Substrate透明网络底层,监听服务是它重要的一部分,不是全部,不要把TNS当作只是监听器

  ORACLE当中,如果想访问某个服务器,必须要设置TNS,它不像SQL SERVER那样在客户端自动列举出在局域网内所有的在线服务器,只需在客户端选择需要的服务器,然后使用帐号与密码登录即可。而ORCAL不能自动列举出网内的服务器,需要通过读取TNS配置文件才能列出经过配置的服务器名。

  配置文件名一般为:tnsnames.ora

  存取路径: $ORACLE_HOME\network\admin\tnsnames.ora

  eg:

# TNSNAMES.ORA Network Configuration File: C:\oracle\ora81\network\admin\tnsnames.ora
  # Generated by Oracle configuration tools.
  ODS =
  (description =
  (address = (protocol = tcp)(host = 10.201.64.12)(port = 1521))
  (connect_data =
  (sid = ods)
  )
  )
  AUTOCLM_10.210.4.11 =
  (DESCRIPTION =
  (ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 10.210.4.11)(PORT = 1521))
  )
  (CONNECT_DATA =
  (SID = autoclm)
  (SERVER = DEDICATED)
  )
  )
  PROPTEST_10.210.4.30 =
  (DESCRIPTION =
  (ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 10.210.4.30)(PORT = 1521))
  )
  (CONNECT_DATA =
  (SID = proptest)
  (SERVER = DEDICATED)
  )
  )
  p05 =
  (DESCRIPTION =
  (ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 10.201.64.14)(PORT = 1521))
  )
  (CONNECT_DATA =
  (SID = p05)
  (SERVER = DEDICATED)
  )
  )
  p05_8 =
  (DESCRIPTION =
  (ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 10.201.64.8)(PORT = 1521))
  )
  (CONNECT_DATA =
  (SID = p05)
  )
  )
  ODS =
  (description =
  (address = (protocol = tcp)(host = 10.201.64.8)(port = 1521))
  (connect_data =
  (sid = p05)
  )
  )
  test_14 =
  (DESCRIPTION =
  (ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 10.201.64.14)(PORT = 1521))
  )
  (CONNECT_DATA =
  (SERVICE_NAME = p05test)
  )
  )
  CIBS =
  (DESCRIPTION =
  (ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 10.203.68.71)(PORT = 1521))
  )
  (CONNECT_DATA =
  (SERVICE_NAME = cibs)
  )
  )
  ORA10 =
  (DESCRIPTION =
  (ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 10.202.1.77)(PORT = 1521))
  )
  (CONNECT_DATA =
  (SERVICE_NAME = ORA10)
  )
  )
  CIBS =
  (DESCRIPTION =
  (ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 10.203.68.71)(PORT = 1521))
  )
  (CONNECT_DATA =
  (SERVICE_NAME = cibs)
  )
  )
  CAI =
  (DESCRIPTION =
  (ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 10.203.68.80)(PORT = 1521))
  )
  (CONNECT_DATA =
  (SERVICE_NAME = proplh)
  )
  )
  CHELP =
  (DESCRIPTION =
  (ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 10.203.68.137)(PORT = 1521))
  )
  (CONNECT_DATA =
  (SERVICE_NAME = autoclm)
  )
  )

  配置完毕后,客户端就可以列举出|"ODS",”P05”,"CAI”,"CHELP”,“CIBS”等的服务器名出来。

你可能感兴趣的:(oracle)