Oracle Database and Instance
The Database is a set of physical operating system files. These files actually holds the user data and the metadata (or the data dictionary). Every running Oracle database is associated with (atleast) an Oracle instance. The Instance refers to the set of Oracle background processes or threads and a shared memory area (SGA). An instance can mount and open at most one database in its life. A database may be mounted and opened by one or more instances (using RAC) and the number of instances mounting a single database can fluctuate over time.
Database Shutdown
During a database shutdown we close the database and terminates the instance.
Different Modes in Database Shutdown
There are different modes to bring down the database:
1. Shutdown immediate
2. Shutdown transactional
3. Shutdown normal
4. Shutdown abort
No user session will be permitted once you issue any of these Shutdown commands.
Shutdown Immediate
– Oracle Database terminates any executing SQL statements and disconnects users.
– Active transactions are terminated and uncommitted changes are rolled back.
– Oracle then performs a checkpoint and then close the online datafiles.
$ sqlplus / as sysdba
SQL> shutdown immediate
Shutdown Transactional
– This mode prevents users from starting new transactions, but waits for all current transactions to complete before shutting down.
– Oracle then performs a checkpoint and then close the online datafiles.
$ sqlplus / as sysdba
SQL> shutdown transactional
Shutdown Normal
– The database waits for all connected users to disconnect before shutting down.
– It waits till all the current transactions end.
– Oracle then performs a checkpoint and then close the online datafiles.
$ sqlplus / as sysdba
SQL> shutdown normal
Shutdown Abort
– Oracle Closes the datafiles without any checkpoint.
– This is the fastest shutdown mode.
– Instance recovery is required in the next startup and hence it will take time.
$ sqlplus / as sysdba
SQL> shutdown abort
Different Phases in Database Shutdown
Close the Database
– Oracle writes the data in the SGA to the disk, updates the file headers and closes the online datafiles and the redo log files.
– But the database will still be mounted.
Dismount the Database
– After the database is closed, Oracle Database unmounts the database to disassociate it from the instance.
– After a database is unmounted, Oracle Database closes the control files of the database.
– At this point, the instance remains in memory.
Shutdown the Instance
– The last step is to remove the shared memory (SGA) and terminate the background processes.
Sometimes shutdown does not cleanup the SGA or background process completely. This can cause error during the next startup. In such situation we can force a instance startup
Comments
Tags: abort, Database DBA, How to Shutdown Oracle Database, immediate, normal, Oracle Database, Oracle DBA, oracle shutdown database, Shutdown abort, Shutdown Basics, shutdown database, shutdown immediate, Shutdown normal, Shutdown transactional, Steps to Shutdown Oracle Database, transactional