Database News You Can Use
A monthly newsletter for Oracle users
From Database Specialists
Expert onsite and remote DBA services
for your Oracle databases
Tel: 415-344-0500 • Toll-Free: 1-888-648-0500
Ask DB Specialists: Automatic Oracle Shutdown on Linux
You’re invited to submit your Oracle-related questions to us at email@example.com. Please include your name and telephone number in your email.
This month’s question comes to us from Scott in Tuscon, AZ: We run Oracle on Linux, and we have configured the dbora script in /etc/init.d for automatic startup and shutdown. When the server starts up, the Oracle database and network listener start automatically as we would expect. However, at server shutdown the Oracle database does not shut down automatically. What are we doing wrong?
Roger Schrag of the Database Specialists team responds: The /etc/init.d directory on most Linux systems is used to store scripts that should be run when the operating system changes run levels—such as during a server startup or shutdown. Symbolic links between scripts in the /etc/init.d directory and other directories such as /etc/rc3.d tell the operating system which scripts to run in which situations, and in which order.
It is common to call the database startup script in /etc/init.d “dbora”, but you can call your script anything you like. Here is a sample dbora script for an Oracle 10g Release 2 system:
# # chkconfig: 35 99 10 # description: Start and stop the Oracle database, listener, and EM # 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 and listeners su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME" su - $ORA_OWNER -c "$ORA_HOME/bin/emctl start dbconsole" touch /var/lock/subsys/dbora ;; 'stop') # Stop the Oracle databases and listeners su - $ORA_OWNER -c "$ORA_HOME/bin/emctl stop dbconsole" su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME" rm -f /var/lock/subsys/dbora ;; esac
The necessary symbolic links can be created with statements such as:
ln -s /etc/init.d/dbora /etc/rc3.d/S99dbora ln -s /etc/init.d/dbora /etc/rc5.d/S99dbora ln -s /etc/init.d/dbora /etc/rc0.d/K10dbora ln -s /etc/init.d/dbora /etc/rc1.d/K10dbora ln -s /etc/init.d/dbora /etc/rc2.d/K10dbora ln -s /etc/init.d/dbora /etc/rc4.d/K10dbora ln -s /etc/init.d/dbora /etc/rc6.d/K10dbora
Note the lines in the dbora script that touch and remove a file called /var/lock/subsys/dbora. These lines are very important. On Linux systems, if the dbora script does not touch the /var/lock/subsys/dbora file during startup, the operating system will assume the service did not start and will not bother to shut it down during server shutdown.
So if your Oracle database starts up properly during server startup but does not shut down during server shutdown, check your dbora script (or whatever you have chosen to call it) and make sure that during startup it touches a file in /var/lock/subsys by the same name as the script itself in /etc/init.d.
This nuance is discussed on Red Hat’s website at http://www.redhat.com/magazine/008jun05/departments/tips_tricks, and also in Metalink document 222813.1. You may also want to review our popular installation guides for Oracle 10g and Oracle 9i on Linux and other platforms at http://dbspecialists.wpengine.com/presentations.html.
Last month we discussed some resources for those considering Oracle RAC. Once you have performed your research and have decided that the RAC solution is appropriate for your environment, there are some resources for your purusal that discuss the implementation of RAC:
Over the past several years, Linux has become more mainstream. As such, we continue to see an increase in implementations of Oracle on Linux. As many of you are aware, Oracle Corp. has announced their own version of Linux and has been promoting several support options for not only their version but other versions as well. Check out their “Linux Technology Center” at http://www.oracle.com/technology/tech/linux/index.html. You’ll find the latest news, training opportunities, interviews with Oracle Linux kernel team, and much more.
If you’re ready to try out Oracle on Linux yourself, check out our step-by-step guide to installing Oracle 10g on the Linux platform at http://dbspecialists.wpengine.com/presentations/oracle10glinux.html.
Everyone knows Oracle is expensive, but as the leader in database software, the cost can be very worthwhile in terms of reliability, scalability, and availability. At the same time, you can save on licensing costs if you have the knowledge, for example, to determine whether you need Standard or Enterprise Edition.
At Database Specialists, we don’t sell Oracle licensing, so we have no stake in selling customers an Oracle solution that is beyond what is required. We have a history of helping customers get the most out of their license, and a history of helping to reduce license costs substantially without reducing service levels.
If you are curious, Oracle provides list prices at http://www.oracle.com/corporate/pricing/pricelists.html. It can help to have professional assistance when determining your company’s database needs and which add-ons you may or may not need to meet your goals (such as RAC, or partitioning, etc.). We would be happy to help guide you in your licensing decisions. Just give us a call at 888-648-0500.
- http://www.databasejournal.com/features/oracle/article.php/3672056. Implementing RAC, or any clustered solution, requires planning. This is a brief overview of some of the things you need to consider in the load balancing and architecture of a RAC implementation.
- http://www.oracle.com/technology/pub/articles/smiley_rac10g_install.html. Get started by checking out this basic guide from Oracle on installing RAC on Linux for evaluation purposes.