ORACLE的TNS配置

Posted on 2012-08-27 18:50 卡洛shll 阅读(308) 评论(0)  编辑 收藏 引用 所属分类: 数据库

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

ORACLE的配置文件名:tnsnames.ora

文件所在路径:安装ORACLE所在的目录\oracle\ora92\network\admin\tnsnames.ora

配置的一个实例:

# TNSNAMES.ORA Network Configuration File: D:\Oracle\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)

    )

  ) 

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


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理