The listener supports no services解決一例linux
Listener動態監聽靜態監聽註冊實例oracle
今天作Advacned Replication實驗的時候碰到一個問題,啓動目標庫監聽時,出現The listener supports no servicesapp
[oracle@adrep ~]$ lsnrctl starttcp
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 14-SEP-2013 10:11:38工具
Copyright (c) 1991, 2011, Oracle. All rights reserved.this
Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...spa
TNSLSNR for Linux: Version 11.2.0.3.0 - Production.net
System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.oraxml
Log messages written to /u01/app/oracle/diag/tnslsnr/adrep/listener/alert/log.xmlip
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=adrep)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=adrep)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 14-SEP-2013 10:11:38
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/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/adrep/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=adrep)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
因爲這臺主機以前作的是stream實驗,修改了一下hostname,以前的監聽和服務名也用netca從新配置過了,可是啓動監聽一致是這個狀態,動態監聽註冊不上
本地登陸到Oracle實例,手動註冊實例也無果,問題依舊
SQL> alter system register;
System altered.
SQL> !
[oracle@adrep ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 14-SEP-2013 10:13:03
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=adrep)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 14-SEP-2013 10:11:38
Uptime 0 days 0 hr. 1 min. 25 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/adrep/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=adrep)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
[oracle@adrep ~]$ lsnrctl reload
Listener Log File /u01/app/
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 14-SEP-2013 10:16:13
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=adrep)(PORT=1521)))
The command completed successfully
[oracle@adrep ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 14-SEP-2013 10:13:18
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=adrep)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 14-SEP-2013 10:11:38
Uptime 0 days 0 hr. 1 min. 40 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/adrep/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=adrep)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
[oracle@adrep ~]$ lsnrctl stop
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 14-SEP-2013 10:17:03
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=adrep)(PORT=1521)))
The command completed successfully
[oracle@adrep ~]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 14-SEP-2013 10:18:53
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.3.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/adrep/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=adrep)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=adrep)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 14-SEP-2013 10:18:53
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/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/adrep/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=adrep)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
[oracle@adrep ~]$
因而考慮經過mgr配置靜態監聽,可是讓我鬱悶的是,老是提示須要輸入一個合法的SID
這個SID絕對是strmtarget沒錯的,global name即service name也確實是target,這個能夠由如下參數得到佐證
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string strmtarg
db_unique_name string strmtarget
global_names boolean TRUE
instance_name string strmtarget
lock_name_space string
log_file_name_convert string
processor_group_name string
service_names string target
也能夠經過v$instance視圖查到SID是正確的
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
strmtarget
難道就沒有辦法設置靜態監聽了嗎?NO,這裏還有一種方法就是手動修改listener.ora文件,添加如下幾行內容
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = target)
(SID_NAME = strmtarget)
)
)
其做用就是配置一個實例靜態監聽,只不過用這裏跳過了圖形化界面修改而已,若是是用netmgr成功修改了實例的靜態監聽,也是會生成以上幾行代碼的
這裏能夠先把listener.ora用xftp工具拷貝出來,修改完再拷貝回相同位置便可
這裏只須要從新加載一次監聽就能夠註冊上實例了
[oracle@adrep ~]$ lsnrctl reload
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 14-SEP-2013 10:32:06
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=adrep)(PORT=1521)))
The command completed successfully
[oracle@adrep ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 14-SEP-2013 10:32:14
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=adrep)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 14-SEP-2013 10:18:53
Uptime 0 days 0 hr. 13 min. 21 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/adrep/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=adrep)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "target" has 1 instance(s).
Instance "strmtarget", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@adrep ~]$
這裏target實例經過以上方法,成功地把實例註冊上了,注意"UNKNOWN"就表示是靜態註冊的,若是是"READY"則表示是動態註冊的
注意:動態和靜態監聽能夠共存,如:
[oracle@zlm ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 14-SEP-2013 09:52:23
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=zlm)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 14-SEP-2013 09:15:04
Uptime 0 days 0 hr. 37 min. 19 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/zlm/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=zlm)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "zlm11g" has 2 instance(s).
Instance "zlm11g", status UNKNOWN, has 1 handler(s) for this service...
Instance "zlm11g", status READY, has 1 handler(s) for this service...
Service "zlm11gXDB" has 1 instance(s).
Instance "zlm11g", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@zlm ~]$
以上是我在zlm主機上的監聽狀態,能夠發現,同時配置了動態和靜態的監聽
總結:以上利用了手動修改配置靜態監聽的方法成功註冊了Oracle實例,動態監聽每每須要等實例啓動後,過一段時間纔會註冊上,而靜態監聽則能夠立刻註冊。並且一旦實例重啓會形成動態監聽暫時無效,有些版本的bug甚至會致使動態監聽的註冊就再也起不來了。因此我對於監聽的觀點是,儘可能配置靜態監聽,這樣就能夠避免不少由監聽帶來的問題,諸如咱們常常會碰到的幾個ora error:ora-1254一、ora-1251四、ora-12154等,尤爲是在RAC和DG中,一個監聽的問題,每每會帶來很大的麻煩,尤爲須要引發你們的注意。