Network Admin   «Prev  Next»

Lesson 6 Start Net services with line commands
Objective Start a listener with line commands.

Start Net Services with Line Commands

There is a simple line command controller called the Listener Controller (lsnrctl) that can be used to start and stop a Net listener.
Let us take a look at how this works. The following simulation starts up a listener on Windows NT. You must be at the operating system command prompt to begin. For this example, we are using Windows NT with an MS-DOS prompt screen. The same commands work on the UNIX and Linux platforms.
Navigate through the simulation to see how to use the Listener Controller.
Start net8 services with line commands
As you can see from the simulation, the Listener Controller uses simple commands to control the background listener processes on your computer.
The next lesson will describe the uses of the Net Configuration Assistant.

Start Net Services with Line Commands

Click the following link below to read about starting listener with line commands.
Start Net Services with Line Commands

Oracle Integration Cloud Service
Question: How do I write a shell script to start my listener?
In addition, I also want to write a script to check to see if my listener is running.
Answer: This script uses the exit status from the lsnrctl command to determine the success or failure of the command. If lsnrctl status returns a 0 we know the command ran successfully and the listener is running. In this case, the script does not send any notifications, instead it just removes the temp file.
If, however, the lsnrctl has a non-zero exit status we know there is a problem. The script will then execute a lsnrctl start command and send an email.
# If a SID is provided as an argument it will be set and oraenv run
# otherwise we will use the current SID. If no SID is set or provided
# an error message is displayed and the script exits with a status of 1
if [ $1 ]
. oraenv
if [ ! $ORACLE_SID ]
echo "Error: No ORACLE_SID set or provided as an argument"
exit 1
#  Now check the listener status with ps -ef | grep -i lsnr
#  Then re-start the listener if it has crashed and send an e-mail alert