Oracle监听数据库实例状态显⽰statusUNKNOWN
Oracle监听数据库实例状态显⽰status UNKNOWN
[oracle@localhost admin]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 22-AUG-2020 19:38:58
Copyright (c) 1991, 2009, Oracle. All rights rerved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
人力资源资格证Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 22-AUG-2020 10:26:47
riverside
Uptime 0 days 9 hr. 12 min. 10 c
Trace Level off
blank是什么意思Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/11.2.0/network/a
Listener Log File /opt/oracle/diag/tnslsnr/localhost/listener/l
Listening
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
descent
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
Service "orcl" has 2 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for
Instance "orcl", status READY, has 1 handler(s) for
Service "orcl002" has 2 instance(s).
Instance "orcl002", status UNKNOWN, has 1 handler(s) for
Instance "orcl002", status READY, has 1 handler(s) for
Service "orcl002XDB" has 1 instance(s).
Instance "orcl002", status READY, has 1 handler(s) for
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for
The command completed successfully
[oracle@localhost admin]$
Instance "orcl", status UNKNOWN : 这表明该orcl实例不是⾃动注册、⽽是通过搜索 a 主动找到匹配的 Service 后进⾏注册的。主动监听不管数据库实例是否启动。
Instance "orcl", status READY : 这表明该orcl实例是⾃动注册的,⽽不是主动监听。等数据库实例启动OK后,PMON 后台进程监视到实例启动OK,会动态注册 SID 信息。
Oracle 11g 有⼀个 PMON 后台进程监视,如果先启动数据库实例,再启动监听器,则 a ⽂件中不需要配置相关的 SID 信息,因为 PMON 会⾃动对监测到的 Service 进⾏⾃动注册。如果你的监听器端⼝为缺省的 1521端⼝,那么 a 可以忽略。
监听服务如果晚于数据库实例如启动较长时间的话,状态变化也会有⼀定的延时。
查看监听器配置如下:
$ cat $ORACLE_HOME/network/a
# a Network Configuration File: /opt/oracle/product/11.2.0/network/a
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl002)
(SID_NAME = orcl002)
)
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(SID_NAME = orcl)
)
)
ADR_BASE_LISTENER = /opt/oracle
可见我配置了 SID_LIST_LISTENER ,将两个SID都静态配置了。
接下来修改监听器配置,删除静态配置:
$ sqlplus / as sysdba
SQL> shutdown immediate
SQL> quit
$ lsnrctl stop
$ vim $ORACLE_HOME/network/a
修改后的内容如下(删除了SID_LIST_LISTENER)
$ cat $ORACLE_HOME/network/a
# a Network Configuration File: /opt/oracle/product/11.2.0/network/a # Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /opt/oracle
[oracle@localhost admin]$
重新启动数据库和监听器,查看状态:
$ lsnrctl start
$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 22-AUG-2020 20:07:52
Copyright (c) 1991, 2009, Oracle. All rights rerved.
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 22-AUG-2020 20:07:49
Uptime 0 days 0 hr. 0 min. 2 c
Trace Level off
Security ON: Local OS Authentication
beautifulgirl
SNMP OFF
Listener Parameter File /opt/oracle/product/11.2.0/network/a
Listener Log File /opt/oracle/diag/tnslsnr/localhost/listener/l
Listening bountiful
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
The listener supports no rvices
The command completed successfully
$ sqlplus / as sysdba
SQL> startup
ORACLE instance started.
Total System Global Area 1586708480 bytes
Fixed Size 2213736 bytes
Variable Size 1224738968 bytes
Databa Buffers 352321536 bytes
Redo Buffers 7434240 bytes
Databa mounted.
Databa opened.
SQL> exit
Disconnected from Oracle Databa 11g Enterpri Edition Relea 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 22-AUG-2020 20:08:08
Copyright (c) 1991, 2009, Oracle. All rights rerved.
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 22-AUG-2020 20:07:49
Uptime 0 days 0 hr. 0 min. 18 c
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/11.2.0/network/a
Listener Log File /opt/oracle/diag/tnslsnr/localhost/listener/l
Listening
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))yanhu
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for
Service "orcl002" has 1 instance(s).
Instance "orcl002", status READY, has 1 handler(s) for
Service "orcl002XDB" has 1 instance(s).
Instance "orcl002", status READY, has 1 handler(s) for
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for
The command completed successfully
可以看到显⽰的数据库实例状态为:status READY ,没有 status UNKNOWN 了
另外附上我的a配置
$ cat $ORACLE_HOME/network/a
forever in my life# a Network Configuration File: /opt/oracle/product/11.2.0/network/a # Generated by Oracle configuration tools.
ORCL002 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)形单影只
(SERVICE_NAME = orcl002)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
英语教育
)
)
[oracle@localhost admin]$