监听中静态注册时的服务名(即lsnrctl status显示的的service对应的名称):
1、使用listener.ora中的GLOBAL_DBNAME
2、如果listener.ora中没有GLOBAL_DBNAME,则使用listener.ora中的SID_NAME
[oracle@dwdg archivelog]$ cat $ORACLE_HOME/network/admin/listener.ora
# listener.ora Network Configuration File: /iso/db/11.2.0/network/admin/listener.ora
# Generated by Oracle configuration tools.
DW =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dwdg.hutn.com)(PORT = 1521))
)
)
SID_LIST_
DW =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME= /iso/db/11.2.0)
(SID_NAME =
DW)
)
)
ADR_BASE_
DW = /iso/db
[oracle@dwdg archivelog]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Tue Nov 8 16:32:59 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> show parameter service
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string
dwdg
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string
DW
SQL> show parameter db_unique
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_unique_name string
dwdg
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@dwdg archivelog]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 08-NOV-2016 16:33:32
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias
DW
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 08-NOV-2016 15:55:05
Uptime 0 days 0 hr. 38 min. 27 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /iso/db/11.2.0/network/admin/listener.ora
Listener Log File /iso/db/diag/tnslsnr/dwdg/dw/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dwdg.hutn.com)(PORT=1521)))
Services Summary...
Service "
DW" has 1 instance(s).
Instance "DW", status UNKNOWN, has 1 handler(s) for this service...
Service "
dwdg" has 1 instance(s).
Instance "DW", status READY, has 1 handler(s) for this service...
The command completed successfully
最好理解的例子如下
[oracle@dwdg ~]$ cat /iso/db/11.2.0/network/admin/listener.ora
# listener.ora Network Configuration File: /iso/db/11.2.0/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dwdg.hutn.com)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME= /iso/db/11.2.0)
(SID_NAME = DW)
)
(SID_DESC =
(ORACLE_HOME= /iso/db/11.2.0)
(SID_NAME = PROD1)
)
)
ADR_BASE_LISTENER = /iso/db
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string PROD1
SQL> show parameter service
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string PROD1
SQL> show parameter db_uni
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_unique_name string PROD1
[oracle@dwdg ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 20-JUN-2017 10:06:15
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dwdg.hutn.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 20-JUN-2017 09:57:39
Uptime 0 days 0 hr. 8 min. 35 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /iso/db/11.2.0/network/admin/listener.ora
Listener Log File /iso/db/diag/tnslsnr/dwdg/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dwdg.hutn.com)(PORT=1521)))
Services Summary...
Service "DW" has 1 instance(s).
Instance "DW", status UNKNOWN, has 1 handler(s) for this service...
Service "PROD1" has 2 instance(s).
Instance "PROD1", status UNKNOWN, has 1 handler(s) for this service...
Instance "PROD1", status READY, has 1 handler(s) for this service...
The command completed successfully
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30126024/viewspace-2128019/
,如需转载,请注明出处,否则将追究法律责任。