Shutting Down a Database
To initiate database shutdown, use the SQL*Plus SHUTDOWN
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.To shut down a database and instance, you must first connect as SYSOPER
or SYSDBA
. There are several modes for shutting down a database. These are discussed in the following sections:
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. This timeout behavior is discussed in this additional section:
Shutting Down with the NORMAL Clause
To shut down a database in normal situations, use the SHUTDOWN
command with the NORMAL
clause:
SHUTDOWN NORMAL
The NORMAL
clause is optional, because this is the default shutdown method if no clause is provided.
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.
Mon Aug 16 23:39:04 2010
Starting background process EMN0
Mon Aug 16 23:39:05 2010
Shutting down instance: further logons disabled
EMN0 started with pid=24, OS id=7879
Mon Aug 16 23:39:05 2010
Stopping background process QMNC
Mon Aug 16 23:39:05 2010
Stopping background process CJQ0
Mon Aug 16 23:39:07 2010
Stopping background process MMNL
Mon Aug 16 23:39:08 2010
Stopping background process MMON
Mon Aug 16 23:39:09 2010
Shutting down instance (normal)
License high water mark = 3
Mon Aug 16 23:39:09 2010
Stopping Job queue slave processes
Mon Aug 16 23:39:09 2010
Job queue slave processes stopped
##断开用户连接后
Mon Aug 16 23:39:41 2010
All dispatchers and shared servers shutdown
Mon Aug 16 23:39:41 2010
ALTER DATABASE CLOSE NORMAL
Mon Aug 16 23:39:41 2010
SMON: disabling tx recovery
SMON: disabling cache recovery
Mon Aug 16 23:39:41 2010
Shutting down archive processes
Archiving is disabled
Mon Aug 16 23:39:46 2010
ARCH shutting down
ARC2: Archival stopped
Mon Aug 16 23:39:51 2010
ARCH shutting down
ARC1: Archival stopped
Mon Aug 16 23:39:56 2010
ARCH shutting down
ARC0: Archival stopped
Mon Aug 16 23:39:57 2010
Thread 1 closed at log sequence 21
Successful close of redo thread 1
Mon Aug 16 23:39:57 2010
Completed: ALTER DATABASE CLOSE NORMAL
Mon Aug 16 23:39:57 2010
ALTER DATABASE DISMOUNT
Completed: ALTER DATABASE DISMOUNT
ARCH: Archival disabled due to shutdown: 1090
Shutting down archive processes
Archiving is disabled
Archive process shutdown avoided: 0 active
ARCH: Archival disabled due to shutdown: 1090
Shutting down archive processes
Archiving is disabled
Archive process shutdown avoided: 0 active
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.
Mon Aug 16 23:42:09 2010
Starting background process EMN0
Mon Aug 16 23:42:09 2010
Shutting down instance: further logons disabled
EMN0 started with pid=23, OS id=7928
Mon Aug 16 23:42:10 2010
Stopping background process QMNC
Mon Aug 16 23:42:10 2010
Stopping background process CJQ0
Mon Aug 16 23:42:12 2010
Stopping background process MMNL
Mon Aug 16 23:42:13 2010
Stopping background process MMON
Mon Aug 16 23:42:14 2010
Shutting down instance (immediate)
License high water mark = 2
Mon Aug 16 23:42:14 2010
Stopping Job queue slave processes
Mon Aug 16 23:42:19 2010
Process OS id : 7920 alive after kill
Errors in file /u01/oracle/admin/stone/udump/stone_ora_7908.trc
Mon Aug 16 23:42:19 2010
Job queue slave processes stopped
All dispatchers and shared servers shutdown
Mon Aug 16 23:42:21 2010
ALTER DATABASE CLOSE NORMAL
Mon Aug 16 23:42:21 2010
SMON: disabling tx recovery
SMON: disabling cache recovery
Mon Aug 16 23:42:21 2010
Shutting down archive processes
Archiving is disabled
Mon Aug 16 23:42:26 2010
ARCH shutting down
ARC2: Archival stopped
Mon Aug 16 23:42:31 2010
ARCH shutting down
ARC1: Archival stopped
Mon Aug 16 23:42:36 2010
ARCH shutting down
ARC0: Archival stopped
Mon Aug 16 23:42:37 2010
Thread 1 closed at log sequence 21
Successful close of redo thread 1
Mon Aug 16 23:42:37 2010
Completed: ALTER DATABASE CLOSE NORMAL
Mon Aug 16 23:42:37 2010
ALTER DATABASE DISMOUNT
Completed: ALTER DATABASE DISMOUNT
ARCH: Archival disabled due to shutdown: 1089
Shutting down archive processes
Archiving is disabled
Archive process shutdown avoided: 0 active
ARCH: Archival disabled due to shutdown: 1089
Shutting down archive processes
Archiving is disabled
Archive process shutdown avoided: 0 active
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:
-
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.
Mon Aug 16 23:35:13 2010
Starting background process EMN0
EMN0 started with pid=27, OS id=7815
Mon Aug 16 23:35:13 2010
Shutting down instance: further logons disabled
Mon Aug 16 23:35:13 2010
Stopping background process QMNC
Mon Aug 16 23:35:13 2010
Stopping background process CJQ0
Mon Aug 16 23:35:15 2010
Stopping background process MMNL
Mon Aug 16 23:35:16 2010
Stopping background process MMON
Mon Aug 16 23:35:17 2010
Shutting down instance (transactional)
##commit or rollback (insert into dept2 values(60,'support','BJ');)
Mon Aug 16 23:36:12 2010
All transactions complete. Performing immediate shutdown
License high water mark = 4
Mon Aug 16 23:36:12 2010
Stopping Job queue slave processes
Mon Aug 16 23:36:12 2010
Job queue slave processes stopped
All dispatchers and shared servers shutdown
Mon Aug 16 23:36:18 2010
PMON failed to acquire latch, see PMON dump
Mon Aug 16 23:36:18 2010
ALTER DATABASE CLOSE NORMAL
Mon Aug 16 23:36:18 2010
SMON: disabling tx recovery
SMON: disabling cache recovery
Mon Aug 16 23:36:18 2010
Shutting down archive processes
Archiving is disabled
Mon Aug 16 23:36:23 2010
ARCH shutting down
ARC2: Archival stopped
Mon Aug 16 23:36:28 2010
ARCH shutting down
ARC1: Archival stopped
Mon Aug 16 23:36:33 2010
ARCH shutting down
ARC0: Archival stopped
Mon Aug 16 23:36:34 2010
Thread 1 closed at log sequence 21
Successful close of redo thread 1
Mon Aug 16 23:36:34 2010
Completed: ALTER DATABASE CLOSE NORMAL
Mon Aug 16 23:36:34 2010
ALTER DATABASE DISMOUNT
Completed: ALTER DATABASE DISMOUNT
ARCH: Archival disabled due to shutdown: 1089
Shutting down archive processes
Archiving is disabled
Archive process shutdown avoided: 0 active
ARCH: Archival disabled due to shutdown: 1089
Shutting down archive processes
Archiving is disabled
Archive process shutdown avoided: 0 active
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.
Mon Aug 16 23:32:04 2010
Shutting down instance (abort)
License high water mark = 3
Instance terminated by USER, pid = 7664
Shutdown Timeout
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 command cancels with the following message: ORA-01013: user requested cancel of current operation
.