Oracle

錯誤 ORA-12541: TNS: 沒有監聽器

  • March 12, 2022

每當我嘗試啟動監聽器(我只有一個 Oracle 數據庫)時,我都會得到以下資訊:

LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=admin-41f89f35d)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
32-bit Windows Error: 61: Unknown error

tnsnames.ora

# TNSNAMES.ORA Network Configuration File: F:\Oracle\network\admin\tnsnames.ora  
   # Generated by Oracle configuration tools.  

   PROJECT =  
     (DESCRIPTION =  
       (ADDRESS_LIST =  
         (ADDRESS = (PROTOCOL = TCP)(HOST = admin-xxxxxx)(PORT = 1521))  
       )  
       (CONNECT_DATA =  
         (SERVICE_NAME = PROJECT)  
       )  
     )  

   INST1_HTTP =  
     (DESCRIPTION =  
       (ADDRESS_LIST =  
         (ADDRESS = (PROTOCOL = TCP)(HOST = admin-xxxxxx)(PORT = 1521))  
       )  
       (CONNECT_DATA =  
         (SERVER = SHARED)  
         (SERVICE_NAME = MODOSE)  
         (PRESENTATION = http://HRService)  
       )  
     )  

   EXTPROC_CONNECTION_DATA =  
     (DESCRIPTION =  
       (ADDRESS_LIST =  
         (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))  
       )  
       (CONNECT_DATA =  
         (SID = PLSExtProc)  
         (PRESENTATION = RO)  
       )  
     )  

監聽器.ora

# LISTENER.ORA Network Configuration File: F:\Oracle\network\admin\listener.ora  
# Generated by Oracle configuration tools.  

LISTENER =  
 (DESCRIPTION_LIST =  
   (DESCRIPTION =  
     (ADDRESS_LIST =  
       (ADDRESS = (PROTOCOL = TCP)(HOST = admin-xxxxxx)(PORT = 1521))  
     )  
   )  
 )  

SID_LIST_LISTENER =  
 (SID_LIST =  
   (SID_DESC =  
     (SID_NAME = PLSExtProc)  
     (ORACLE_HOME = F:\Oracle)  
     (PROGRAM = extproc)  
   )  
   (SID_DESC =  
     (GLOBAL_DBNAME = PROJECT)  
     (ORACLE_HOME = F:\Oracle)  
     (SID_NAME = PROJECT)  
   )  
 ) 

我真的不知道問題是什麼。我的 tnsnames.ora 和 listener.ora 文件對我來說看起來不錯。

作為快速修復,您可以從 tnsnames.ora 和 listerner.ora 中刪除條目(相對於您的數據庫)。在您的場景中,從 tnsnames.ora 中刪除它

PROJECT =  
     (DESCRIPTION =  
       (ADDRESS_LIST =  
         (ADDRESS = (PROTOCOL = TCP)(HOST = admin-xxxxxx)(PORT = 1521))  
       )  
       (CONNECT_DATA =  
         (SERVICE_NAME = PROJECT)  
       )  
     )

這個來自listerner.ora

SID_LIST_LISTENER =  
 (SID_LIST =  
   (SID_DESC =  
     (SID_NAME = PLSExtProc)  
     (ORACLE_HOME = F:\Oracle)  
     (PROGRAM = extproc)  
   )  
   (SID_DESC =  
     (GLOBAL_DBNAME = PROJECT)  
     (ORACLE_HOME = F:\Oracle)  
     (SID_NAME = PROJECT)  
   )  
 ) 

然後你可以嘗試打開數據庫。這些條目將自動創建。我們希望聽眾這次能聽我們的。

假設您的 Oracle 軟體安裝在 F:\Oracle 中:

set ORACLE_HOME=F:\Oracle
set PATH=%ORACLE_HOME%\bin;%PATH%

lsnrctl start

應該做的伎倆。如果您使用 Oracle,請確保環境設置正確。另請注意,如果您在同一台 Windows 電腦上安裝了多個 Oracle,則會修改 PATH,以便首先從 PATH 中選擇最後安裝的 Oracle 安裝。這會產生很多副作用。

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