sqlplus / as sysdba
login oracle
"ORA-12541: TNS: no listener" error when connecting to database with PL/SQL Developer .
1. Check the listener.log log and
find the following error:
TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production on 20-September-2008 10:25:26
Copyright (c) 1991, 2005, Oracle. All rights reserved.
The system parameter file is
the log information
written to D:/oracle/product/10.2.0/db_1/network/log/listener.log for D:/oracle/product/10.2.0/db_1/network/admin/listener.ora The trace level of the trace information entered in D:/oracle/product/10.2.0/db_1/network/trace/listener.trc is
currently 0
Start listening with pid=1704
: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=//./pipe/EXTPROC1ipc)))
Error while listening to this object: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST) =0.5.0.5)(PORT=1521)))
TNS-12545: connect failed because target host or object does not exist
TNS-12560: TNS: protocol adapter error
TNS-00515: connect failed because target host or object does not exist
32 -bit Windows Error: 49: Unknown error
no longer listening: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=//./pipe/EXTPROC1ipc)))
2. Check whether Oracle's listener starts
C:/Documents and Settings/mengzhaoliang>lsnrctl status
LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 20-9月 -2008 10:5
0:44
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
TNS-12541: TNS: No Listener
TNS-12560: TNS: Protocol Adapter Error
TNS-00511: No Listener
32-bit Windows Error: 2: No such file or directory
connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=0.5.0.5)(PORT=1521)))
TNS-12535: TNS: Operation timed out
TNS-12560: TNS : Protocol adapter error
TNS-00505: Operation timed out
32-bit Windows Error: 60: Unknown error
It turned out that the listener was not started, and the "lsnrctl start" command could not be started.
C:/Documents and Settings/mengzhaoliang>lsnrctl start
LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 20-9月 -2008 10:5
2:16
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting tnslsnr: please wait...
TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - The Production
system parameter file is
written to D:/oracle/product/10.2.0/db_1/network/admin/listener.ora to D:/oracle/product/10.2. 0/db_1/network/log/listener.log log information
monitoring: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=//./pipe/EXTPROC1ipc)))
Error while listening to this object: (DESCRIPTION=( ADDRESS=(PROTOCOL=TCP)(HOST=0.5.0.5)(PORT=1521))
)
TNS-12545: connect failed because target host or object does not exist
TNS-12560: TNS: protocol adapter error
TNS-00515: due to target Host or object does not exist, connection failed
32-bit Windows Error: 49: Unknown error
The listener failed to start. See the error message above...
3、查看listener.ora的内容:
# listener.ora Network Configuration File: D:/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 0.5.0.5)(PORT = 1521))
)
)
After the original ip of the machine was changed, the above problem occurred. Change the listening ip address of the database:
change (ADDRESS = (PROTOCOL = TCP)(HOST = 0.5.0.5)(PORT = 1521))
to
(ADDRESS = ( PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
127.0.0.1: This is the IP address currently being used by the database.
4. Start Oracle's listener
C:/Documents and Settings/mengzhaoliang>lsnrctl start again
LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 20-9月 -2008 10:5
4:40
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting tnslsnr: please wait...
TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - The Production
system parameter file is
written to D:/oracle/product/10.2.0/db_1/network/admin/listener.ora to D:/oracle/product/10.2. 0/db_1/network/log/listener.log log information
monitoring: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=//./pipe/EXTPROC1ipc)))
monitoring: (DESCRIPTION=(ADDRESS=(PROTOCOL ) =tcp)(HOST=127.0.0.1)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of LISTENER
------------------------
alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production Start Date 20-Sep-2008 10:54:41
Uptime 0 days 0 hours 0 minutes 1 seconds Trace level off Security ON: Local OS Authentication SNMP OFF listener parameter file D:/oracle/product/10.2.0/db_1/network/admin/listener.ora listener log file D:/oracle/product/10.2.0/db_1/network/log/listener .log
Listening endpoint summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=//./pipe/EXTPROC1ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT =1521)))
Service
Summary..Service "PLSExtProc" contains 1 routine.
Routine "PLSExtProc", status UNKNOWN, contains 1 handler for this service...
Command executed successfully
Startup has been successful,
5.再tnsnames.ora上添加上
ORCL_127.0.0.1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
6. The following error occurs when connecting to the database again with PL/SQL Developer :
TNS-12514: TNS: The listener currently does not recognize the service requested in the connection descriptor
Check listener.log again
20-Sep-2008 11:01:54 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)(CID=
(PROGRAM=D:/plsql/plsqldev.exe)(HOST=RUIFEI-EF0ADC98)(USER=mengzhaoliang))) * (ADDRESS=
(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1267)) * establish * orcl * 12514
TNS-12514: TNS: The listener currently does not recognize the service requested in the connect descriptor
查看listener:
C:/Documents and Settings/mengzhaoliang>lsnrctl services
LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 20-9月 -2008 11:1
1:09
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
service
summary..Service "PLSExtProc" contains 1 routine.
Routine "PLSExtProc", status UNKNOWN, contains 1 handler for this service...
Handler:
"DEDICATED" Established: 0 Rejected: 0
LOCAL SERVER
Command executed successfully
7. The same error occurs with sqlplus:
C:/Documents and Settings/mengzhaoliang>sqlplusscott/mzl@ORCL_127.0.0.1
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Sep 20 11:15:09 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS:listener currently does not recognize the service requested in the connect descriptor
8. Check the listener status:
C:/Documents and Settings/mengzhaoliang>lsnrctl status
LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 20-9月 -2008 11:2
6:42
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of LISTENER
------------------------
alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production Start Date 20-Sep-2008 11:24:33
Uptime 0 days 0 hours 2 minutes 8 seconds Trace level off Security ON: Local OS Authentication SNMP OFF listener parameter file D:/oracle/product/10.2.0/db_1/network/admin/listener.ora listener log file D:/oracle/product/10.2.0/db_1/network/log/listener .log
Listening endpoint summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=//./pipe/EXTPROC1ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT =1521)))
Service
Summary..Service "PLSExtProc" contains 1 routine.
Routine "PLSExtProc", status UNKNOWN, contains 1 handler for this service...
Command executed successfully
C:/Documents and Settings/mengzhaoliang>tnsping orcl
TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 20-9月 -
2008 11:27:43
Copyright (c) 1997, 2005, Oracle. All rights reserved.
Used parameter file:
D:/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora
TNS-03505: Unable to resolve name
9、查看sqlnet.ora内容:
# sqlnet.ora Network Configuration File: D:/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
# This file is actually generated by netca. But if customers choose to
# install "Software Only", this file wont exist and without the native
# authentication, they will not be able to connect to the database on NT.
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
10.把listener.ora的内容:
# listener.ora Network Configuration File: D:/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
)
Change it to the following:
# listener.ora Network Configuration File: D:/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = orcl)
(ORACLE_HOME = D:/oracle/product/10.2.0/db_1)
# (PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = orcl))
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
)
11. Then close and restart the listener
, execute the "lsnrctl stop" and "lsnrctl stop" commands in cmd, and log in normally again!
C:/Documents and Settings/mengzhaoliang>sqlplus scott/mzl@orcl
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Sep 20 11:55:47 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL>
There is no problem logging in with PL/SQL Peveloper again.
complete!