[20181204]低版本toad 9.6直連與ora-12505.txt

lfree發表於2018-12-04

[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不會.


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2283328/,如需轉載,請註明出處,否則將追究法律責任。

相關文章