遠端客戶端連線資料庫時提示TNS-12541: TNS: 無監聽程式

eric0435發表於2012-03-22
在windows環境下監聽程式和本地服務檔案配置如下
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
  )

ocp =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST =localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ocp)
    )
  )

當在遠端機器上使用tnsping ocp是會報TNS-12541: TNS: 無監聽程式

D:\oracle\product\10.2.0\db_1\network\admin\sqlnet.ora


已使用 TNSNAMES 介面卡來解析別名
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = 10.138.135.114)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = ocp)))
TNS-12541: TNS: 無監聽程式
原因在於當host=localhost或127.0.0.1時在遠端客戶端使用tnsping ocp時會解釋成
ip加服務名比如:10.138.135.114:1521/ocp但當在監聽程式中配置為localhost或
127.0.0.1時當遠端連線時解釋服務名時就不能對映到真正的ip所以遠端連線時就會報
TNS-12541: TNS: 無監聽程式 所以配置監聽程式和本地服務檔案時host這個引數最好使用真實的ip或機器名

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.138.135.114)(PORT = 1521))
    )
  )

ocp =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST =10.138.135.114)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ocp)
    )
  )

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

相關文章