我正在使用Oracle 11g R2数据库。我使用Oracle SQL Developer。如果我创建一个新连接并检查基本连接类型并填写我可以连接的字段。如果我选择TNS并在下拉菜单中选择我想要的那个,则会显示Failure E / S Exception:网络适配器无法建立连接。
这是tnsnames.ora。我用它来连接2个数据库,dblilly和astrea。 我可以正确连接到astrea。侦听器已启用且实例已准备就绪。你看到我想念的东西吗?您需要更多信息来帮助我吗?
# tnsnames.ora Network Configuration File: C:\OracleODAC\x32\network\admin\tnsnames.ora # Generated by Oracle configuration tools. LIDA_ALC_DBLILLY= (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=192.168.109.107) (PORT=1521) ) (CONNECT_DATA= (SERVER=dedicated) (SERVICE_NAME=orcl) ) ) LIDA_INDY_DBLILLY= (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=192.168.109.107) (PORT=1521) ) (CONNECT_DATA= (SERVER=dedicated) (SERVICE_NAME=orcl2) ) ) HARVEST_DBLILLY= (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=192.168.109.107) (PORT=1521) ) (CONNECT_DATA= (SERVER=dedicated) (SERVICE_NAME=orcl2) ) ) DELTA_DBLILLY= (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=192.168.109.107) (PORT=1521) ) (CONNECT_DATA= (SERVER=dedicated) (SERVICE_NAME=orcl2) ) ) AUTOLAB_DBLILLY= (DESCRIPTION_LIST= (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=192.168.109.107) (PORT=1521) ) (CONNECT_DATA= (SERVER=dedicated) (SERVICE_NAME=orcl2) ) ) (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=192.168.109.107) (PORT=1521) ) (CONNECT_DATA= (SERVER=dedicated) (SERVICE_NAME=orcl2) ) ) (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=192.168.109.103) (PORT=1521) ) (CONNECT_DATA= (SERVER=dedicated) (SERVICE_NAME=orcl.cartif.local) ) ) ) LIDA_INDY_ASTREA= (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=192.168.109.103) (PORT=1521) ) (CONNECT_DATA= (SERVER=dedicated) (SERVICE_NAME=orcl.cartif.local) ) ) HARVEST_ASTREA= (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=192.168.109.103) (PORT=1521) ) (CONNECT_DATA= (SERVER=dedicated) (SERVICE_NAME=orcl.cartif.local) ) ) DELTA_ASTREA= (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=192.168.109.103) (PORT=1521) ) (CONNECT_DATA= (SERVER=dedicated) (SERVICE_NAME=orcl.cartif.local) ) ) AUTOLAB_ASTREA= (DESCRIPTION_LIST= (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=192.168.109.103) (PORT=1521) ) (CONNECT_DATA= (SERVER=dedicated) (SERVICE_NAME=orcl.cartif.local) ) ) (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=192.168.109.103) (PORT=1521) ) (CONNECT_DATA= (SERVER=dedicated) (SERVICE_NAME=orcl.cartif.local) ) ) )
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora # Generated by Oracle configuration tools. SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = orcl2 (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1) (PROGRAM = extproc) (ENVS = "EXTPROC_DLLS=ONLY:/u01/app/oracle/product/11.2.0/dbhome_1/bin/oraclr11.dll") ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = dblilly)(PORT = 1521)) ) ) ADR_BASE_LISTENER = /u01/app/oracle
lsnrctl status
oracle@dblilly:/root> lsnrctl status LISTENER LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 24-AUG-2015 14:57:02 Copyright (c) 1991, 2009, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production Start Date 24-AUG-2015 12:49:04 Uptime 0 days 2 hr. 7 min. 58 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora Listener Log File /u01/app/oracle/product/11.2.0/dbhome_1/network/log/listener.log Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dblilly)(PORT=1521))) Services Summary... Service "orcl2" has 1 instance(s). Instance "orcl2", status READY, has 1 handler(s) for this service... (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1" has 1 instance(s). (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1", status UNKNOWN, has 1 handler(s) for this service... Service "orcl2XDB" has 1 instance(s). Instance "orcl2", status READY, has 1 handler(s) for this service... The command completed successfully
我可以使用此设置进行连接:
但不能用这些
答案 0 :(得分:0)
在listener.ora中,您在ENVS参数周围缺少结束"
和结束)
。
您的TNSNames文件设置为使用服务,但是在SQL Developer中,您通过SID进行连接。您还应该更改TNSNames以指定SID而不是服务名称。