In this article, we will check about the various ways Oracle database can be shut down, what things happen during shutdown, How to shutdown the RAC Database
Oracle Shutdown steps decoded
We can shut down the Oracle database in four ways
(i) Shutdown normal
(ii) Shutdown immediate
(iii)Shutdown abort
(iv) Shutdown Transactional
sqlplus / as sysdba
shutdown Normal
sqlplus / as sysdba
shutdown Immediate
sqlplus / as sysdba
shutdown abort
sqlplus / as sysdba
shutdown Transactional
Shutdown Normal
In this mode, Oracle will wait for the in-process transaction to complete. Since it waits on all in-process transactions, this can take a long time. Also, new users are allowed to connect after this command is issued. It completes only after all the users are disconnected. It performs a clean shutdown of the database and no recovery is required after the database is opened
Shutdown Immediate
In this mode, Oracle will terminate all the connections. It will also roll back all uncommitted transactions. Current client SQL statements being processed by the database are allowed to be completed.No new connections are allowed after the command is issued. This can hang sometimes as pmon may not be able to terminate a few sessions. In that case, we can look for the alert log of the database, it will show the active session. We can terminate the process shutdown to proceed
Tue Aug 10 11:00:27 2015
Active call for process 164671 user 'Oracle' program
SHUTDOWN: waiting for active calls to complete.
Tue Aug 10 11:00:27 2015
SHUTDOWN: Active sessions prevent database close operation
we can look for the process ID 164671 on the Unix level
ps -ef|grep 164671
It will be LOCAL process, we can kill it
kill -9 164671
The shutdown should proceed
It can also hang sometimes because of large transactions to roll back and temporary segment cleanup. You can following query to check about the transaction rollback
select sum(used_ublk) from v$transaction;
Shutdown abort:
This is the hard crash of the database. This is the fastest way to shut down a database. All the processes are killed immediately. It is like your server crashed. Crash recovery is performed after the database is startup
Shutdown Transactional
Sessions that are doing transactions are allowed to be completed. It allows to shutdown of the database without interruption to the clients. No new transactions are allowed after the command is started
Stages involved in shutdown Normal, Immediate and Transactional: mode
There are the following steps for shutting down the database.
(i)Close the database.
(ii) Unmount the database.
(iii)Shut down the instance.
Close a database
- When we close the database, oracle writes all the data and recovery data in the SGA to the data files and redo log files. Next oracle closes all online datafiles and redo log files.
- Any offline datafiles of any offline tablespace have been closed already.
Unmount the database
- After the database has been closed, Oracle unmounts the database to dissociate it from its instance. At this point, the instance remains in the memory of the computer.
- After the database is unmounted, Oracle closes the control files of the database.
Shut down an Instance
- The final step in shutting down the database is shutting down an instance, The SGA is removed from the memory and the background processes are terminated.
Shutdown in Real application clusters (RAC)
We can use srvctl to shut down instances in RAC. This is the preferred way to do it
We can shut all the instances in an RAC with a single command with any mode required
srvctl stop database -d dbname -o immediate
srvctl stop database -d dbname -o abort
srvctl stop database -d dbname -o normal
Related Articles
Oracle Database and Oracle Instance
Oracle Shared Pool
How to drop the oracle database