In this tutorial, we explain – what happens during shutdown Oracle database.
Shutdown brings down the running instance of the Oracle database gracefully or abruptly.
There are 4 modes of shutdown the database in Oracle.
- Shutdown Normal
- Shutdown Transactional
- Shutdown Immediate
- Shutdown Abort
1)What happens when we type shutdown normal on Oracle DB
- The moment shutdown command is typed, no new user can connect and establish a new connection.
- Oracle waits for all the connected users to disconnect the on their own.
- Once the last user disconnects, Oracle proceeds for a graceful shutdown.
- In the process of a graceful shutdown, it performs a checkpoint, flushes redo log buffer and database buffer cache.
- It writes checkpoint information in the datafile header and control file.
- Closes all data files, temporary files, and redo log files.
- Now Oracle dismounts the Oracle database instance by closing the control file. You are now at the dismount stage.
- At last, it kills all background processes and releases the memory.
The command to shut down the database with the normal mode is as below-
SQL>shutdown normal;
2) What happens when we type Shutdown Transactional on Oracle DB
- The moment shutdown command is typed, no new user can connect and establish a new connection.
- Oracle waits to finish all running transactions.
- Once the last running transaction is over, Oracle proceeds for a graceful shutdown.
- In the process of a graceful shutdown, it performs a checkpoint, flushes redo log buffer and database buffer cache.
- It writes checkpoint information in the datafile header and control file.
- Closes all open data files, temporary files, and redo log files.
- Now Oracle dismounts the database instance by closing the control file. You are now at the dismount stage.
- At last, it kills all background processes and releases the memory.
The command to shut down the database with the transactional model is as below-
SQL>shutdown transactional;
3) What happens when we type Shutdown Immediate on Oracle DB
- The moment shutdown command is typed, no new user can connect and establish a new connection.
- Oracle directly starts aborting all the running transactions followed by the rollback.
- Once the last transaction is over, Oracle proceeds for the graceful shutdown.
- In the process of the graceful shutdown, it performs a checkpoint, flushes redo log buffer and
- database buffer cache.
- It writes checkpoint information in datafile header and control file.
- Closes all open data files, temporary files, and redo log files.
- Now Oracle dismounts the database instance by closing the control file. You are now at dismount stage.
- At last, it kills all background processes and releases the memory.
The command to shut down the database with the immediate mode is as below-
SQL>shutdown immediate;
4) What happens when we type Shutdown Abort on Oracle DB
- The moment shutdown command is typed, no new user can connect and establish a new connection. In this mode, Oracle directly starts to release memory and kills all the background processes.
- Since Oracle has not performed checkpoint operation while shutting down the database, it required to perform instance/crash recovery of the database at the next startup.
- Whenever next time you will start this instance While going from mount to open SMON identifies that the last shutdown was not a graceful one. So it starts two-phase recovery for your database
- Now Oracle starts the ROLL FORWARD, it this phase Oracle applies all redo entries from last checkpoint position.
- At the end of ROLL BACKWARD, it opens the database for normal users. Now it starts performing the roll backward phase of the instance/crash recovery.
The command to shut down the database with abort mode is as below-
SQL>shutdown abort;