一、静态注册和动态注册
什么是静态注册
就是监听器的配置文件中写明了监听哪个实例 需要配置SID_DESC字段
定位实例的方式可以使用SID_NAME或者SERVICE_NAME来定位
什么是动态注册
就是监听器的配置文件中没写明监听哪个实例
要通过PMON告知监听器要监听的具体实例
PMON是将SERVER_NAME告诉给监听器 这个过程就是注册
默认一分钟PMON注册一次 也就是说启动监听 还没注册时 是无法连接的
区分静态注册和动态注册
lsnrctl status
是 ready 就是动态
是 unknow 就是静态
二、 静态监听的配置:
cd /u01/oracle/product/10.2.0/network/admin
[oracle@test admin]$ vi listener.ora
SID_LIST_LISTENER =
(SID_LIST =
#(SID_DESC =
# (SID_NAME = PLSExtProc)
# (ORACLE_HOME = /u01/oracle/product/10.2.0)
# (PROGRAM = extproc)
# )
(SID_DESC =
(SID_NAME = ora10g)
(ORACLE_HOME = /u01/oracle/product/10.2.0)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = test)(PORT = 1521))
)
)
动态监听和静态监听不能在一起,有动态监听就得注释静态监听,有静态的监听就得注释动态的监听。
有的时候配置好监听后,重新启动后,不是立即起作用,需要等待一会
[oracle@test admin]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 20-JUL-2013 12:18:43Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 20-JUL-2013 12:09:53
Uptime 0 days 0 hr. 8 min. 49 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/oracle/product/10.2.0/network/admin/listener.ora
Listener Log File /u01/oracle/product/10.2.0/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test)(PORT=1521)))
Services Summary...
Service "ora10g" has 2 instance(s).
Instance "ora10g", status UNKNOWN, has 1 handler(s) for this service...
Instance "ora10g", status READY, has 1 handler(s) for this service...
Service "ora10gXDB" has 1 instance(s).
Instance "ora10g", status READY, has 1 handler(s) for this service...
Service "ora10g_XPT" has 1 instance(s).
Instance "ora10g", status READY, has 1 handler(s) for this service...
The command completed successfully
上述状态就是静态监听
三、动态监听
vim listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/oracle/product/10.2.0)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle.up.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
[oracle@test admin]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 20-JUL-2013 12:35:25
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 20-JUL-2013 12:33:21
Uptime 0 days 0 hr. 2 min. 4 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/oracle/product/10.2.0/network/admin/listener.ora
Listener Log File /u01/oracle/product/10.2.0/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "ora10g" has 1 instance(s).
Instance "ora10g", status READY, has 1 handler(s) for this service...
Service "ora10gXDB" has 1 instance(s).
Instance "ora10g", status READY, has 1 handler(s) for this service...
Service "ora10g_XPT" has 1 instance(s).
Instance "ora10g", status READY, has 1 handler(s) for this service...
The command completed successfully