码迷,mamicode.com
首页 > 数据库 > 详细

关闭数据库

时间:2019-12-23 15:17:41      阅读:116      评论:0      收藏:0      [点我收藏+]

标签:actions   process   ssi   dia   dep   connected   ict   temp   automatic   

shutting down a database

共有四种模式的关机:

1.normal

2.immediate

3.abort

4.tranacatsion

一.shutting down with the normal mode

When you shut down a database with the normal mode, the database waits for all connected users to disconnect before shutting down. Normal mode is the default mode of shutdown.

shutdown normal

srvctl stop database -db db_unique_name -stopoption normal

1.No new connections are allowed after the statement is issued.

2.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 mode

When you shut down a database with the immediate mode, Oracle Database terminates any executing SQL statements and disconnects users. Active transactions are terminated and uncommitted changes are rolled back.

shutdown immediate

srvctl stop database -db db_unique_name -stopoption immediate

  • 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 mode

shutdown transactional

srvctl stop database -db db_unique_name -stopoption transactional

When you shut down a database with transactional mode, the database prevents users from starting new transactions, but waits for all current transactions to complete before shutting down. This mode can take a significant amount of time depending on the nature of the current transactions.

  • 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.

 

四.shutting down with the abort mode

You can shut down a database instantaneously by aborting the database instance.

  • 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 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 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.

 

 

ocp考题:

What is the outcome of the SHUTDOWN ABORT command?
A. Uncommitted transations are rolled back
B. Dirty buffers in the buffer cache and unwritten redo are not written to the data files and redo log files repectively
C. Instance recovery must be requested by the DBA at the next startup
D. Pending transactions are committed and the database is closed
答案:B   

 

   

关闭数据库

标签:actions   process   ssi   dia   dep   connected   ict   temp   automatic   

原文地址:https://www.cnblogs.com/liang-ning/p/12083623.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!