[20151017]lsnrctl servcices.txt

简介: [20151017]lsnrctl servcices.txt --前几天别人问的问题,我自己也不是很清楚,做一个记录: $ rlwrap lsnrctl LSNRCTL for Linux: Version 11.
[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的别名。
目录
相关文章
|
Oracle 关系型数据库
[20180502]ORA-01580.txt
[20180502]ORA-01580.txt RMAN> backup current controlfile; Starting backup at 2018-05-02 15:36:03 using channel ORA_DISK_1 using...
1174 0
|
关系型数据库 Oracle Linux
[20180321]ORA-08180.txt
[20180321]ORA-08180.txt $ oerr ora 08180 08180, 00000, "no snapshot found based on specified time" // *Cause: Could not match the time to an SCN from the mapping table.
1297 0
|
Oracle 关系型数据库 数据库
[20171208]ORA-16014(10G).txt
[20171208]ORA-16014(10G).txt --//别人配置dg遇到的问题,当时没有记录.在自己的环境做一个演示.这个问题相对隐藏很深.主要是自己不注意这些细节.
1201 0
|
Oracle 关系型数据库 Linux
|
关系型数据库 Oracle Linux
[20170628]12C ORA-54032.txt
[20170628]12C ORA-54032.txt https://hourim.wordpress.com/2017/06/24/ora-54032-column-to-be-renamed-is-used-in-a-virtual-column-expres...
1460 0
|
SQL 网络协议 Oracle
[20170419]ora-28547.txt
[20170419]ora-28547.txt --//测试环境,莫名奇妙使用toad登陆出现如下错误(使用ezconnect方式)。 ORA-28547: connection to server failed, probable Oracle Net adm...
1412 0
[20160623]ora-00445.txt
[20160623]ora-00445.txt Wed Jun 22 07:38:25 2016 Errors in file e:\app\administrator\diag\rdbms\orcl\orcl\trace\orcl_smco_3976.
1323 0
|
Oracle 关系型数据库 Perl
|
Oracle 关系型数据库 数据库
[20150529]ORA-16664.txt
[20150529]ORA-16664.txt --今天在例行检查中.执行 dgmgrl 出现ora-16664错误. --检查drcdbcn1.log文件,发现如下错误.
996 0
|
Oracle 关系型数据库 数据库
[20141225]ORA-1105.txt
[20141225]ORA-1105.txt --前一阵子,服务器内存耗尽重启,数据库无法启动,查看alert*.log文件,出现如下提示: Wed Nov 19 10:52:42 2014 ALTER SYSTEM SET local_listener=' (ADDRESS=(PROTOCOL=TCP)(HOST=192.
802 0