1、新装的oracle12c 只能通过localhost来连接,通过Net Manager配置之后,如下图所示:
2、然后重启以下服务,如下图所示:
3、使用sql developer仍然无法通过IP连接,出现:状态: 失败 -测试失败: Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor,如下图所示:
4、编辑D:\InstallFile\Oracle12\app\Administrator\product\12.1.0\dbhome_1\NETWORK\ADMIN目录下的listener.ora文件,然后将:
# listener.ora Network Configuration File: D:\InstallFile\Oracle12\app\Administrator\product\12.1.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:\InstallFile\Oracle12\app\Administrator\product\12.1.0\dbhome_1) (PROGRAM = extproc) (ENVS = "EXTPROC_DLLS=ONLY:D:\InstallFile\Oracle12\app\Administrator\product\12.1.0\dbhome_1\bin\oraclr12.dll") ) ) )
LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.33)(PORT = 1521)) ) (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) )
ADR_BASE_LISTENER = D:\InstallFile\Oracle12\app\Administrator\product\12.1.0\dbhome_1\log
更改为(红色字体部分):
# listener.ora Network Configuration File: D:\InstallFile\Oracle12\app\Administrator\product\12.1.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:\InstallFile\Oracle12\app\Administrator\product\12.1.0\dbhome_1) (PROGRAM = extproc) (ENVS = "EXTPROC_DLLS=ONLY:D:\InstallFile\Oracle12\app\Administrator\product\12.1.0\dbhome_1\bin\oraclr12.dll") ) (SID_DESC = (GLOBAL_DBNAME = ORCL) (ORACLE_HOME = D:\InstallFile\Oracle12\app\Administrator\product\12.1.0\dbhome_1) (sid_name = ORCL) ) )
LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.33)(PORT = 1521)) ) (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) )
ADR_BASE_LISTENER = D:\InstallFile\Oracle12\app\Administrator\product\12.1.0\dbhome_1\log
保存之后重启第2步的两个服务。
5、重新进行测试,测试成功,如下图所示:
注意:此是连接数据库orcl的配置,如果是新建测数据库要重新设置。