建立数据库连接失败ORA-12514的分析解决过程

平台:
OS:CentOS release 6.5 (Final)
DB:oracle 12.1.0

  • 1. 建立数据库连接失败
[laolv@centhost3 admin]$ sqlplus "sys/forrest@ORCLRMAN as sysdba"
SQL*Plus: Release 12.1.0.2.0 Production on Sat Dec 3 17:51:59 2016
Copyright (c) 1982, 2014, Oracle.  All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect  descriptor

  • 2. 查看失败原因
[laolv@centhost3 admin]$ oerr ora 12514
12514, 00000, "TNS:listener does not currently know of service requested in connect descriptor"
// *Cause:  The listener received a request to establish a connection to a
// database or other service. The connect descriptor received by the listener
// specified a service name for a service (usually a database service)
// that either has not yet dynamically registered with the listener or has
// not been statically configured for the listener.  This may be a temporary
// condition such as after the listener has started, but before the database
// instance has registered with the listener.
// *Action: 
//  - Wait a moment and try to connect a second time.
//  - Check which services are currently known by the listener by executing:
//    lsnrctl services <listener name>
//  - Check that the SERVICE_NAME parameter in the connect descriptor of the
//    net service name used specifies a service known by the listener.
//  - If an easy connect naming connect identifier was used, check that
//    the service name specified is a service known by the listener.
//  - Check for an event in the listener.log file.


  • 3. 检查listener 状态
[laolv@centhost3 admin]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 03-DEC-2016 17:49:18

Copyright (c) 1991, 2014, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.147)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date                03-DEC-2016 17:30:28
Uptime                    0 days 0 hr. 18 min. 50 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/centhost3/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.147)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully


  • 4. 定位解决过程
1)查看listener知道的服务

点击(此处)折叠或打开

  1. [laolv@centhost3 admin]$ lsnrctl services

  2. LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 03-DEC-2016 17:49:25

  3. Copyright (c) 1991, 2014, Oracle. All rights reserved.


  4. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.147)(PORT=1521)))
  5. The listener supports no services
  6. The command completed successfully
  7. [laolv@centhost3 admin]$ vi listener.ora
  8. [laolv@centhost3 admin]$ lsnrctl services LISTENER


  9. LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 03-DEC-2016 17:50:54


  10. Copyright (c) 1991, 2014, Oracle. All rights reserved.


  11. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.147)(PORT=1521)))
  12. The listener supports no services
  13. The command completed successfully
  14. [laolv@centhost3 admin]$
2)对比另一台装有oracle数据库的host2上的lsnrctl的信息

点击(此处)折叠或打开

  1. [laolv@centhost2 admin]$ lsnrctl status
  2. LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 03-DEC-2016 18:40:12
  3. Copyright (c) 1991, 2014, Oracle. All rights reserved.
  4. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
  5. STATUS of the LISTENER
  6. ------------------------
  7. Alias LISTENER
  8. Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
  9. Start Date 22-NOV-2016 06:09:22
  10. Uptime 11 days 12 hr. 30 min. 50 sec
  11. Trace Level off
  12. Security ON: Local OS Authentication
  13. SNMP OFF
  14. Listener Parameter File /opt/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
  15. Listener Log File /opt/oracle/diag/tnslsnr/centhost2/listener/alert/log.xml
  16. Listening Endpoints Summary...
  17.   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
  18.   (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  19.   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=centhost2)(PORT=5500))(Security=(my_wallet_directory=/opt/oracle/admin/orcl/xdb_wallet))(Presentation=HTTP)(Session=RAW))
  20. Services Summary...
  21. Service "orcl" has 1 instance(s).
  22.   Instance "orcl", status READY, has 1 handler(s) for this service...
  23. Service "orclXDB" has 1 instance(s).
  24.   Instance "orcl", status READY, has 1 handler(s) for this service...
  25. Service "pdborcl" has 1 instance(s).
  26.   Instance "orcl", status READY, has 1 handler(s) for this service...
  27. The command completed successfully
  28. [laolv@centhost2 admin]$

