Posts Tagged ‘immediate’

Oracle Database : How to Shutdown Oracle Database – Shutdown Basics

October 3rd, 2018, posted in Oracle Queries
Share

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.Problem sys@standby> startup mount; ORACLE instance started. Total System Global Area 835104768 bytes Fixed Size 2217952 bytes Variable Size 490735648 bytes Database Buffers 335544320 bytes Redo Buffers 6606848 bytes Database mounted. sys@standby> alter database recover managed standby database using current logfile disconnect; alter database recover managed standby database using current logfile disconnect * ERROR at line 1: ORA-01153: an incompatible media recovery is active Cause This indicates a currently running media recovery process. Action sys@standby> alter database recover managed standby database cancel; sys@standby> alter database recover managed standby database using current logfile disconnect; Note When shutting down physical standby database, firstly turn off media recovery process. Otherwise the next time when starting up redo apply again, you will encounter error ORA-01153.

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

Share