[20151017]lsnrctl servcices.txt
--前几天别人问的问题,我自己也不是很清楚,做一个记录:
$ rlwrap lsnrctl
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-OCT-2015 15:42:23
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> help service
service [<listener_name>] : get the service information of the listener
LSNRCTL> help services
service [<listener_name>] : get the service information of the listener
--第1点很明显打入service或者services是1个意思。另外1点后面的参数是listener_name,而不是其它参数,这个是容易混淆的地方。
SYS@test> show parameter service
NAME TYPE VALUE
-------------- ------- -----------
service_names string test.com,b
$ lsnrctl service
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-OCT-2015 15:44:56
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xxxxx)(PORT=1521)))
Services Summary...
Service "b.com" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:3 refused:0 state:ready
LOCAL SERVER
Service "test.com" has 2 instance(s).
Instance "test", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:2 refused:20
LOCAL SERVER
Instance "test", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:3 refused:0 state:ready
LOCAL SERVER
Service "test_DGB.com" has 2 instance(s).
Instance "test", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:3
LOCAL SERVER
Instance "test", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:3 refused:0 state:ready
LOCAL SERVER
Service "test_DGMGRL.com" has 1 instance(s).
Instance "test", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0
LOCAL SERVER
The command completed successfully
$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle11g/product/11.2.0/db_2/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SDU=32767)
(GLOBAL_DBNAME = test.com)
(ORACLE_HOME = /u01/app/oracle11g/product/11.2.0/db_2)
(SID_NAME = test)
)
(SID_DESC =
(SDU=32767)
(GLOBAL_DBNAME = test_DGMGRL.com)
(ORACLE_HOME = /u01/app/oracle11g/product/11.2.0/db_2)
(SID_NAME = test)
)
(SID_DESC =
(SDU=32767)
(GLOBAL_DBNAME = test_DGB.com)
(ORACLE_HOME = /u01/app/oracle11g/product/11.2.0/db_2)
(SID_NAME = test)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = xxxxx)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = xxxxx)(PORT = 1522))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle11g
#--------------------------------------------
#Local_OS_Authentication_LISTENER=off
$ lsnrctl service SID_LIST_LISTENER
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-OCT-2015 15:46:40
Copyright (c) 1991, 2011, Oracle. All rights reserved.
$ lsnrctl service LISTENER
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-OCT-2015 15:46:47
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hisdg)(PORT=1521)))
Services Summary...
Service "b.com" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:3 refused:0 state:ready
LOCAL SERVER
Service "test.com" has 2 instance(s).
Instance "test", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:2 refused:20
LOCAL SERVER
Instance "test", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:3 refused:0 state:ready
LOCAL SERVER
Service "test_DGB.com" has 2 instance(s).
Instance "test", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:3
LOCAL SERVER
Instance "test", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:3 refused:0 state:ready
LOCAL SERVER
Service "test_DGMGRL.com" has 1 instance(s).
Instance "test", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0
LOCAL SERVER
The command completed successfully
--不过很奇怪的是,如果打入:
$ lsnrctl service xxxx
$ lsnrctl service 192.168.100.40
$ lsnrctl service 127.0.0.1
$ lsnrctl service test
--都可以通过。但是如果输入:
$ lsnrctl service test.com
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-OCT-2015 15:50:39
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=))(ADDRESS=(PROTOCOL=TCP)(HOST=69.172.200.235)(PORT=1521)))
--很明显把test.com当作IP来解析了。
$ lsnrctl service b
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-OCT-2015 15:52:16
Copyright (c) 1991, 2011, Oracle. All rights reserved.
TNS-01101: Could not find service name b
$ lsnrctl service b.com
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-OCT-2015 15:52:18
Copyright (c) 1991, 2011, Oracle. All rights reserved.
TNS-01101: Could not find service name b.com
$ oerr TNS 01101
01101, 00000, "Could not find service name %s"
// *Cause: The ervice name could not be resolved by name-lookup.
// *Action: Verify that the listener name or service name specified to
// LSNRCTL has the correct name and address defined in LISTENER.ORA or in
// TNSNAMES.ORA.
--很明显后面的listener_name 支持 监听名 , IP地址 。
--test是什么呢?最有可能的tnsnames.ora里面的别名。我修改tnsnames.ora并且加入40U别名。
TEST1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.40)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = test.com)
)
)
40U =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.40)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = test.com)
)
)
$ lsnrctl service test
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-OCT-2015 16:02:58
Copyright (c) 1991, 2011, Oracle. All rights reserved.
TNS-01101: Could not find service name test
--报错!
$ lsnrctl service Test1
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-OCT-2015 16:03:11
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.40)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=test.com)))
..... 忽略...
...
The command completed successfully
$ lsnrctl service 40U
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-OCT-2015 16:03:15
Copyright (c) 1991, 2011, Oracle. All rights reserved.
..... 忽略...
...
--说明通过tnsnames.ora的别名来获取信息。修改40U如下(IP变成了192.168.100.140):
40U =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.140)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = test.com)
)
)
$ lsnrctl service 40U
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-OCT-2015 16:12:20
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.140)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=test.com)))
TNS-12543: TNS:destination host unreachable
TNS-12560: TNS:protocol adapter error
TNS-00513: Destination host unreachable
Linux Error: 113: No route to host
--很明显这台机器不存在。找一台存在的IP看看。
$ lsnrctl service 192.168.101.115
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-OCT-2015 16:13:29
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.101.115)(PORT=1521)))
TNS-01189: The listener could not authenticate the user
$ oerr tns 1189
01189, 00000, "The listener could not authenticate the user"
// *Cause: The user attempted to issue a privileged administrative command, but
// could not be successfully authenticated by the listener using the local OS
// authentication mechanism. This may occur due to one of the following
// reasons:
// 1. The user is running a version of LSNRCTL that is lower than the version
// of the listener.
// 2. The user is attempting to administer the listener from a remote node.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// 3. The listener could not obtain the system resources needed to perform the
// authentication.
// 4. The local network connection between the listener and LSNRCTL was
// terminated unexpectedly during authentication message exchange, such as
// if LSNRCTL program was suddenly aborted.
// 5. The communication between the listener and LSNRCTL is being intercepted
// by a malicious user.
// 6. The software that the user is running is not following the authentication
// protocol, indicating a malicious user.
// *Action: Make sure that administrative commands are issued using the LSNRCTL
// tool that is of a version equal or greater than the version of the listener,
// and that the tool and the listener are running on the same node. You can
// issue the VERSION command to find out the version of the listener.
// If a malicious user is suspected, use the information provided in
// the listener log file to determine the source and nature of the requests.
// Enable listener tracing for more information. If the error persists,
// contact Oracle Support Services.
--总结:
--lsnrctl service 后面跟的参数listener_name 是 监听名 , IP地址 以及 tnsnames.ora的别名。
--前几天别人问的问题,我自己也不是很清楚,做一个记录:
$ rlwrap lsnrctl
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-OCT-2015 15:42:23
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> help service
service [<listener_name>] : get the service information of the listener
LSNRCTL> help services
service [<listener_name>] : get the service information of the listener
--第1点很明显打入service或者services是1个意思。另外1点后面的参数是listener_name,而不是其它参数,这个是容易混淆的地方。
SYS@test> show parameter service
NAME TYPE VALUE
-------------- ------- -----------
service_names string test.com,b
$ lsnrctl service
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-OCT-2015 15:44:56
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xxxxx)(PORT=1521)))
Services Summary...
Service "b.com" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:3 refused:0 state:ready
LOCAL SERVER
Service "test.com" has 2 instance(s).
Instance "test", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:2 refused:20
LOCAL SERVER
Instance "test", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:3 refused:0 state:ready
LOCAL SERVER
Service "test_DGB.com" has 2 instance(s).
Instance "test", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:3
LOCAL SERVER
Instance "test", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:3 refused:0 state:ready
LOCAL SERVER
Service "test_DGMGRL.com" has 1 instance(s).
Instance "test", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0
LOCAL SERVER
The command completed successfully
$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle11g/product/11.2.0/db_2/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SDU=32767)
(GLOBAL_DBNAME = test.com)
(ORACLE_HOME = /u01/app/oracle11g/product/11.2.0/db_2)
(SID_NAME = test)
)
(SID_DESC =
(SDU=32767)
(GLOBAL_DBNAME = test_DGMGRL.com)
(ORACLE_HOME = /u01/app/oracle11g/product/11.2.0/db_2)
(SID_NAME = test)
)
(SID_DESC =
(SDU=32767)
(GLOBAL_DBNAME = test_DGB.com)
(ORACLE_HOME = /u01/app/oracle11g/product/11.2.0/db_2)
(SID_NAME = test)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = xxxxx)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = xxxxx)(PORT = 1522))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle11g
#--------------------------------------------
#Local_OS_Authentication_LISTENER=off
$ lsnrctl service SID_LIST_LISTENER
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-OCT-2015 15:46:40
Copyright (c) 1991, 2011, Oracle. All rights reserved.
$ lsnrctl service LISTENER
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-OCT-2015 15:46:47
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hisdg)(PORT=1521)))
Services Summary...
Service "b.com" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:3 refused:0 state:ready
LOCAL SERVER
Service "test.com" has 2 instance(s).
Instance "test", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:2 refused:20
LOCAL SERVER
Instance "test", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:3 refused:0 state:ready
LOCAL SERVER
Service "test_DGB.com" has 2 instance(s).
Instance "test", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:3
LOCAL SERVER
Instance "test", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:3 refused:0 state:ready
LOCAL SERVER
Service "test_DGMGRL.com" has 1 instance(s).
Instance "test", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0
LOCAL SERVER
The command completed successfully
--不过很奇怪的是,如果打入:
$ lsnrctl service xxxx
$ lsnrctl service 192.168.100.40
$ lsnrctl service 127.0.0.1
$ lsnrctl service test
--都可以通过。但是如果输入:
$ lsnrctl service test.com
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-OCT-2015 15:50:39
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=))(ADDRESS=(PROTOCOL=TCP)(HOST=69.172.200.235)(PORT=1521)))
--很明显把test.com当作IP来解析了。
$ lsnrctl service b
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-OCT-2015 15:52:16
Copyright (c) 1991, 2011, Oracle. All rights reserved.
TNS-01101: Could not find service name b
$ lsnrctl service b.com
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-OCT-2015 15:52:18
Copyright (c) 1991, 2011, Oracle. All rights reserved.
TNS-01101: Could not find service name b.com
$ oerr TNS 01101
01101, 00000, "Could not find service name %s"
// *Cause: The ervice name could not be resolved by name-lookup.
// *Action: Verify that the listener name or service name specified to
// LSNRCTL has the correct name and address defined in LISTENER.ORA or in
// TNSNAMES.ORA.
--很明显后面的listener_name 支持 监听名 , IP地址 。
--test是什么呢?最有可能的tnsnames.ora里面的别名。我修改tnsnames.ora并且加入40U别名。
TEST1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.40)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = test.com)
)
)
40U =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.40)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = test.com)
)
)
$ lsnrctl service test
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-OCT-2015 16:02:58
Copyright (c) 1991, 2011, Oracle. All rights reserved.
TNS-01101: Could not find service name test
--报错!
$ lsnrctl service Test1
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-OCT-2015 16:03:11
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.40)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=test.com)))
..... 忽略...
...
The command completed successfully
$ lsnrctl service 40U
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-OCT-2015 16:03:15
Copyright (c) 1991, 2011, Oracle. All rights reserved.
..... 忽略...
...
--说明通过tnsnames.ora的别名来获取信息。修改40U如下(IP变成了192.168.100.140):
40U =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.140)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = test.com)
)
)
$ lsnrctl service 40U
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-OCT-2015 16:12:20
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.140)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=test.com)))
TNS-12543: TNS:destination host unreachable
TNS-12560: TNS:protocol adapter error
TNS-00513: Destination host unreachable
Linux Error: 113: No route to host
--很明显这台机器不存在。找一台存在的IP看看。
$ lsnrctl service 192.168.101.115
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 17-OCT-2015 16:13:29
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.101.115)(PORT=1521)))
TNS-01189: The listener could not authenticate the user
$ oerr tns 1189
01189, 00000, "The listener could not authenticate the user"
// *Cause: The user attempted to issue a privileged administrative command, but
// could not be successfully authenticated by the listener using the local OS
// authentication mechanism. This may occur due to one of the following
// reasons:
// 1. The user is running a version of LSNRCTL that is lower than the version
// of the listener.
// 2. The user is attempting to administer the listener from a remote node.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// 3. The listener could not obtain the system resources needed to perform the
// authentication.
// 4. The local network connection between the listener and LSNRCTL was
// terminated unexpectedly during authentication message exchange, such as
// if LSNRCTL program was suddenly aborted.
// 5. The communication between the listener and LSNRCTL is being intercepted
// by a malicious user.
// 6. The software that the user is running is not following the authentication
// protocol, indicating a malicious user.
// *Action: Make sure that administrative commands are issued using the LSNRCTL
// tool that is of a version equal or greater than the version of the listener,
// and that the tool and the listener are running on the same node. You can
// issue the VERSION command to find out the version of the listener.
// If a malicious user is suspected, use the information provided in
// the listener log file to determine the source and nature of the requests.
// Enable listener tracing for more information. If the error persists,
// contact Oracle Support Services.
--总结:
--lsnrctl service 后面跟的参数listener_name 是 监听名 , IP地址 以及 tnsnames.ora的别名。