3)是否是因为我先创建(且启动了)的listener,后创建的DB实例,导致数据库实例没有被注册到监听
参考了http://blog.itpub.net/24492954/viewspace-765551/
添加了DataBase Service后,重启:



点击(此处)折叠或打开

  1. [laolv@centhost3 admin]$ lsnrctl stop

  2. LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 03-DEC-2016 19:01:36

  3. Copyright (c) 1991, 2014, Oracle. All rights reserved.

  4. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.147)(PORT=1521)))
  5. The command completed successfully
  6. [laolv@centhost3 admin]$ lsnrctl start

  7. LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 03-DEC-2016 19:01:42

  8. Copyright (c) 1991, 2014, Oracle. All rights reserved.

  9. Starting /opt/oracle/product/12.1.0/dbhome_1/bin/tnslsnr: please wait...

  10. TNSLSNR for Linux: Version 12.1.0.2.0 - Production
  11. System parameter file is /opt/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
  12. Log messages written to /opt/oracle/diag/tnslsnr/centhost3/listener/alert/log.xml
  13. Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.147)(PORT=1521)))
  14. Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

  15. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.147)(PORT=1521)))
  16. STATUS of the LISTENER
  17. ------------------------
  18. Alias LISTENER
  19. Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
  20. Start Date 03-DEC-2016 19:01:42
  21. Uptime 0 days 0 hr. 0 min. 0 sec
  22. Trace Level off
  23. Security ON: Local OS Authentication
  24. SNMP OFF
  25. Listener Parameter File /opt/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
  26. Listener Log File /opt/oracle/diag/tnslsnr/centhost3/listener/alert/log.xml
  27. Listening Endpoints Summary...
  28.   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.147)(PORT=1521)))
  29.   (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  30. Services Summary...
  31. Service "ORCLRMAN" has 1 instance(s).
  32.   Instance "ORCLRMAN", status UNKNOWN, has 1 handler(s) for this service...
  33. The command completed successfully

4)通过alter system register来临时注册服务

点击(此处)折叠或打开

  1. [laolv@centhost3 admin]$ sqlplus / as sysdba

  2. SQL*Plus: Release 12.1.0.2.0 Production on Sat Dec 3 19:14:37 2016

  3. Copyright (c) 1982, 2014, Oracle. All rights reserved.
  4. Connected to:
  5. Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
  6. With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

  7. SQL> show parameter service_names;

  8. NAME     TYPE    VALUE
  9. ------------------------------------ ----------- ------------------------------
  10. service_names     string    orclrman
  11. SQL> alter system register;


  12. System altered.


  13. SQL> exit
  14. Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
  15. With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options


  16. [laolv@centhost3 admin]$ lsnrctl status


  17. LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 03-DEC-2016 19:16:27


  18. Copyright (c) 1991, 2014, Oracle. All rights reserved.


  19. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.147)(PORT=1521)))
  20. STATUS of the LISTENER
  21. ------------------------
  22. Alias LISTENER
  23. Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
  24. Start Date 03-DEC-2016 19:01:42
  25. Uptime 0 days 0 hr. 14 min. 45 sec
  26. Trace Level off
  27. Security ON: Local OS Authentication
  28. SNMP OFF
  29. Listener Parameter File /opt/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
  30. Listener Log File /opt/oracle/diag/tnslsnr/centhost3/listener/alert/log.xml
  31. Listening Endpoints Summary...
  32.   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.147)(PORT=1521)))
  33.   (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  34. Services Summary...
  35. Service "ORCLRMAN" has 1 instance(s).
  36.   Instance "ORCLRMAN", status UNKNOWN, has 1 handler(s) for this service...
  37. The command completed successfully
5)删掉netmgr静态注册的Database Service。重启监听。再手动alter system register注册
lsnrctl stop
lsnrctl start

