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数据库;

你可能感兴趣的:(oracle)