Oracle® Database Administrator's Guide 11g Release 2 (11.2) Part Number E10595-04 |
|
|
View PDF |
When Oracle Restart is not in use, you can shut down a database instance with SQL*Plus by connecting as SYSOPER
or SYSDBA
and issuing the SHUTDOWN
command. If your database is being managed by Oracle Restart, the recommended way to shut down the database is with the srvctl stop database command.
Control is not returned to the session that initiates a database shutdown until shutdown is complete. Users who attempt connections while a shutdown is in progress receive a message like the following:
ORA-01090: shutdown in progress - connection is not permitted
Note:
You cannot shut down a database if you are connected to the database through a shared server process.There are several modes for shutting down a database: normal, immediate, transactional, and abort. Some shutdown modes wait for certain events to occur (such as transactions completing or users disconnecting) before actually bringing down the database. There is a one-hour timeout period for these events.
Details are provided in the following sections:
See Also:
Chapter 4, "Configuring Automatic Restart of an Oracle Database" for information about Oracle Restart.To shut down a database in normal situations, use one of these commands:
SQL*Plus | SRVCTL (When Oracle Restart Is In Use) |
---|---|
SHUTDOWN [NORMAL] |
srvctl stop database -d db_unique_name -o normal
|
The NORMAL
clause of the SQL*Plus SHUTDOWN
command is optional because this is the default shutdown method. For SRVCTL, if the -o option is omitted, the shutdown operation proceeds according to the stop options stored in the Oracle Restart configuration for the database. The default stop option is immediate
.
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.
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 one of the following commands:
SQL*Plus | SRVCTL (When Oracle Restart Is In Use) |
---|---|
SHUTDOWN IMMEDIATE |
srvctl stop database -d db_unique_name -o 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.
When you want to perform a planned shutdown of an instance while allowing active transactions to complete first, use one of the following commands:
SQL*Plus | SRVCTL (When Oracle Restart Is In Use) |
---|---|
SHUTDOWN TRANSACTIONAL |
srvctl stop database -d db_unique_name -o transactional
|
Transactional 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.
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.
A transactional shutdown prevents clients from losing work, and at the same time, does not require all users to log off.
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, use one of the following commands:
SQL*Plus | SRVCTL (When Oracle Restart Is In Use) |
---|---|
SHUTDOWN ABORT |
srvctl stop database -d db_unique_name -o 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 automatic instance recovery procedures.
Shutdown modes that wait for users to disconnect or for transactions to complete have a limit on the amount of time that they wait. If all events blocking the shutdown do not occur within one hour, the shutdown operation aborts with the following message: ORA-01013: user requested cancel of current operation
. This message is also displayed if you interrupt the shutdown process, for example by pressing CTRL-C
. Oracle recommends that you do not attempt to interrupt an instance shutdown. Instead, allow the shutdown process to complete, and then restart the instance.
After ORA-01013
occurs, you must consider the instance to be in an unpredictable state. You must therefore continue the shutdown process by resubmitting a SHUTDOWN
command. If subsequent SHUTDOWN
commands continue to fail, you must submit a SHUTDOWN
ABORT
command to bring down the instance. You can then restart the instance.