Startup and shutdown database

Chapter3 | Startup and shutdown database

Startup a Database
Starting an Instance, and Mounting and Opening a Database Normal database operation means that an instance is started and the database is mounted and open. This mode allows any valid user to connect to the database and perform typical data access operations. Start an instance, read the initialization parameters from the default server parameter file location, and then mount and open the database by using the STARTUP command by itself (you can, of course, optionally specify the PFILE clause):
STARTUP

Starting an Instance without Mounting a Database

You can start an instance without mounting a database. Typically, you do so only during database creation. Use the STARTUP command with the NOMOUNT clause:
STARTUP NOMOUNT

Starting an Instance and Mounting a Database

You can start an instance and mount a database without opening it, allowing you to perform specific maintenance operations. For example, the database must be mounted but not open during the following tasks: • • Enabling and disabling redo log archiving options. Performing full database recovery.

Start an instance and mount the database, but leave it closed by using the STARTUP command with the MOUNT clause:
STARTUP MOUNT

Chapter3 | Startup and shutdown database

Restricting Access to an Instance at Startup

You can start an instance, and optionally mount and open a database, in restricted mode so that the instance is available only to administrative personnel (not general database users). Use this mode of instance startup when you need to accomplish one of the following tasks: • • • • Perform an export or import of database data Perform a data load (with SQL*Loader) Temporarily prevent typical users from using data During certain migration and upgrade operations Start an instance (and, optionally, mount and open the database) in restricted mode by using the STARTUP command with the RESTRICT clause:
STARTUP RESTRICT

Forcing an Instance to Start

In unusual circumstances, you might experience problems when attempting to start a database instance. You should not force a database to start unless you are faced with the following: • • 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 clause:
STARTUP FORCE

Altering Database Availability
Chapter3 | Startup and shutdown database

You can alter the availability of a database. You may want to do this in order to restrict access for maintenance reasons or to make the database read only. The following sections explain how to alter the availability of a database: • • • • Mounting a Database to an Instance Opening a Closed Database Opening a Database in Read-Only Mode Restricting Access to an Open Database
Mounting a Database to an Instance

When you need to perform specific administrative operations, the database must be started and mounted to an instance, but closed. You can achieve this scenario by starting the instance and mounting the database. To mount a database to a previously started, but not opened instance, use the SQL statement ALTER DATABASE with the MOUNT clause as follows:
ALTER DATABASE MOUNT;

Opening a Closed Database

You can make a mounted but closed database available for general use by opening the database. To open a mounted database, use the ALTER DATABASE statement with the OPEN clause:
ALTER DATABASE OPEN;

After executing this statement, any valid Oracle Database user with the CREATE SESSION system privilege can connect to the database.
Opening a Database in Read-Only Mode

The following statement opens a database in read-only mode:
ALTER DATABASE OPEN READ ONLY;

You can also open a database in read/write mode as follows:
ALTER DATABASE OPEN READ WRITE;

Shutting Down a Database
Shutting Down with the NORMAL Clause

To shut down a database in normal situations, use the SHUTDOWN command with the NORMAL clause:
Chapter3 | Startup and shutdown database

SHUTDOWN NORMAL

Normal database shutdown proceeds with the following conditions: • • •

No new connections are allowed after the statement is issued. Before the database is shut down, the database waits for all currently connected users to disconnect from the database. The next startup of the database will not require any instance recovery procedures
Shutting Down with the IMMEDIATE Clause

Use immediate database shutdown only in the following situations: • • • To initiate an automated and unattended backup When a power shutdown is going to occur soon When the database or one of its applications is functioning irregularly and you cannot contact users to ask them to log off or they are unable to log off

To shut down a database immediately, use the SHUTDOWN command with the IMMEDIATE clause:
SHUTDOWN IMMEDIATE

Immediate database shutdown proceeds with the following conditions: No new connections are allowed, nor are new transactions allowed to be started, after the statement is issued. Any uncommitted transactions are rolled back. (If long uncommitted transactions exist, this method of shutdown might not complete quickly, despite its name.) Oracle Database does not wait for users currently connected to the database to disconnect. The database implicitly rolls back active transactions and disconnects all connected users. The next startup of the database will not require any instance recovery procedures.

Shutting Down with the TRANSACTIONAL Clause

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

Transactional database shutdown proceeds with the following conditions:
Chapter3 | Startup and shutdown database

• • • •

No new connections are allowed, nor are new transactions allowed to be started, after the statement is issued. After all transactions have completed, any client still connected to the instance is disconnected. At this point, the instance shuts down just as it would when a SHUTDOWN IMMEDIATE statement is submitted. The next startup of the database will not require any instance recovery procedures.
Shutting Down with the ABORT Clause

You can shut down a database instantaneously by aborting the database instance. If possible, perform this type of shutdown only in the following situations: The database or one of its applications is functioning irregularly and none of the other types of shutdown works. • • You need to shut down the database instantaneously (for example, if you know a power shutdown is going to occur in one minute). You experience problems when starting a database instance.

When you must do a database shutdown by aborting transactions and user connections, issue the SHUTDOWN command with the ABORT clause:
SHUTDOWN ABORT

An aborted database shutdown proceeds with the following conditions: • • • • No new connections are allowed, nor are new transactions allowed to be started, after the statement is issued. Current client SQL statements being processed by Oracle Database are immediately terminated. Uncommitted transactions are not rolled back. Oracle Database does not wait for users currently connected to the database to disconnect. The database implicitly disconnects all connected users.

The next startup of the database will require instance recovery procedures

Chapter3 | Startup and shutdown database

Chapter3 | Startup and shutdown database

Sign up to vote on this title
UsefulNot useful