点击(此处)折叠或打开

  1. [laolv@centhost3 admin]$ sqlplus / as sysdba

  2. SQL*Plus: Release 12.1.0.2.0 Production on Sat Dec 3 19:14:37 2016

  3. Copyright (c) 1982, 2014, Oracle. All rights reserved.
  4. Connected to:
  5. Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
  6. With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

  7. SQL> show parameter service_names;

  8. NAME     TYPE    VALUE
  9. ------------------------------------ ----------- ------------------------------
  10. service_names     string    orclrman
  11. SQL> alter system register;


  12. System altered.


  13. SQL> exit
  14. Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
  15. With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options


  16. [laolv@centhost3 admin]$ lsnrctl status


  17. LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 03-DEC-2016 19:16:27


  18. Copyright (c) 1991, 2014, Oracle. All rights reserved.


  19. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.147)(PORT=1521)))
  20. STATUS of the LISTENER
  21. ------------------------
  22. Alias LISTENER
  23. Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
  24. Start Date 03-DEC-2016 19:01:42
  25. Uptime 0 days 0 hr. 14 min. 45 sec
  26. Trace Level off
  27. Security ON: Local OS Authentication
  28. SNMP OFF
  29. Listener Parameter File /opt/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
  30. Listener Log File /opt/oracle/diag/tnslsnr/centhost3/listener/alert/log.xml
  31. Listening Endpoints Summary...
  32.   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.147)(PORT=1521)))
  33.   (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  34. Services Summary...
  35. Service "ORCLRMAN" has 1 instance(s).
  36.   Instance "ORCLRMAN", status UNKNOWN, has 1 handler(s) for this service...
  37. The command completed successfully

6)查看日志来定位
重启tnslsnr之前,删除log.xml

点击(此处)折叠或打开

  1. [laolv@centhost3 admin]$ cat /opt/oracle/diag/tnslsnr/centhost3/listener/alert/log.xml
  2. <msg time='2016-12-03T19:32:21.387+08:00' org_id='oracle' comp_id='tnslsnr'
  3.  type='UNKNOWN' level='16' host_id='centhost3'
  4.  host_addr='192.168.1.147' version='1'>
  5.  <txt>System parameter file is /opt/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
  6.  </txt>
  7. </msg>
  8. <msg time='2016-12-03T19:32:21.388+08:00' org_id='oracle' comp_id='tnslsnr'
  9.  type='UNKNOWN' level='16' host_id='centhost3'
  10.  host_addr='192.168.1.147'>
  11.  <txt>Log messages written to /opt/oracle/diag/tnslsnr/centhost3/listener/alert/log.xml
  12.  </txt>
  13. </msg>
  14. <msg time='2016-12-03T19:32:21.388+08:00' org_id='oracle' comp_id='tnslsnr'
  15.  type='UNKNOWN' level='16' host_id='centhost3'
  16.  host_addr='192.168.1.147'>
  17.  <txt>Trace information written to /opt/oracle/diag/tnslsnr/centhost3/listener/trace/ora_6744_139683398370752.trc
  18.  </txt>
  19. </msg>
  20. <msg time='2016-12-03T19:32:21.388+08:00' org_id='oracle' comp_id='tnslsnr'
  21.  type='UNKNOWN' level='16' host_id='centhost3'
  22.  host_addr='192.168.1.147'>
  23.  <txt>Trace level is currently 0
  24.  </txt>
  25. </msg>
  26. <msg time='2016-12-03T19:32:21.388+08:00' org_id='oracle' comp_id='tnslsnr'
  27.  type='UNKNOWN' level='16' host_id='centhost3'
  28.  host_addr='192.168.1.147'>
  29.  <txt>
  30.  </txt>
  31. </msg>
  32. <msg time='2016-12-03T19:32:21.389+08:00' org_id='oracle' comp_id='tnslsnr'
  33.  type='UNKNOWN' level='16' host_id='centhost3'
  34.  host_addr='192.168.1.147'>
  35.  <txt>Started with pid=6744
  36.  </txt>
  37. </msg>
  38. <msg time='2016-12-03T19:32:21.391+08:00' org_id='oracle' comp_id='tnslsnr'
  39.  type='UNKNOWN' level='16' host_id='centhost3'
  40.  host_addr='192.168.1.147'>
  41.  <txt>Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.147)(PORT=1521)))
  42.  </txt>
  43. </msg>
  44. <msg time='2016-12-03T19:32:21.392+08:00' org_id='oracle' comp_id='tnslsnr'
  45.  type='UNKNOWN' level='16' host_id='centhost3'
  46.  host_addr='192.168.1.147'>
  47.  <txt>Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  48.  </txt>
  49. </msg>
  50. <msg time='2016-12-03T19:32:21.402+08:00' org_id='oracle' comp_id='tnslsnr'
  51.  type='UNKNOWN' level='16' host_id='centhost3'
  52.  host_addr='192.168.1.147'>
  53.  <txt>
  54. TIMESTAMP * CONNECT DATA [* PROTOCOL INFO] * EVENT [* SID] * RETURN CODE
  55.  </txt>
  56. </msg>
  57. <msg time='2016-12-03T19:32:21.405+08:00' org_id='oracle' comp_id='tnslsnr'
  58.  type='UNKNOWN' level='16' host_id='centhost3'
  59.  host_addr='192.168.1.147'>
  60.  <txt>WARNING: Subscription for node down event still pending
  61.  </txt>
  62. </msg>
  63. <msg time='2016-12-03T19:32:21.405+08:00' org_id='oracle' comp_id='tnslsnr'
  64.  type='UNKNOWN' level='16' host_id='centhost3'
  65.  host_addr='192.168.1.147'>
  66.  <txt>03-DEC-2016 19:32:21 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=centhost3)(USER=laolv))(COMMAND=status)(ARGUMENTS=64)(SERVICE=LISTENER)(VERSION=202375680)) * status * 0
  67.  </txt>
  68. </msg>
  69. [laolv@centhost3 admin]$
