Home » Infrastructure » Linux » Auto start database listner with machine on
Auto start database listner with machine on [message #565263] Sun, 02 September 2012 07:51 Go to next message
Messages: 269
Registered: February 2009
Location: pakistan
Senior Member
i install oracle 10g on linux on perform the following step but my database is not auto start with the machine on please help me where i am doing wrong..

Automatic startup and shutdown oracle on linux
Oracle database server provides two scripts to configure automatic database startup and shutdown process.

The scripts are,

Now let's look at unix level script. When a unix machine boots it runs scripts beginning with Snnname in /etc/rc3.d.

-Here the number nn indicates the order in which these scripts will be run. The name just indicates the function of the script.

In the same way shutdown scripts are named as Knnname which are run from /etc/rc0.d.

If we want that Oracle is the last program that is automatically started, and it is the first to be shutdown then we will name the startup and shutdown scripts on OS like /etc/rc3.d/S99oracle and /etc/rc0.d/K01oracle respectively.

The database script dbstart and dbora will be called from OS script /etc/rc3.d/S99oracle and /etc/rc0.d/K01oracle respectively.

Note that dbstart and dbshut take each SID, in turn, from the /etc/oratab file and
startup or shutdown the database.

Automate Startup/Shutdown of Oracle Database on Linux
Step 01: Be sure that oratab file is correct and complete.

Check for oratab file either in /etc/oratab or in /var/opt/oracle/oratab.

Database entries in the oratab file have the following format:

Here Y indicates that the database can be started up and shutdown using dbstart/dbshut script.

If in my database there is two database named arju and arjudup then my oratab file will contain the entry like,
where /var/opt/oracle/product/10.2.0/db_1 is the $ORACLE_HOME of my database.

Step 02: Create a script to call dbstart and dbshut.
In this example I will create one script that will do both startup and shutdown operation. I will name this script as dbora and will be placed in '/etc/init.d'.

a) Login as root.
b) Change directories to /etc/init.d
c) Create a file called dbora and chmod it to 750.
# touch dbora
# chmod 750 dbora
d)Edit the dbora file and make the contents of it like below.

# chkconfig: 35 99 10
# description: Starts and stops Oracle processes

case "$1" in

# Start the TNS Listener
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
# Start the Oracle databases:
su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
# Start the Intelligent Agent
if [ -f $ORA_HOME/bin/emctl ];
su - $ORA_OWNER -c "$ORA_HOME/bin/emctl start agent"
elif [ -f $ORA_HOME/bin/agentctl ]; then

su - $ORA_OWNER -c "$ORA_HOME/bin/agentctl start"
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl dbsnmp_start"
# Start Management Server
if [ -f $ORA_HOME/bin/emctl ]; then
su - $ORA_OWNER -c "$ORA_HOME/bin/emctl start dbconsole"
elif [ -f $ORA_HOME/bin/oemctl ]; then
su - $ORA_OWNER -c "$ORA_HOME/bin/oemctl start oms"
# Start HTTP Server
if [ -f $ORA_HOME/Apache/Apache/bin/apachectl]; then
su - $ORA_OWNER -c "$ORA_HOME/Apache/Apache/bin/apachectl start"
touch /var/lock/subsys/dbora
# Stop HTTP Server
if [ -f $ORA_HOME/Apache/Apache/bin/apachectl ]; then

su - $ORA_OWNER -c "$ORA_HOME/Apache/Apache/bin/apachectl stop"
# Stop the TNS Listener

su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
# Stop the Oracle databases:
su - $ORA_OWNER -c $ORA_HOME/bin/dbshut
rm -f /var/lock/subsys/dbora
# End of script dbora

3.As root perform the following to create symbolic links:

# ln -s /etc/init.d/dbora /etc/rc3.d/S99oracle
# ln -s /etc/init.d/dbora /etc/rc0.d/K01oracle

Alternatively you can register the Service using
/sbin/chkconfig --add dbora

This action registers the service to the Linux service mechanism.

4. Test the script to see if it works.

The real test is to reboot unix box and then see whether oracle is started up automatically or not.

However to test the script created in step 2, without rebooting, do the following:

Login as root and then,
# /etc/init.d/dbora start (for startup)
# /etc/init.d/dbora stop (for shutdown)

If you restart start and stop oracle database is successful then you are almost done.


[root@lnxdb init.d]# /etc/init.d/dbora start

-bash: /var/opt/oracle/product/10.2.0/db_1/bin/lsnrctl: No such file or directory

-bash: /var/opt/oracle/product/10.2.0/db_1/bin/dbstart: No such file or directory

-bash: /var/opt/oracle/product/10.2.0/db_1/bin/lsnrctl: No such file or directory

/etc/init.d/dbora: line 66: [: missing `]'

[Updated on: Sun, 02 September 2012 08:24] by Moderator

Report message to a moderator

Re: Auto start database listner with machine on [message #565266 is a reply to message #565263] Sun, 02 September 2012 08:28 Go to previous message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
First check if dbshut and dbstart scripts are working. Call them manually logged in as Oracle.
If it does not work, edit the file and fix the location of oratab.
Inside dbora, i would also export the PATH.
Something like

 /etc/init.d/dbora: line 66: [: missing `]' 

fix that.
Previous Topic: Auto start database listner with machine on
Next Topic: pl/sql developer version for linux
Goto Forum:

Current Time: Mon May 27 03:57:32 CDT 2024