Let's create oracle start up script which will help you to start and stop database through the script. This script can help you when you have to integrate Oracle with Linux cluster.
Create a file like db_startup.sh and provide belo script code into it.
---------------------------------------------------------------------------------------------
#!/bin/sh
# description: Oracle auto start-stop script.
#
# Set ORACLE_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORACLE_OWNER to the user id of the owner of the
# Oracle database in ORACLE_HOME.
ORACLE_HOME=/u01/app/oracle/11.2.0/dbhome_1
ORACLE_OWNER=oracle
if [ ! -f $ORACLE_HOME/bin/dbstart ]
then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
'start')
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbstart $ORA_HOME"
touch /var/lock/subsys/dbora
;;
'stop')
# Stop the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
rm -f /var/lock/subsys/dbora
;;
echo "Usage: $0 start|stop|restart|reload"
exit 1
esac
exit 0
---------------------------------------------------------------------------------------------
Following commands will be used for DB start-up
#sh db_startup.sh start - To start database
#sh db_startup.sh stop - To staop Database
Create a file like db_startup.sh and provide belo script code into it.
---------------------------------------------------------------------------------------------
#!/bin/sh
# description: Oracle auto start-stop script.
#
# Set ORACLE_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORACLE_OWNER to the user id of the owner of the
# Oracle database in ORACLE_HOME.
ORACLE_HOME=/u01/app/oracle/11.2.0/dbhome_1
ORACLE_OWNER=oracle
if [ ! -f $ORACLE_HOME/bin/dbstart ]
then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
'start')
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbstart $ORA_HOME"
touch /var/lock/subsys/dbora
;;
'stop')
# Stop the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
rm -f /var/lock/subsys/dbora
;;
echo "Usage: $0 start|stop|restart|reload"
exit 1
esac
exit 0
---------------------------------------------------------------------------------------------
Following commands will be used for DB start-up
#sh db_startup.sh start - To start database
#sh db_startup.sh stop - To staop Database
No comments:
Post a Comment