Oracle

無法連接到 oracle 數據庫。出現 ORA12505 錯誤

  • October 11, 2018

我是ORCALE的新手

我正在嘗試連接到 oracle 伺服器,但出現此錯誤。這以前工作正常,但現在我面臨這個問題。需要幫忙

An error was encountered performing the requested operation:

Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor


Vendor code 12505

這是我的listener.ora文件

SID_LIST_LISTNITBSCAT =
 (SID_LIST =
   (SID_DESC =
     (GLOBAL_DBNAME = ITBSCAT)
     (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
     (SID_NAME = ITBSCAT)
   )
 )

LISTENER =
 (DESCRIPTION_LIST =
   (DESCRIPTION =
     (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
   )
   (DESCRIPTION =
     (ADDRESS = (PROTOCOL = TCP)(HOST = DB-ORACLE-11G-RHEL6)(PORT = 1521))
   )
 )

ADR_BASE_LISTENER = /u01/app/oracle

LISTNITBSCAT =
 (DESCRIPTION =
   (ADDRESS = (PROTOCOL = TCP)(HOST = DB-ORACLE-11G-RHEL6)(PORT = 1522))
 )

ADR_BASE_LISTNITBSCAT = /u01/app/oracle

這是我的tnsnames.ora文件,這是我的環境

(DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(HOST = DB-ORACLE-11G-RHEL6)(PORT = 1522))
   )
   (CONNECT_DATA =
     (SERVER = DEDICATED)
     (SERVICE_NAME = ITBSCAT)
   )
 )

DMSORCL =
 (DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.2.89)(PORT = 1521))
   )
   (CONNECT_DATA =
     (SERVER = DEDICATED)
     (SERVICE_NAME = orcl)
   )
 )

ARCHDBGG =
 (DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.5.16)(PORT = 1521))
   )
   (CONNECT_DATA =
     (SERVER = DEDICATED)
     (SERVICE_NAME = archdb)
   )
 )

ORCL =
 (DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(HOST = DB-ORACLE-11G-RHEL6)(PORT = 1521))
   )
   (CONNECT_DATA =
     (SERVER = DEDICATED)
     (SERVICE_NAME = orcl)
   )
 )

監聽狀態:

Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                11-OCT-2018 18:26:36
Uptime                    0 days 2 hr. 8 min. 44 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/DB-ORACLE-11G-RHEL6/listener/alert/log.xml
Listening Endpoints Summary...
 (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=DB-ORACLE-11G-RHEL6)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@DB-ORACLE-11G-RHEL6 admin]$

天平ORCL

[oracle@DB-ORACLE-11G-RHEL6 admin]$ tnsping orcl

TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on
11-OCT-2018 21:32:30

Copyright (c) 1997, 2009, Oracle.  All rights reserved.

Used parameter files:
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora

Used TNSNAMES adapter to resolve the alias Attempting to contact
(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST =
DB-ORACLE-11G-RHEL6)(PORT = 1521))) (CONNECT_DATA = (SERVER =
DEDICATED) (SERVICE_NAME = orcl))) OK (0 msec)
[oracle@DB-ORACLE-11G-RHEL6 admin]$

這:The listener supports no services

您的數據庫未啟動,或者它已註冊到不同的偵聽器中。

假設您有最簡單的預設配置,只需使用 oracle 使用者啟動數據庫:

$ . oraenv
ORACLE_SID = [oracle] ? orcl
...
$ sqlplus / as sysdba
SQL> startup

在為 提供值時不要忘記區分大小寫ORACLE_SID

引用自:https://dba.stackexchange.com/questions/219848