第三節咱們已經大概瞭解什麼是靜態
註冊和動態
註冊,下面咱們將經過兩個例子來更加深刻了解它們之間的區別。
靜態
註冊:當listener使用的是非標準端口(1522),在listener.ora的文件裏手工註冊(添加instance name 和 service name)
動態
註冊:listener 採用的是默認端口(1521),當實例啓動時,由pmon 自動將instance name 和service name 註冊到listener
一、靜態註冊
(1)經過netca 創建非標準端口的listener :lis2(1522)
(2)修改listener.ora
——查看listener.ora
[oracle@work ~]$ cd /u01/app/oracle/product/10.2.0/db_1/network/admin/
[oracle@solaris10 admin]$cat listener.ora
LISTENER2 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = solaris10)(PORT = 1522))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = solaris10)(PORT = 1521))
)
)
——添加靜態
註冊信息
[oracle@solaris10 admin]$vi listener.ora
***************************這裏面的是靜態
註冊信息*****************************
SID_LIST_LISTENER2 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = anny)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(SID_NAME = anny)
)
)
***************************這裏面的是靜態
註冊信息************************************
LISTENER2 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = solaris10)(PORT = 1522))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = work)(PORT = 1521))
)
)
——啓動lsn2
[oracle@solaris10 admin]$lsnrctl start listener2
LSNRCTL for Solaris: Version 10.2.0.2.0 - Production on 16-MAR-2012 17:58:12
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Solaris: Version 10.2.0.2.0 - Production
System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener2.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=solaris10)(PORT=1522)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=solaris10)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias listener2
Version TNSLSNR for Solaris: Version 10.2.0.2.0 - Production
Start Date 16-MAR-2012 17:58:12
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener2.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=solaris10)(PORT=1522)))
Services Summary...
Service "anny" has 1 instance(s).
Instance "anny", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@solaris10 admin]$netstat -an|grep 1522
192.168.12.17.34007 192.168.12.31.1522 49640 0 49640 0 ESTABLISHED
192.168.12.17.1522 192.168.12.31.34220 49640 0 49640 0 ESTABLISHED
*.1522 *.* 0 0 49152 0 LISTEN
——查看lsn2 status
[oracle@solaris10 admin]$lsnrctl status listener2
LSNRCTL for Solaris: Version 10.2.0.2.0 - Production on 16-MAR-2012 18:02:24
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=solaris10)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias listener2
Version TNSLSNR for Solaris: Version 10.2.0.2.0 - Production
Start Date 16-MAR-2012 17:58:12
Uptime 0 days 0 hr. 4 min. 12 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener2.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=solaris10)(PORT=1522)))
Services Summary...
Service "anny" has 1 instance(s).
Instance "anny", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
——status unknown 表示instance 是以靜態
註冊方式註冊