问题如题,试了很多方法当时还是出现这个错误。
sqlplus连接是没有任何问题的。
下面是我本地相关配置。
[oracle@localhost admin]$ vi tnsnames.ora
HPSADB=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 16.156.214.144)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = HPSADB)
)
)
LISTENER_HPSADB=
(ADDRESS = (PROTOCOL = TCP)(HOST = 16.156.214.144)(PORT = 1521))
HPSA_DB=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 16.156.214.144)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = HPSA_DB)
)
)
[oracle@localhost admin]$ vi listener.ora
LISTENER =
(DESCRIPTION_LIST =
#(DESCRIPTION =
# (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
#)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 16.156.214.144)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /home/oracle/app
#被注释掉的是在网上找的一些方法,但是试过之后还是出一样的错,就注释掉再试还是出一样的错
#SID_LIST_LISTENER =
# (SID_LIST =
# (SID_DESC =
# (GLOBAL_NAME = HPSADB)
# (ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_1)
# (SID_NAME = HPSADB)
# )
# (SID_DESC =
# (PROGRAM = extproc)
# (SID_NAME = PLSExtProc)
# (ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_1)
# )
# )
[oracle@localhost bin]$ lsnrctl status
监听服务已经启动
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 15-DEC-2014 02:21:14
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=16.156.214.144)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 15-DEC-2014 02:21:04
Uptime 0 days 0 hr. 0 min. 10 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /home/oracle/app/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=16.156.214.144)(PORT=1521)))
Services Summary...
Service "HPSADB" has 1 instance(s).
Instance "HPSADB", status READY, has 1 handler(s) for this service...
Service "HPSADBXDB" has 1 instance(s).
Instance "HPSADB", status READY, has 1 handler(s) for this service...
The command completed successfully
windows上tnsnames.ora配置
HPSA_DB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 16.156.214.144)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = HPSA_DB)
)
)
使用tnsping去ping也是通的
C:\Users\chengk>tnsping HPSA_DB
TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 15-12月-2014 18:37:45
Copyright (c) 1997, 2010, Oracle. All rights reserved.
Used parameter files:
C:\ORACLE\product\11.2.0\client_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 16.156.214.144)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = HPSA_DB)))
OK (20 msec)
------解决思路----------------------
windows上tnsnames.ora配置
Plain Text code
?
1
2
3
4
5
6
7
8
9
HPSA_DB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 16.156.214.144)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = HPSA_DB)
)
)
----------------------------------------------------
SERVICE_NAME = HPSADB 这个