[20181204]低版本toad 9.6直连与ora-12505.txt

[20181204]低版本toad 9.6直连与ora-12505.txt

--//我们生产系统还保留有一台使用AMERICAN_AMERICA.US7ASCII字符集的数据库,这样由于toad新版本不支持该字符集的中文显示.
--//我一直保留toad 9.6的版本,并且这个版本是32位的,我必须在我的机器另外安装10g 32位版本的客户端,这样才能连上数据库.

--//同事前一段时间遇到使用该版本的连接问题,我已经解决,链接:http://blog.itpub.net/267265/viewspace-2219005/

--//前几天同事告诉我配置tnsnames.ora连接没有问题.而使用toad下直连模式报ora-12505错误.数据库是18c的版本
--//TNS:listener does not currently know of SID given in connect descriptor

$ oerr ora 12505
12505, 00000, "TNS:listener does not currently know of SID given 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 SID for an instance (usually a database instance) 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 instances are currently known by the listener by executing:
//    lsnrctl services <listener name>
//  - Check that the SID parameter in the connect descriptor specifies
//    an instance known by the listener.
//  - Check for an event in the listener.log file.

--//有点奇怪的是我明明直连使用服务名连接,为什么报TNS:listener does not currently know of SID given in connect descriptor.
--//而是有关sid的信息呢?

1.环境:
SYS@orclcdb> select BANNER from v$version ;
BANNER
--------------------------------------------------------------------------------
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production

--//首先我尝试使用toad 9.6直连cdb数据库,ok没有问题.而问题出现在连接pdb数据库.

$ lsnrctl status
LSNRCTL for Linux: Version 18.0.0.0.0 - Production on 04-DEC-2018 09:10:36
Copyright (c) 1991, 2018, Oracle.  All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 18.0.0.0.0 - Production
Start Date                04-DEC-2018 09:06:09
Uptime                    0 days 0 hr. 4 min. 27 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/18.0.0/grid_home/network/admin/listener.ora
Listener Log File         /u01/app/oracle_base/diag/tnslsnr/hosp2/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hosp2)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_DATA" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "64a52f53a7683286e053cda9e80aed76" has 1 instance(s).
  Instance "orclcdb", status READY, has 1 handler(s) for this service...
Service "74a69dc145f5662be0558253dd747177" has 1 instance(s).
  Instance "orclcdb", status READY, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
  Instance "orclcdb", status READY, has 1 handler(s) for this service...
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Service "orclcdb" has 1 instance(s).
  Instance "orclcdb", status READY, has 1 handler(s) for this service...
Service "orclcdbXDB" has 1 instance(s).
  Instance "orclcdb", status READY, has 1 handler(s) for this service...
The command completed successfully

--//注意看服务名orcl里面指向的实例是orclcdb.
--//突然想起链接:http://blog.itpub.net/267265/viewspace-2140061/的测试.
--//从提示上也是
ORA-12505: TNS:listener does not currently know of SID given in connect descriptor
Warning: You are no longer connected to ORACLE.
--//我明明使用服务名连接访问数据库,为什么报sid之类的错误.

--//视乎toad 9.6版本的直连模式也很奇怪,视乎还要对上sid.
--//修改监听配置文件./u01/app/oracle/product/18.0.0/grid_home/network/admin/listener.ora
--//加入如下:
USE_SID_AS_SERVICE_listener=on

--//注意文件的位置,我们的数据库很特殊,单实例asm.要修改/u01/app/oracle/product/18.0.0/grid_home/network/admin/目录下的监听配置文件.
--//监听重启也要执行:
$ srvctl stop listener ; srvctl start listener

--//这样再使用toad下直连模式就没有任何问题,连接cdb与pdb都没有问题.
--//我最终发现这个版本的toad(9.6)有bug(服务名和sid一样连接就没有问题),如果使用使用toad 12以上版本没有这个问题.

--//我在我的测试环境配置如下:
SYS@book> @ ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 04-DEC-2018 09:50:59
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(ARGV0=LLLLLL)(HOST=0.0.0.0)(PORT=1521)(ARGV0=KKKKK)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                20-SEP-2018 09:52:59
Uptime                    74 days 23 hr. 58 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/product/11.2.0.4/dbhome_1/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "BOOKSHARE" has 1 instance(s).
  Instance "book", status READY, has 1 handler(s) for this service...
Service "booK123" has 1 instance(s).
  Instance "book", status UNKNOWN, has 1 handler(s) for this service...
Service "book" has 1 instance(s).
  Instance "book", status READY, has 2 handler(s) for this service...
Service "bookXDB" has 1 instance(s).
  Instance "book", status READY, has 1 handler(s) for this service...
The command completed successfully

--//配置2个服务 bookshare,book123. bookshare 是动态服务名,book123是静态服务.

SYS@book> show parameter service
NAME          TYPE   VALUE
------------- ------ ---------------
service_names string BOOK, BOOKSHARE

--//监听配置如下:
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

#SUBSCRIBE_FOR_NODE_DOWN_EVENT_LISTENER=OFF

SID_LIST_LISTENER =
   (SID_LIST =
    (SID_DESC =
      (SDU=32767)
      (GLOBAL_DBNAME = booK123)
      (ARGV0=myapp0)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/dbhome_1)
      (SID_NAME=book)
      )
    )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(ARGV0=LLLLLL)(HOST = 0.0.0.0)(PORT = 1521)(ARGV0=KKKKK))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
  )
 )

SECURE_REGISTER_LISTENER = (TCP)
ADR_BASE_LISTENER = /u01/app/oracle
DIAG_ADR_ENABLED_LISTENER=OFF
USE_NS_PROBES_FOR_DCD=true
INBOUND_CONNECT_TIMEOUT_LISTENER=10

--//使用toad 9.6连接使用服务名bookshare,book123都会报ora-12505错误.而使用新版本toad 12不会.

posted @ 2018-12-06 09:33  lfree  阅读(259)  评论(0编辑  收藏  举报