[转]通过Net Manager 配置Oracle 11g本地监听服务(listener service)

本文转自:http://blog.csdn.net/mozart_cai/article/details/8596504

[Target]

通过ip address 监听orcl服务,而不是通过localhost

[Prerequisite]

Windows Server 2003 32bit with Oracle 11g installed

[Steps]

1. Open Oracle Net Manager
Start->All Programs->Oracle-OraDb11g_home1->Configuration and Migration Tools->Net Manager;
 
2. Add a listener
In Oracle Net Manager window, choose listeners, click Add Address(pic Oracle Net Manager);
Host: ip address of the machine installed oracle
Port: 1521
Click "Close Button";
Click "Save";
 
3.Restart oracle listener service
Start->Command Prompt;
Type "lsnrctl";
Type "status";
Type "stop";
Type "start";
Type "status";
We find that listener service for database orcl is not running, so we edit listener.ora to make a workaround.
 
4.Edit listener.ora (seems like a workaround)
In directory "C:appAdministratorproduct11.2.0dbhome_1NETWORKADMIN",
Edit listener.ora
Origin:
  1. # listener.ora Network Configuration File: C:appAdministratorproduct11.2.0dbhome_1NETWORKADMINlistener.ora  
  2. # Generated by Oracle configuration tools.  
  3.   
  4. SID_LIST_LISTENER =  
  5.   (SID_LIST =  
  6.     (SID_DESC =  
  7.       (SID_NAME = CLRExtProc)  
  8.       (ORACLE_HOME = C:appAdministratorproduct11.2.0dbhome_1)  
  9.       (PROGRAM = extproc)  
  10.       (ENVS = "EXTPROC_DLLS=ONLY:C:appAdministratorproduct11.2.0dbhome_1inoraclr11.dll")  
  11.     )  
  12.   )  
  13.   
  14. LISTENER =  
  15.   (DESCRIPTION_LIST =  
  16.     (DESCRIPTION =  
  17.       (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))  
  18.     )  
  19.     (DESCRIPTION =  
  20.       (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))  
  21.     )  
  22.     (DESCRIPTION =  
  23.       (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.3.4)(PORT = 1521))  
  24.     )  
  25.   )  
  26.   
  27. ADR_BASE_LISTENER = C:appAdministrator  
# listener.ora Network Configuration File: C:appAdministratorproduct11.2.0dbhome_1NETWORKADMINlistener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:appAdministratorproduct11.2.0dbhome_1)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:C:appAdministratorproduct11.2.0dbhome_1inoraclr11.dll")
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.3.4)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = C:appAdministrator
 
 
After:
  1. # listener.ora Network Configuration File: C:appAdministratorproduct11.2.0dbhome_1NETWORKADMINlistener.ora  
  2. # Generated by Oracle configuration tools.  
  3.   
  4. SID_LIST_LISTENER =  
  5.   (SID_LIST =  
  6.     (SID_DESC =  
  7.       (SID_NAME = CLRExtProc)  
  8.       (ORACLE_HOME = C:appAdministratorproduct11.2.0dbhome_1)  
  9.       (PROGRAM = extproc)  
  10.       (ENVS = "EXTPROC_DLLS=ONLY:C:appAdministratorproduct11.2.0dbhome_1inoraclr11.dll")  
  11.     )  
  12.     (SID_DESC =  
  13.       (SID_NAME = ORCL)  
  14.       (ORACLE_HOME =C:appAdministratorproduct11.2.0dbhome_1)  
  15.       (GLOBAL_DBNAME = ORCL)  
  16.     )  
  17.   )  
  18.   
  19. LISTENER =  
  20.   (DESCRIPTION_LIST =  
  21.     (DESCRIPTION =  
  22.       (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))  
  23.     )  
  24.     (DESCRIPTION =  
  25.       (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))  
  26.     )  
  27.     (DESCRIPTION =  
  28.       (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.3.4)(PORT = 1521))  
  29.     )  
  30.   )  
  31.   
  32. ADR_BASE_LISTENER = C:appAdministrator  
# listener.ora Network Configuration File: C:appAdministratorproduct11.2.0dbhome_1NETWORKADMINlistener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:appAdministratorproduct11.2.0dbhome_1)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:C:appAdministratorproduct11.2.0dbhome_1inoraclr11.dll")
    )
    (SID_DESC =
      (SID_NAME = ORCL)
      (ORACLE_HOME =C:appAdministratorproduct11.2.0dbhome_1)
      (GLOBAL_DBNAME = ORCL)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.3.4)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = C:appAdministrator
 
In DOS type "lsnrtcl";
Type "status";
See changes.
Type "stop";
Type "start";
Type "status";
We find that listener service for orcl is running.
 
Done.
 
[Reference] [1]Oracle中"listener does not currently know of SID given in connect descriptor" :  http://blog.csdn.net/mozart_cai/article/details/8596526
[2]ORA-12505,TNS:listener does not currently know of SID given in connect descriptor :  http://blog.csdn.net/wl_ldy/article/details/8012992
[3]Oracle the network adapter could not establish the connection :  http://www.cnblogs.com/adolfmc/archive/2012/10/07/2713711.html
[4]JDBC 连接 Oracle 11G 问题小记 :  http://denger.iteye.com/blog/770732
原文地址:https://www.cnblogs.com/freeliver54/p/3645671.html