In linux unlike windows there are no services, which means that once Oracle is installed there are respective services also created automatically when you use DBCA (Database Configuration Assistance) for the database installation. And, if you are going to create the database manually you could, or infact must create services manually, which in turn is provided by Oracle and can be configured through the "ORADIM" utility.
Therefore, these created services in windows have default behavior of automatic startup in every windows startup. But in linux, since there is nothing as Services, scripts should be created and placed in the correct location so that in every startup and shutdown of the OS, these scripts are referred and the appropriate task is completed which in our case the script is about starting and shutting down the Oracle database, which is illustrated below.
1. Change line 78 of the dbstart script
That is in file $ORACLE_HOME/bin/dbstart to “ORACLE_HOME_LISTNER=$ORACLE_HOME”
2. Edit the /etc/oratab file
vi /etc/oratab
Ensure your
ORCL:/u01/app/oracle/product/10.2.0/db_1:Y
3. Create the “dbora” script inside /etc/rc.d/init.d, And have the following entries:
##############################################
#!/bin/sh
# chkconfig: 345 99 10
# description: Oracle auto start-stop script.
#
# Set ORA_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME.
ORA_HOME=/u01/app/oracle/product/10.2.0/db_1
ORA_OWNER=oracle
if [ ! -f $ORA_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 - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
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 - $ORA_OWNER -c $ORA_HOME/bin/dbshut
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
rm -f /var/lock/subsys/dbora
;;
esac
##############################################
4. Change the persmission of the so created startup script.
chmod 775 /etc/rc.d/init.d/dbora
5. Finally, make the automatic startup and shutdown of the database persistence.
chkconfig --add dbora
Automating startup and shutdown of Oracle database 10g in Unix platform
Subscribe to:
Post Comments (Atom)
Search This Blog
About Me
Categories
- Automation (2)
- Configurations (1)
- Database Object tips (1)
- Installation (1)
- Linux (1)
- Oracle Application (Functional) (1)
- Oracle Apps DBA (6)
- Routine Activities (1)
- Security (1)
- Troubleshooting (6)
0 comments:
Post a Comment