Startup and Shutdown

Starting Up Database

You can start an instance and database in a variety of ways:

  • start the instance without mounting a database
  • start the instance and mount the database, but leave it closed
  • start the instance, and mount and open the database in:
    • unrestricted mode (accessible to all users)
    • restricted mode (accessible to database administrators only)
Starting an Instance: Scenarios

NOMOUNT DATABASE:

You can start an instance without mounting a database.
STARTUP NOMOUNT;

MOUNT DATABASE:
You can start an instance and mount a database without opening it, which you can do when you want to perform specific maintenance operations. For example, the database must be mounted but not open during the following tasks:

  • renaming datafiles
  • adding, dropping, or renaming redo log files
  • enabling and disabling redo log archiving options
  • performing full database recovery

STARTUP NOMOUNT;

START and OPEN DATABASE:

Start an instance and then mount and open the database by using the STARTUP command by itself:

STARTUP;

Restricting Access to a Database at Startup

STARTUP RESTRICT;

ALTER SYSTEM
   ENABLE RESTRICTED SESSION;
ALTER SYSTEM
   DISABLE RESTRICTED SESSION;
Forcing an Instance to Start
  • You cannot shut down the current instance with the SHUTDOWN NORMAL, SHUTDOWN IMMEDIATE, or SHUTDOWN TRANSACTIONAL commands.
  • You experience problems when starting an instance.

If one of these situations arises, you can usually solve the problem by starting a new instance (and optionally mounting and opening the database) using the STARTUP command with the FORCE option (If an instance is running, STARTUP FORCE shuts it down with mode ABORT before restarting it).

 STARTUP FORCE;
STARTUP WITH RECOVERY

If you know that media recovery is required, you can start an instance, mount a database to the instance, and have the recovery process automatically start by using the STARTUP command with the RECOVER option:

STARTUP OPEN RECOVER;

Altering Database Availability

ALTER DATABASE MOUNT; (changing from nomount to mount)

ALTER DATABASE OPEN; (changing from nomount|mount to open)

ALTER DATABASE OPEN READ ONLY;ALTER DATABASE OPEN READ WRITE;

Shutting Down a Database

Shutting Down with the NORMAL Option
  • No new connections are allowed after the statement is issued.
  • Before the db is shut down, Oracle waits for all connected users to disconnect from the db.
  • The next startup of the database will not require any instance recovery procedures.SHUTDOWN NORMAL;
    Shutting Down with the IMMEDIATE Option
  • Any uncommitted transactions are rolled back. (If long uncommitted transactions exist, this method of shutdown might not complete quickly, despite its name.)
  • Oracle does not wait for users currently connected to the database to disconnect; Oracle implicitly rolls back active transactions and disconnects all connected users.SHUTDOWN IMMEDIATE;
    Shutting Down with the TRANSACTIONAL Option

    When you wish to perform a planned shutdown of an instance while allowing active transactions to complete first, use the SHUTDOWN command with the TRANSACTIONAL option:

    SHUTDOWN TRANSACTIONAL;

    Shutting Down with the ABORT Option
  • Current client SQL statements being processed by Oracle are immediately terminated.
  • Uncommitted transactions are not rolled back.
  • SHUTDOWN ABORT;

    Advertisements

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s

    %d bloggers like this: