本文转自: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:
- # 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
# 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:
- # 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
# 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
[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