重启tnslsnr之前,删除listener.log

点击(此处)折叠或打开

  1. [laolv@centhost3 alert]$ cat /opt/oracle/diag/tnslsnr/centhost3/listener/trace/listener.log
  2. Sat Dec 03 19:57:42 2016
  3. System parameter file is /opt/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
  4. Log messages written to /opt/oracle/diag/tnslsnr/centhost3/listener/alert/log.xml
  5. Trace information written to /opt/oracle/diag/tnslsnr/centhost3/listener/trace/ora_7273_140042619459008.trc
  6. Trace level is currently 0

  7. Started with pid=7273
  8. Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.147)(PORT=1521)))
  9. Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

  10. TIMESTAMP * CONNECT DATA [* PROTOCOL INFO] * EVENT [* SID] * RETURN CODE
  11. WARNING: Subscription for node down event still pending
  12. 03-DEC-2016 19:57:42 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=centhost3)(USER=laolv))(COMMAND=status)(ARGUMENTS=64)(SERVICE=LISTENER)(VERSION=202375680)) * status * 0
  13. [laolv@centhost3 alert]$
并无进展

7)对比host2和host3
发现host2多一个sqlnet.ora文件
[laolv@centhost2 admin]$ cat sqlnet.ora 
# sqlnet.ora Network Configuration File: /opt/oracle/product/12.1.0/dbhome_1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
添加sqlnet.ora到host3也不起作用,因为sqlnet.ora是为客户端服务的/置于客户机的,并不是为listener进程所用。

8)Oracle监听器无法动态注册实例的服务
参考 
http://blog.csdn.net/weiwangsisoftstone/article/details/38082487 
http://www.itpub.net/thread-1921723-1-1.html 帖子:个人怀疑计算机名为localhost时只能动态注册到127.0.0.1的ip上面,所以导致上面监听配置文件中10.98.0.122时获取不到动态注册,为了验证这个想法,个人修改了计算机名,再修改hosts文件后重启计算机后动态注册已经有了,为了验证这个问题,有时间个人再把计算机名重新改回localhost再验证下.

在http://blog.csdn.net/weiwangsisoftstone/article/details/38082487中有检测/etc/hosts, 我怀疑是(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.147)(PORT = 1521))中的HOST应该使用机器名而不能使用IP


