Oracle Shutdown steps decoded

Oracle Shutdown steps decoded

We can shutdown Oracle database in three ways
1) Shutdown normal
2) Shutdown immediate
3)Shutdown abort
4) 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 in process transaction to complete. Since it waits on all in process transaction,   this can take long time. Also new user are allowed to connect after this command is issued. It completes only after all the user are disconnected. It performs a clean shutdown of database and no recovery is required after the database is opened
Shutdown Immediate: In this mode, Oracle will terminate all the connection.It will also rollback all uncommitted transaction.Current client SQL statements being processed by the database are allowed to complete.No new connection are allowed after the command is issued. This can hang sometimes as pmon may not be able to terminate 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 hangs sometimes because of large transaction to rollback 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 hard crash of the database. This is fastest way to shutdown database.All the process are killed immediately. It is like your server crashed.  Crash recovery is performed after the database is startup

Shutdown Transactional: Session which are doing transaction are allowed to complete. Basically it allows to shutdown of database without interruption to the clients. No new transaction are allowed after the command is started

Stages involved in shutdown Normal,Immediate and Transactional: mode


There are the following steps of shutting down the database.

1)Close the database.
2) Unmount the database.
3)Shut down the instance.

1) Close a database:
When we close the database, oracle writes all the data and recovery data in the SGA to the datafiles and redo log files. Next oracle close all online datafiles and redo log files.
Any offline datafiles of any offline tablespace have been closed already.

2) Unmount the database:

After the database has been closed, Oracle unmount the database to dissociate it from its instance. At this point, instance remains in the memory of the computer.
After the database is unmounted, Oracle closes the control files of the database.

3) Shut down an Instance:

The final step in the shut down the database is the shutting down an instance, The SGA is removed from the memory and the background processes are terminated.

Related:How to find the semaphore for the Database Instance

Shutdown  in Real application clusters (RAC)

We can use srvctl to shutdown instances in RAC. Infact this is preferred way to do it

We can shutdown all the instances in a 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