使用lsnrctl status命令区分动态注册,静态注册
unknow:静态注册
ready或blocked:动态注册
a、如果先启动监听,后启动数据库
Service "PLSExtProc" has 1 instance(s).
? Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 2 instance(s).
??Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...
? Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
? Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
从显示信息可以看出这种情况下既有动态注册又有静态注册
?(Service "PLSExtProc" 是在 listener.ora 文件中为数据库实例缺省配置的,允许PL/SQL包访问外部程序;
??? Service "orcl" 也是在 listener.ora 文件中配置,是每个数据库连接使用的标准模式;
??? Service "orclXDB" 是Oracle 9i以后版本创建数据库时默认包含的XML DB特性,提供http、ftp等服务,在初始化文spfile(或pfile)中定义)
b、重启监听
Service "PLSExtProc" has 1 instance(s).
? Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service..
Service "orcl" has 1 instance(s).
??Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl1" has 1 instance(s).
? Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
从显示信息可以看出这种情况下动态注册监听失败
c、删除listener.ora,重启监听
Listening Endpoints Summary...
? (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=MICROSOF-3033D5)(PORT=1521)))
The listener supports no services
The command completed successfully
从显示信息可以看出这种情况下动态注册监听和静态注册监听都失败
等待片刻(1min)。。。。
Service "orcl" has 1 instance(s).
? Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
? Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
从显示信息可以看出这种情况下动态注册监听成功,pomn定时向监听器注册
?
d、修改listener.ora为SID_LIST_LISTENER =
? (SID_LIST =
??? (SID_DESC =
????? (PROGRAM = extproc)
????? (SID_NAME = PLSExtProc)
????? (ORACLE_HOME = D:\oradata\orcl)
??? )
? )重启监听
Service "PLSExtProc" has 1 instance(s).
? Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
从显示信息可以看出这种情况下动态注册监听失败,静态注册数据库实例失败
等待片刻(1min)。。。。
Service "orcl" has 1 instance(s).
? Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
? Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
从显示信息可以看出这种情况下动态注册监听成功,pomn定时向监听器注册
总结
重启监听并不一定都造成动态注册监听的失败:如果listener.ora文件被删除时,这种现象只是暂时的,oracle中pmon进程会定时像监听器动态注册(个人观点)