1. 程式人生 > >oracle 11gR2 本地能連線上,遠端連線不上,錯誤碼:ORA-12541 TNS 無監聽程式

oracle 11gR2 本地能連線上,遠端連線不上,錯誤碼:ORA-12541 TNS 無監聽程式

注意:我本地安裝oracle11gR2 64位,桌面類;

  • 我本地安裝目錄:D:\app\ELONG\

解決辦法:

1. 修改D:\app\ELONG\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora,修改host=為你本機的IP地址,遠端通過IP訪問;

  • 修改前listener.ora,如下:
# listener.ora Network Configuration File: D:\app\ELONG\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = D:\app
\ELONG\product\11.2.0\dbhome_1) (PROGRAM = extproc) (ENVS = "EXTPROC_DLLS=ONLY:D:\app\ELONG\product\11.2.0\dbhome_1\bin\oraclr11.dll") ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) ) ) ADR_BASE_LISTENER = D:\app
\ELONG
  • 修改後listener.ora
# listener.ora Network Configuration File: D:\app\ELONG\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = D:\app\ELONG\product
\11.2.0\dbhome_1) (PROGRAM = extproc) (ENVS = "EXTPROC_DLLS=ONLY:D:\app\ELONG\product\11.2.0\dbhome_1\bin\oraclr11.dll") ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.27.135)(PORT = 1521)) ) ) ADR_BASE_LISTENER = D:\app\ELONG

2. 修改D:\app\ELONG\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames.ora,修改host=為你本機的IP地址,遠端通過IP訪問;

  • 修改tnsnames.ora前:
# tnsnames.ora Network Configuration File: D:\app\ELONG\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

SYDJ =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = SYDJ)
    )
  )

ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
    (CONNECT_DATA =
      (SID = CLRExtProc)
      (PRESENTATION = RO)
    )
  )

LISTENER_SYDJ =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
  • 修改tnsnames.ora後:
# tnsnames.ora Network Configuration File: D:\app\ELONG\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

SYDJ =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = SYDJ)
    )
  )

SYDJ2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.27.135)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = SYDJ)
    )
  )

ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
    (CONNECT_DATA =
      (SID = CLRExtProc)
      (PRESENTATION = RO)
    )
  )

LISTENER_SYDJ =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
LISTENER_SYDJ2=
  (ADDRESs = (PROTOCOL = TCP)(HOST=192.168.27.135)(PORT=1521))

結果:

  • 現在可以通過遠端連線到192.168.27.135這臺oracle資料庫;