点击(此处)折叠或打开

  1. [laolv@centhost3 admin]$ cat listener.ora
  2. # listener.ora Network Configuration File: /opt/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
  3. # Generated by Oracle configuration tools.

  4. LISTENER =
  5.   (DESCRIPTION_LIST =
  6.     (DESCRIPTION =
  7.       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.147)(PORT = 1521))
  8.     )
  9.     (DESCRIPTION =
  10.       (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
  11.     )
  12.   )

  13. ADR_BASE_LISTENER = /opt/oracle

  14. [laolv@centhost3 admin]$ cat /etc/hosts
  15. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
  16. ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
  17. 192.168.1.147 localhost
  18. 192.168.1.145 centos65
  19. 192.168.1.146 centhost2
  20. 192.168.1.147 centhost3

  21. (因为在我的另一台装有oracle的主机host2中,lsnrctl status返回的服务是READY的
  22. [laolv@centhost2 admin]$ cat listener.ora
  23. # listener.ora Network Configuration File: /opt/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
  24. # Generated by Oracle configuration tools.

  25. LISTENER =
  26.   (DESCRIPTION_LIST =
  27.     (DESCRIPTION =
  28.       (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
  29.       (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
  30.     )
  31.   )

  32. [laolv@centhost2 admin]$ cat /etc/hosts
  33. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
  34. ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
  35. 192.168.1.146 localhost
  36. 192.168.1.145 centos65
  37. 192.168.1.146 centhost2
  38. 192.168.1.147 centhost3
  39. 192.168.1.156 www.lvzhongqian.com


  40. [laolv@centhost3 admin]$ cat listener.ora
  41. # listener.ora Network Configuration File: /opt/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
  42. # Generated by Oracle configuration tools.

  43. LISTENER =
  44.   (DESCRIPTION_LIST =
  45.     (DESCRIPTION =
  46.       (ADDRESS = (PROTOCOL = TCP)(HOST = centhost3)(PORT = 1521))
  47.     )
  48.     (DESCRIPTION =
  49.       (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
  50.     )
  51.   )

  52. ADR_BASE_LISTENER = /opt/oracle

lsnrctl stop
lsnrctl start
[laolv@centhost3 admin]$ lsnrctl status

点击(此处)折叠或打开

  1. 过几分钟(因为数据库实例通过PMON进程向监听器注册service_name,也有一个周期的;大概是每3分钟一个周期)
  2. [laolv@centhost3 admin]$ lsnrctl status

  3. LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 03-DEC-2016 23:43:30

  4. Copyright (c) 1991, 2014, Oracle. All rights reserved.

  5. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=centhost3)(PORT=1521)))
  6. STATUS of the LISTENER
  7. ------------------------
  8. Alias LISTENER
  9. Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
  10. Start Date 03-DEC-2016 23:42:01
  11. Uptime 0 days 0 hr. 1 min. 29 sec
  12. Trace Level off
  13. Security ON: Local OS Authentication
  14. SNMP OFF
  15. Listener Parameter File /opt/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
  16. Listener Log File /opt/oracle/diag/tnslsnr/centhost3/listener/alert/log.xml
  17. Listening Endpoints Summary...
  18.   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=centhost3)(PORT=1521)))
  19.   (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  20.   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=centhost3)(PORT=5500))(Security=(my_wallet_directory=/opt/oracle/admin/orclrman/xdb_wallet))(Presentation=HTTP)(Session=RAW))
  21. Services Summary...
  22. Service "orclrman" has 1 instance(s).
  23.   Instance "orclrman", status READY, has 1 handler(s) for this service...
  24. Service "orclrmanXDB" has 1 instance(s).
  25.   Instance "orclrman", status READY, has 1 handler(s) for this service...
  26. The command completed successfully
  27. [laolv@centhost3 alert]$ hostname
  28. centhost3

-------------------------------------------------------点到此位置,以下为可选内容------------------------------------------------------------------

9)分析host=centos3行,host=192.168.1.147 不行的原因
参考“监听器trace file中”,我设置成host=192.168.1.147,查看listener.log和trace日志、tracsst分析trace后得到的信息,依旧没定位出原因。
·反向思维:既然知道“host=centos3行”,那就设置成host=centos3,lsnrctl reload一下,查看trace日志和使用tracsst分析一下trace日志。

