我的数据库从昨天开始工作了一年多。突然之间,我无法再连接。
我得到的错误是:
Status : Failure -Test failed: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
Oracle 11.2 Windows 7
db和侦听器都已启动并正在运行。 1521号港口开通。
C:\Apps\Oracle\product\11.2.0\dbhome_1\BIN>netstat -a -n -o| findstr "1521"
TCP 127.0.0.1:1521 0.0.0.0:0 LISTENING 2412
尝试通过sqlplus登录
C:\depot\SBApp\main>sqlplus sbdba0/sbdba0@SBDB
SQL*Plus: Release 11.2.0.2.0 Production on Thu Dec 3 10:04:29 2015
Copyright (c) 1982, 2010, Oracle. All rights reserved.
错误:
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
LISTENER.ORA
# listener.ora Network Configuration File: C:\Apps\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 = CLRExtProc)
(ORACLE_HOME = C:\Apps\Oracle\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\Apps\Oracle\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
ADR_BASE_LISTENER = C:\Apps\Oracle\product
的tnsnames.ora
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
###################################################################################################
#SBDB
SBDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = SBDB)
)
)
ifile=C:\Apps\Oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames_QA.ora
ifile=C:\Apps\Oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames_PROD.ora
我没有想法,任何帮助都将受到赞赏。
答案 0 :(得分:1)
解决,
必须用我的PC主机名替换* .ora文件中的localhost。