[20151017]lsnrctl servcices.txt

[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的别名。

时间: 2024-10-02 10:39:15

[20151017]lsnrctl servcices.txt的相关文章

[20170703]ora-12516 ora-12514 rac.txt

[20170703]ora-12516 ora-12514 rac.txt --//生产系统出现问题.rac环境,版本11.2.0.4.OS版本 oracle linux 5.9 for 64.设计一些安全问题,我仅仅提供解决方案: 1.问题: --//监听提示如下: 29-JUN-2017 22:05:47 * (CONNECT_DATA=(SERVICE_NAME=aaahis)(CID=(PROGRAM=D:\laji\laji\laji.EXE)(HOST=ZLFL20170518)(U

[20160711]关闭监听的动态注册.txt

[20160711]关闭监听的动态注册.txt --这个我给别人解决dg日志不应用的问题.问题是没有设置静态注册,又关闭动态注册.自己还第一次知道存在这个参数 --DYNAMIC_REGISTRATION_LISTENER = off --再测试环境重复测试,做1个记录: 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------

[20161227]打开多个监听端口.txt

[20161227]打开多个监听端口.txt --安全等保的需求,需要在1台数据库打开2个监听端口,并且还不能是1521缺省端口.看了一些文档,做一些记录. --参考连接:http://blog.itpub.net/267265/viewspace-2083455/ 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ --

[20170120]监听重启问题2.txt

[20170120]监听重启问题2.txt --今天重启一台容灾的服务器的监听,想都没想直接lsnrctl stop,lsnrctl start.结果用户连接出现问题. --只要不清楚这套系统的工作机制,自己在测试环境做一个测试,主要问题是监听配置修改了监听的别名. 1.环境: SYS@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ ----

[20170705]lsnrctl status LISTENER_SCAN1

[20170705]lsnrctl status LISTENER_SCAN1.txt --//前几天在解决问题时遇到的问题,现在分析看看.当时没注意操作用户名,选择错误的用户执行(oracle用户执行). 1.环境: --//rac SYS@dbcn2> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- ----------

[20170705]diff比较执行结果的内容.txt

[20170705]diff比较执行结果的内容.txt --//有时候需要比较2个命令输出的结果进行比较,比较笨的方法如下,例子: $  lsnrctl status LISTENER_SCAN2 > /tmp/b2.txt $  lsnrctl status LISTENER_SCAN3 > /tmp/b3.txt $  diff -Nur /tmp/b2.txt /tmp/b3.txt --//很明显这样要生成2个文件,然后比较,实际上利用shell可以很简单的实现. $  lsnrctl

[20170706]ssh diff 问题.txt

[20170706]ssh diff 问题.txt --//昨天写的diff 比较执行结果的不同,链接http://blog.itpub.net/267265/viewspace-2141638/ --//如果对比不同机器呢?自然使用ssh. 但是我测试遇到一个问题. --//通过例子说明 $  ssh grid@192.168.xx.xxx "lsnrctl status LISTENER_SCAN1" bash: lsnrctl: command not found $  ssh

[20160513]Restrict Session与静态监听.txt

[20160513]Restrict Session与静态监听.txt --给同事讲解动静态监听时,一次测试,当执行后alter system enable restricted session;发现远程用户依旧可以登录,检查发现是静态 --监听注册搞的鬼,做一个记录.并且把各种情况做一个总结: 1.环境: SYS@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER --------------------

[20160418]修改oracle监听端口.txt

[20160418]修改oracle监听端口.txt --上午开发提出要修改oracle的监听端口,我以前测试遇到过一些问题: --链接: http://blog.itpub.net/267265/viewspace-758983/ -- 但是在11.2.0.4下遇到以前不一样的情况,时间太久了,测试在2013年做的,也许现在存在一些变化. 1.无静态注册监听: SYS@book> @ &r/ver1 PORT_STRING                    VERSION