tailf ora_20228**.trc:
2016-12-04 11:24:53.717415 : nlstdtp_trace_pfile: -> PARAMETER TABLE LOAD RESULTS FOLLOW <-
2016-12-04 11:24:53.717545 : nlstdtp_trace_pfile:Successful parameter table load
2016-12-04 11:24:53.717608 : nlstddp_dump_ptable: -> PARAMETER TABLE HAS THE FOLLOWING CONTENTS <-
2016-12-04 11:24:53.717656 : nlstddp_dump_ptable:  LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = centhost3)(PORT = 1521))) (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))))
2016-12-04 11:24:53.717715 : nlstddp_dump_ptable:  ADR_BASE_LISTENER = /opt/oracle
2016-12-04 11:24:53.717767 : nlstddp_dump_ptable:  TRACE_LEVEL_LISTENER = 16
2016-12-04 11:24:53.717819 : nlstddp_dump_ptable:  TRACE_TIMESTAMP_LISTENER = true
2016-12-04 11:24:53.717909 : nlstdtp_trace_pfile:--- PARAMETER SOURCE INFORMATION ENDS ---
2016-12-04 11:24:53.718027 : nsglldsec:entry
2016-12-04 11:24:53.718274 : nsglldsec:exit
TNSLSNR for Linux: Version 12.1.0.2.0 - Production on 04-DEC-2016 11:24:53

Copyright (c) 1991, 2014, Oracle.  All rights reserved.

2016-12-04 11:24:53.719602 : nlstddt_do_alter_trace:--- TRACE CONFIGURATION INFORMATION FOLLOWS ---
2016-12-04 11:24:53.719663 : nlstddt_do_alter_trace:New trace stream is /opt/oracle/diag/tnslsnr/centhost3/listener/trace/ora_20228_139696976258496.trc
2016-12-04 11:24:53.719722 : nlstddt_do_alter_trace:New trace level is 16
2016-12-04 11:24:53.719772 : nlstddt_do_alter_trace:--- TRACE CONFIGURATION INFORMATION ENDS ---
2016-12-04 11:24:53.720559 : nlstddl_do_alter_log:--- LOG CONFIGURATION INFORMATION FOLLOWS ---
2016-12-04 11:24:53.720693 : nlstddl_do_alter_log:Existing log stream is identical to desired "/opt/oracle/diag/tnslsnr/centhost3/listener/alert/log.xml"; ignoring alter
2016-12-04 11:24:53.720750 : nlstddl_do_alter_log:--- LOG CONFIGURATION INFORMATION ENDS ---

reload后还是The listener supports no services (alter system register后也是The listener supports no services)
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.147)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date                04-DEC-2016 09:58:53
Uptime                    0 days 1 hr. 35 min. 17 sec
Trace Level               support
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/centhost3/listener/alert/log.xml
Listener Trace File       /opt/oracle/diag/tnslsnr/centhost3/listener/trace/ora_20228_139696976258496.trc
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.147)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

