Problem solve Get help with specific problems with your technologies, process and projects.

Shutting down all of your Oracle databases

Here's an easy way to shut multiple databases down immediately.

If you are running multiple databases on a single HP-UX box, the process of shutting down all the Oracle databases can be labor intensive. Oracle ships the "dbshut" script to shutdown all the databases, but the script uses a "shutdown normal," which means that the database will only shutdown after everyone is logged off it.

An easy way to automate this process is to create a copy of the dbshut script (located in $ORACLE_HOME/bin), and call the copy dbshut.immediate. When you edit the dbshut.immediate script, you will find two places that reference the shutdown command. Change both statements from shutdown to shutdown immediate (the first reference is for Oracle version 6, but I like to change it for consistency). When you need to shutdown all the databases and kill all connected sessions, just use the dbshut.immediate script. Remember that dbshut and dbshut.immediate only shutdown databases with a Y in the third column in the /etc/oratab file.

I also like to use this approach to create a shutdown.abort script, just in case a database won't shutdown using the shutdown immediate script.

Reader Feedback

Jim P. writes: "This tip needs to go one step further and mention that if you want to use the dbshut.immediate script in a non-manual basis you should change the /sbin/init.d/oracle script (on Digital/Compaq Tru64 Unix machines) to use this script in-place of the dbshut script provided by Oracle.shutdown of databases when the O/S is shutdown. I took the easier way out by modifing the Oracle supplied script."

Patrick P. writes: This is a good tip. I can add an additional modification: 'alter system checkpoint;', before the shutdown command. shutdown immediate performs a checkpoint, however it can still hang for various reasons such as unfinished remote transactions. It's nice to get a checkpoint done before hpux preemptively stops all oracle processes on its way down.

About the Author

James Giordano is an Oracle database administrator. He has been working with Oracle for about seven years, and also has experience with UNIX and PeopleSoft/Oracle financials.

For More Information

  • What do you think about this tip? E-mail the Editor at [email protected] with your feedback.
  • The Best Oracle Web Links: tips, tutorials, scripts, and more.
  • Have an Oracle tip to offer your fellow DBA's and developers? The best tips submitted will receive a cool prize--submit your tip today!
  • Ask your technical Oracle questions--or help out your peers by answering them--in our live discussion forums.
  • Check out our Ask the Experts feature: Our SQL, database design, Oracle, SQL Server, DB2, metadata, and data warehousing gurus are waiting to answer your toughest questions.

Dig Deeper on Oracle database design and architecture