Wednesday, December 16, 2015

Differences Between the Startup and Shutdown Procedures


PURPOSE
-------

This article explains the differences in shutdown and startup procedures.

 
SCOPE & APPLICATION
-------------------

This is a tutorial for new Oracle DBAs.  

For the most complete information regarding database administration, please 
refer to the Oracle Server Administrator's Guide.


STARTING AND STOPPING AN ORACLE DATABASE
----------------------------------------

The most common tool used to startup and shutdown the Oracle database from the 
command line is Server Manager.  Beginning with Oracle8i, you can also use 
SQL*Plus.  (If you want to use Oracle Enterprise Manager GUI tools, please 
refer to the Oracle Enterprise Manager Administrator's Guide for instructions.)

You will have to login as a user with administrative privileges, specifically 
a user with SYSDBA privileges.  Most DBAs are familiar with using the INTERNAL 
user (which is a synonym for the SYS user connected as SYSDBA) to startup and 
shutdown the database.  In a future release of Oracle, however, the INTERNAL 
user will become obsolete.  Therefore, you should setup your DBAs as SYSDBA 
users.  

Please refer to Note:50507.1  "TECH: SYSDBA and SYSOPER Privileges in Oracle8 
and Oracle7" for more information about setting up privileged users.


The Startup Procedure: 
====================== 
 
There are three stages in starting an Oracle database:

·	Start the instance 
·	Mount the database 
·	Open the database 

You can control which stage by issuing different options on the STARTUP 
command.  

 
STARTUP NOMOUNT
  
This will only start the Oracle instance.  Oracle reads the initialization 
parameter file (init.ora) to determine where the control files are located, 
how large to create the System Global Area (SGA), and what background 
processes to create.  When the instance is started, you will receive 
notification and a listing of SGA memory structures and sizes:

ORACLE instance started.
Total System Global Area                  56011696 bytes
Fixed Size                                   52144 bytes
Variable Size                             51785728 bytes
Database Buffers                           4096000 bytes
Redo Buffers                                 77824 bytes
 

STARTUP MOUNT 

This command starts the instance and mounts the database without opening it.  
Oracle reads control files for information about the data files and redo logs, 
but doesn't open the files.  This is required when performing maintenance 
operations such as renaming datafiles, altering redo logs or enabling 
archiving.  In addition to seeing the SGA listing, you will see "Database 
mounted." 
 

STARTUP

This command starts the instance, then mounts and opens the database.  The 
database opens online datafiles and online redo logs, and usually will acquire 
one or more rollback segments.  You will see "Database Open" when the database 
is ready for normal database operations.  


If you use either STARTUP NOMOUNT or STARTUP MOUNT, you must use the ALTER 
DATABASE command to proceed opening the database.  For example, from the 
NOMOUNT position (i.e., instance is started, but database is not mounted), 
you will need to issue two commands:

ALTER DATABASE MOUNT;
ALTER DATABASE OPEN;

From the MOUNT state, you will only have to issue ALTER DATABASE OPEN.


There are other options you can specify at startup:


STARTUP RESTRICT  

The database will be opened, but only privileged users (users with the DBA 
role granted) can use the database. 


STARTUP FORCE

This command does a combination of shutdown abort and startup.  Use this only
when experiencing problems in shutting down or starting the database.
 


 
The Shutdown Procedure: 
======================= 
 
There are four different shutdown options:


SHUTDOWN NORMAL
  
This is the default option for the SHUTDOWN command; therefore, you can issue 
SHUTDOWN, and your database will be shutdown NORMAL.  

No new connections are allowed after the statement is issued.  Before the 
database is shutdown, Oracle waits for all currently connected users to 
disconnect from the database.  The next startup of the database will not 
require any instance recovery.  
 

SHUTDOWN IMMEDIATE  
 
This option is used when you want to shutdown quickly, but still allow the 
database to shutdown cleanly.  

Current SQL statements being processed by Oracle are terminated immediately.  
Any uncommitted transactions are rolled back.  (If long uncommitted 
transactions exist, the shutdown might not complete as quickly.)  Oracle does 
not wait for users to disconnect; it implicitly rolls back active transactions 
and disconnects all connected users.  


SHUTDOWN TRANSACTIONAL

This option is only available in version 8.1.X.  Use this option when you want 
to perform a planned shutdown while allowing active transactions to complete.  
Any new connections or transactions will be denied.  After all active 
transactions complete, the database will be shutdown as if an IMMEDIATE option 
was used.  


SHUTDOWN ABORT 

This option should only be used as a last resort.  Use if:

·	The database is functioning irregularly and you cannot do a shutdown 
        normal or shutdown immediate.  
·	You need to shutdown the database instantaneously. 
·	You experience problems starting the database instance. 

All current client SQL statements being processed will immediately terminate.   
Any uncommitted transactions will not be rolled back.  Oracle does not wait 
for users currently connected to the database to disconnect, but will 
disconnect all connected users. 

The next STARTUP of the database will require instance recovery; therefore, 
the next startup may take longer than usual.  



1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete