Lesson 16 | Stopping the Oracle Net listener |
Objective | Use LSNRCTL to stop the listener. |
Stopping the Oracle Net Listener
Stopping the listener is quite similar in syntax to starting the listener. The command is lsnrctl stop.
For SQL*Net version 1, the stop command is
tcpctl stop
.
When the lsnrctl stop
command is issued, the following processes occur:
- Oracle checks to ensure that the listener is running:
- If so, the listener process is terminated.
Remember that terminating the listener process will not terminate any existing connections to Oracle. This is because the Oracle connections are separate processes, running as dedicated processes or through each database's dispatcher processes.
In general, the only occasions when it makes sense to stop the listener is when you're shutting down all the Oracle databases on the server to back them up. You stop the listener first, then each database on the server.
Following is a sample UNIX script to stop the listener and all databases on the DILBERT server:
Oracle Integration Cloud Service
#!/bin/ksh
ORACLE_SID=tom; export ORACLE_SID
ORACLE_HOME=/ora8/product/8.0.5;export ORACLE_HOME
# First, stop the listener . . .
lsnrctl << EOT
set password secret_password
stop
exit
EOT
# stop the tom database . . .
svrmgrl << EOT
connect internal
shutdown abort
exit
EOT
# stop the jerry database
ORACLE_SID=jerry; export ORACLE_SID
svrmgrl << EOT
connect internal
shutdown abort
exit
EOT
However, there are other times when it is advantageous to stop and re-start the listener. Early versions of SQL*Net, especially SQL*Net version 1, tend to freeze, and the only remedy is to "bounce" the listener by stopping and re-starting it.
In the next course, when we discuss troubleshooting, you will see that bouncing the listener is one of the first techniques to try when remote requests fail to connect to the database. The LSNRCTL utility also has a facility for bouncing the listener that you can invoke with the command lsnrctl reload.
The next lesson looks at defining multiple protocol listeners on a server.