1, oracle 10g 用netca方式建立的都默认为动态注册方式
2,如果想改为静态注册的方式则在listener.ora 中加入如下内容即可
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = JEFF )
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1) --就这一段
(GLOBAL_DBNAME = jeff)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = r1)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
3,两者的区别
即静态注册,listener不知道实例的状态,只有在进程通过其连接数据库时才能知道,如果你想使用远程管理数据库就使用静态监听
动态注册:listener实时的都知道实例的状态,数据库在关闭的时候会动态的从listener中注销,所以远程管理数据库的启动和停止就不行了。
4,如何判断是静态注册还是动态注册
(1) 可以通过配置文件判断
动态注册
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(PROGRAM = extproc)
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:\oradata\orcl)
)
)
静态注册
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(PROGRAM = extproc)
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:\oradata\orcl)
)
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = D:\oradata\orcl)
(SID_NAME = ORCL)
)
(SID_DESC =
(GLOBAL_DBNAME = orcl1)
(ORACLE_HOME = D:\oradata\orcl)
(SID_NAME = ORCL)
)
)
通过查看虽然可以大致看出,但是这种方法并不能和明确的现实数据库在运行时的实际情况
(2) lsnrclt status
----静态注册是这样的 都是unknow
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "jeff" has 1 instance(s).
Instance "JEFF", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
-----动态注册是这样的
Services Summary...
Service "JEFF" has 1 instance(s).
Instance "JEFF", status READY, has 1 handler(s) for this service...
Service "JEFFXDB" has 1 instance(s).
Instance "JEFF", status READY, has 1 handler(s) for this service...
Service "JEFF_XPT" has 1 instance(s).
Instance "JEFF", status READY, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
3,有时候会碰到即使listener起来也不能连接到数据库的情况 。会报一个ORA-12514 ,
运行lsnrctls status 是这个样子的 ,说明没有服务没有注册进来
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=r1)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
解决方法:
alter system register; ---手动将服务注册到listener中
4,如果我想使用动态注册,但是又不想使用1521端口怎么办
这个时候我们就要用到 local_listener这个参数了,当你使用的是其他端口比如说是1522端口,那么只要配置这个参数就ok了。
SQL> alter system set local_listener='(DESCRIPTION =
2 (ADDRESS = (PROTOCOL = TCP)(HOST = xys)(PORT = 1522))
3 )';