·那就重启:
LSNRCTL> stop
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.147)(PORT=1521)))
The command completed successfully
LSNRCTL> start
Starting /opt/oracle/product/12.1.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.1.0.2.0 - Production
System parameter file is /opt/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/centhost3/listener/alert/log.xml
Trace information written to /opt/oracle/diag/tnslsnr/centhost3/listener/trace/ora_22421_140508226909632.trc
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=centhost3)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.147)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date                04-DEC-2016 11:37:04
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               support
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/centhost3/listener/alert/log.xml
Listener Trace File       /opt/oracle/diag/tnslsnr/centhost3/listener/trace/ora_22421_140508226909632.trc
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=centhost3)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.147)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date                04-DEC-2016 11:37:04
Uptime                    0 days 0 hr. 0 min. 55 sec
Trace Level               support
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/centhost3/listener/alert/log.xml
Listener Trace File       /opt/oracle/diag/tnslsnr/centhost3/listener/trace/ora_22421_140508226909632.trc
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=centhost3)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=centhost3)(PORT=5500))(Security=(my_wallet_directory=/opt/oracle/admin/orclrman/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "orclrman" has 1 instance(s).
  Instance "orclrman", status READY, has 1 handler(s) for this service...
Service "orclrmanXDB" has 1 instance(s).
  Instance "orclrman", status READY, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL> 

取listener.log、ora_22421_140508226909632.trc、 ora_22421_140508226909632.trm到本地再分析
[laolv@centhost3 trc]$ trcasst ora_22421_140508226909632.trc > ora_22421_140508226909632.trcasst
 host=192.168.1.147 ,host=centhost3 的前后 trcasst 分析信息


2016-12-04 11:37:16.104003 : nsglgrDoRegister:Creating new instance: "orclrman".
2016-12-04 11:37:16.104032 : nscontrol:entry
2016-12-04 11:37:16.104046 : nttctl:entry
2016-12-04 11:37:16.104059 : nscontrol:cmd=7, lcl=0x0
2016-12-04 11:37:16.104070 : nscontrol:normal exit
2016-12-04 11:37:16.104102 : nsglgrDoRegister:inst loads: ld1:0 mld1:10240 ld2:1 mld2:472
2016-12-04 11:37:16.104115 : nsglgrDoRegister:instance flags - req:0 cur:16
2016-12-04 11:37:16.104162 : nsglgrDoRegister:Creating new service: "orclrmanXDB".
2016-12-04 11:37:16.104182 : nsglgrDoRegister:service:orclrmanXDB flag:3 goodness:0 delta:1
2016-12-04 11:37:16.104219 : nsglgrDoRegister:Creating new service: "orclrman".
2016-12-04 11:37:16.104233 : nsglgrDoRegister:service:orclrman flag:2 goodness:0 delta:1
2016-12-04 11:37:16.104260 : nsglegln:entry
2016-12-04 11:37:16.104280 : snlinGetAddrInfo:entry
2016-12-04 11:37:16.104400 : snlinGetAddrInfo:getaddrinfo() failed with error -2
2016-12-04 11:37:16.104419 : snlinGetAddrInfo:exit
2016-12-04 11:37:16.104430 : snlinGetAddrInfo:entry
2016-12-04 11:37:16.104517 : snlinGetAddrInfo:exit
2016-12-04 11:37:16.104540 : snlinGetAddrInfo:entry
……
2016-12-04 11:37:16.104996 : snlinFreeAddrInfo:entry
2016-12-04 11:37:16.105015 : snlinFreeAddrInfo:exit
2016-12-04 11:37:16.105030 : nsglegln:exit
2016-12-04 11:37:16.105044 : nsglgrDoRegister:Creating new endpoint: "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=centhost3)(PORT=5500))(Security=(my_wallet_directory=/opt/oracle/admin/orclrman/xdb_wallet))(Presentation=HTTP)(Session=RAW))".
2016-12-04 11:37:16.105056 : nladini:entry
2016-12-04 11:37:16.105094 : nladini:exit
2016-12-04 11:37:16.105112 : nladget:entry

2016-12-04 11:37:16.106259 : nsglvldyl:Dynamic loading of valid node list successful
2016-12-04 11:37:16.106270 : nsglvldyl:exit
2016-12-04 11:37:16.106282 : nsgllsn:LSNDSC==>(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=centhost3)(PORT=5500))(Security=(my_wallet_directory=/opt/oracle/admin/orclrman/xdb_wallet))(Presentation=HTTP)(Session=RAW))
2016-12-04 11:37:16.106293 : nsglhcrt:entry
2016-12-04 11:37:16.106349 : nsglhcrt:exit
2016-12-04 11:37:16.106366 : nsglbgetRSPidx:entry
2016-12-04 11:37:16.106377 : nladini:entry
……
2016-12-04 11:37:16.106572 : nsc2addr:entry
2016-12-04 11:37:16.106583 : nsc2addr:(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=centhost3)(PORT=5500))(Security=(my_wallet_directory=/opt/oracle/admin/orclrman/xdb_wallet))(Presentation=HTTP)(Session=RAW))
2016-12-04 11:37:16.106641 : ntzini:entry
2016-12-04 11:37:16.106699 : ntzSetupConnection:entry


