Instance shutdown is the reverse of instance startup. When you shut down the Oracle instance, the default mode is a NORMAL
shutdown, which means users are not allowed to create new connections to the database, but the shutdown process waits for all currently connected users to exit their sessions. After all the users have disconnected, then the committed transactions are written to disk, the database files are closed, and the instance is stopped. However, there are situations in which you may not want to wait for users to disconnect on their own (IMMEDIATE
mode), or you want to let the current transactions for each user complete before they are disconnected (TRANSACTIONAL
mode). In emergency situations you can even shut down the database without waiting for the committed transactions to be written to disk (ABORT
mode).
Shutting down an instance goes through the following stages:
After all the users have exited from their sessions, or been disconnected, Oracle Database writes data in the System Global Area (SGA) to the data files and online redo log files. A checkpoint is performed on the data files and their headers are marked current as of the time of the instance shutdown. The data files and online redo log files are then closed and the state of the database is changed to CLOSED
. The control file remains open to the instance.
The Oracle instance dismounts the database and updates relevant entries in the control file to record a clean shutdown. The control file is closed. The database is now closed and dismounted. The instance is in the NOMOUNT
state.
The Oracle instance stops the background processes and deallocates the shared memory used by the SGA.
If a SHUTDOWN ABORT
or abnormal termination occurs, then the instance of an open database closes and shuts down the database instantaneously. Oracle Database does not write data in the buffers of the SGA to the data files and redo log files. The subsequent reopening of the database requires instance recovery, which Oracle Database performs automatically.