listener.ora和tnsnames.ora格式解析
listener.ora是oracle数据库服务端的监听配置文件,包括协议、IP地址和端口等内容;tnsnames.ora是oracle数据库客户端的连接配置文件,也是对应的协议、IP地址和端口等内容。
listener.ora官方说明:http://docs.oracle.com/cd/E11882_01/network.112/e10835/listener.htm#NETRF008
tnsnames.ora官方说明:http://docs.oracle.com/cd/E11882_01/network.112/e10835/tnsnames.htm#NETRF007
这两个文件默认位于ORACLE_HOME/network/admin目录下
listener.ora配置示例:
LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.220.144) (PORT = 1521)) ) ) )
tnsnames.ora配置示例:
LSDB = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.220.144)(PORT = 1521)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = lsdb) ) )
LISTENER和LSDB这名字一般是随意的,只是按习惯listener.ora中用LISTENER,tnsnames.ora中用数据库名称。
有多个DESCRIPTION时可在其外层加DESCRIPTION_LIST单个可只用DESCRIPTION,有多个ADDRESS时可在其外层加ADDRESS_LIST单个可只用ADDRESS。