分类: Oracle
2009-04-01 20:22:34
listener
===========================
需要注意的是listener有两种注册方式:动态注册和静态注册
动态注册,即配置listener时,不需要配置SID_LIST_LISTNER_NAME这一系列参数
静态注册,与动态相反,配置listner时有SID_LIST_LISTNER_NAME这一参数,固定为某些个数据库提供监听服务
例如:
LISTENER_DEV =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.123)(PORT = 1521))
)
)
)
--如果没有配置下面这一块,listner中仅仅包含上面的内容,即为动态注册;反之则为静态。
SID_LIST_LISTENER_DEV =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /home/oracle/10.1.0.2)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = dev)
(ORACLE_HOME = /home/oracle/10.1.0.2)
(SID_NAME = dev)
)
(SID_DESC =
(GLOBAL_DBNAME = zwf)
(ORACLE_HOME = /home/oracle/10.1.0.2)
(SID_NAME = zwf)
)
)
动态注册:
在数据库启动过程中,PMON进程探测listner是否启动,pmon会根据数据库参数中的services_name不断地尝试注册到listener
如果listner已经先于数据库启动,那么,在数据库启动时PMON会自动注册数据库到listner;
如果在数据库启动时,listner还未启动,那么,PMON会间歇性地探测listner状态,尝试注册数据库。
可以手工指定listner,使用命令:alter system set log_listener='tns配置中的名字';(这一点以前理解有误,也可以直接写tns的配置信息)
静态注册:
这个好像没什么好说的,
EZCONNECT方式连接
~~~~~~~~~~~~~~~~~~~~~~~~
例如:
listner配置TCP协议,使用主机名,端口为1521,service_names=dev,db_domain=us.oracle.com
连接:
[oracle@test oracle]$ sqlplus hr/hr@192.168.0.123:1521/dev.us.oracle.com
SQL*Plus: Release 10.1.0.2.0 - Production on Thu Nov 29 10:08:23 2007
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL>
测试连通性:
[oracle@test oracle]$ tnsping 192.168.0.123:1521/dev.us.oracle.com
TNS Ping Utility for Linux: Version 10.1.0.2.0 - Production on 29-NOV-2007 10:05:22
Copyright (c) 1997, 2003, Oracle. All rights reserved.
Used parameter files:
/home/oracle/10.1.0.2/network/admin/sqlnet.ora
Used EZCONNECT adapter to resolve the alias
Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=dev.us.oracle.com))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.123)(PORT=1521)))
OK (0 msec)
===========================