ora_22421_140508226909632.trcasst文件:
  *************************************************************************
    *                        Trace Assistant                                *
    *************************************************************************
<--- Received 204 bytes - Connect packet  timestamp=016-12-04 11:37:04.990220
Current NS version number is: 315.
Lowest NS version number can accommodate is: 300.
Maximum SDU size: 8192
Maximum TDU size: 4096
NT protocol characteristics:
Test for more data
Spawner is running
Hang on to Listener connection
Test operation
Full duplex I/O
Urgent data support
Generate SIGURG signal
Handoff connection to another
Line turnaround value: 0
Connect data length: 134
Connect data offset: 70
Connect data maximum size: 2048
Disable NA services on this connection
No NA services are linked in
Disable NA services on this connection
No NA services are linked in
    (ADDRESS=(PROTOCOL=beq)(PROGRAM=/opt/oracle/product/12.1.0/dbhome_1/bi
    n/tnslsnr)(ENVS=)(ARGV0=)(ARGS='LISTENER,-inherit')(DETACH=yes))

---> Send 2686976 bytes - Accept packet  timestamp=016-12-04 11:37:05.214508
Accepted NS version number is: 315.
Accepted maximum SDU size: 8192
Accepted maximum TDU size: 4096
Connect data length: 480
Connect data offset: 41
Native Services wanted
Disable NA services on this connection
No NA services are linked in
Disable NA services on this connection
No NA services are linked in
Packet data is in the following data packet


---> Send 490 bytes - Data packet  timestamp=016-12-04 11:37:05.215613
    TNSLSNR for Linux: Version 12.1.0.2.0 - Production
    System parameter file is /opt/oracle/product/12.1.0/dbhome_1/network/a
    dmin/listener.ora
    Log messages written to /opt/oracle/diag/tnslsnr/centhost3/listener/al
    ert/log.xml
    Trace information written to /opt/oracle/diag/tnslsnr/centhost3/listen
    er/trace/ora_22421_140508226909632.trc
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=centhost3)(POR
    T=1521)))
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

<--- Received 210 bytes - Connect packet  timestamp=016-12-04 11:37:05.225394
Current NS version number is: 315.
Lowest NS version number can accommodate is: 300.
Global options for the connection: 
Don't care
Maximum SDU size: 8192
Maximum TDU size: 2097152
NT protocol characteristics:
Test for more data
Test operation
Full duplex I/O
Urgent data support
Generate SIGURG signal
Generate SIGPIPE signal
Generate SIGIO signal
Handoff connection to another
Line turnaround value: 0
Connect data length: 140
Connect data offset: 70
Connect data maximum size: 2040
Disable NA services on this connection
No NA services are linked in
Disable NA services on this connection
No NA services are linked in
    (DESCRIPTION=(CONNECT_DATA=(CID=(PROGRAM=)(HOST=centhost3)(USER=laolv)
    )(COMMAND=status)(ARGUMENTS=64)(SERVICE=LISTENER)(VERSION=202375680)))


<--- Received 116 bytes - Connect packet  timestamp=016-12-04 11:37:16.088274
Current NS version number is: 315.
Lowest NS version number can accommodate is: 300.
Maximum SDU size: 8192
Maximum TDU size: 2097152
NT protocol characteristics:
Test for more data
Test operation
Full duplex I/O
Urgent data support
Generate SIGURG signal
Generate SIGPIPE signal
Generate SIGIO signal
Handoff connection to another
Line turnaround value: 0
Connect data length: 46
Connect data offset: 70
Connect data maximum size: 0
    (CONNECT_DATA=(COMMAND=service_register_NSGR))

我认为:pmon向监听器注册服务时,是基于hostname来寻找监听器的,而不是IP(可能会把IP错认为hostname)


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25097694/viewspace-2129690/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/25097694/viewspace-2129690/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值