Ivo落班

记录着自己非专业的起步

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
oracle的状态拥有三种比较特殊的模式,分别是restricted(受限),quiesce(静默),suspend(挂起)
 
限制情况
restricted:
  a.只有拥有restricted session权限的用户可以建立新的连接,即禁止普通用户连接
  b.不拒绝已登录的其他用户的操作
  c.单节点和rac中,由oracle restart管理的所有数据库服务处于offline状态,连接到这些服务的会话都被终止
原文如下:
In a single-instance environment with Oracle Restart, any database services that are being managed by Oracle Restart go offline, and any sessions connected to those services are killed (terminated). 
The standard database service for the instance, named DB_UNIQUE_NAME.DB_DOMAIN, does not go offline because it is not managed by Oracle Restart.
 
quiesce:
  a.只允许DBA用户的事务,查询执行
  b.该状态会阻止所有的非dba事务,此类事务在数据库恢复正常状态后继续执行。
  
suspend:该状态下,所有的io操作将会挂起
   
启用方式:
restricted: alter system [enable/disable] restricted session;
quiesce: alter system quiesce restricted; alter system unquiesce
suspend:alter system suspend; alter system resume;
 
使用场景:
restrict: 通常在要执行一些管理性的操作,而这些操作运行的时候不能有其他用户同时访问数据库时,启用restrict模式。
 
quiesce: 该状态重在让dba执行一些平时不能被执行的操作:
  a.在其他并行用户使用同一个对象时,对该对象进行的操作(如ddl操作等)
  b.一些可能会影响并行用户事务的不良中间效应的操作(如多步骤的procedure等)
The quiesced state lets administrators perform actions that cannot safely be done otherwise. These actions include:

•Actions that fail if concurrent user transactions access the same object
--for example, changing the schema of a database table or adding a column to an existing table where a no-wait lock is required.

•Actions whose undesirable intermediate effect can be seen by concurrent user transactions
--for example, a multistep procedure for reorganizing a table when the table is first exported, then dropped, and finally imported.
A concurrent user who attempts to access the table after it was dropped, but before import, would not have an accurate view of the situation.

suspend:

  在有需求将磁盘文件与写进程暂时分开时使用,一般用来备份物理文件
The suspend/resume feature is useful in systems that allow you to mirror a disk or file and then split the mirror, providing an alternative backup and restore solution. 
If you use a system that cannot split a mirrored disk from an existing database while writes are occurring, then you can use the suspend/resume feature to facilitate the split.

  不建议使用该方法进行热备份,休闲考虑alter tablespace begin backup

 

相关视图:
restrict: logins(v$instance)
SQL> alter system enable restricted session;
 
System altered

SQL> select logins from v$instance;
 
LOGINS
----------
RESTRICTED
 
SQL> alter system disable restricted session;
 
System altered
 
SQL> select logins from v$instance;
 
LOGINS
----------
ALLOWED

quiesce: active_state(v$instance)

SQL> alter system quiesce restricted;
 
System altered

SQL> select active_state from v$instance;
 
ACTIVE_STATE
------------
QUIESCED
  • NORMAL: Normal unquiesced state.

  • QUIESCING: Being quiesced, but some non-DBA sessions are still active.

  • QUIESCED: Quiesced; no non-DBA sessions are active or allowed.

v$blocking_quiesce:存放妨碍quiesce的session id(妨碍原因:active状态下的会话需要转换成inactive下,这需要一定的时间)

suspend: database_status(v$instance)

SQL> alter system suspend;
 
System altered

SQL> select database_status from v$instance;
 
DATABASE_STATUS
-----------------
SUSPENDED


------------------------------------

总结:其实从三者在v$instance中记录的列名中可以看出,三者的主要作用。

   logins(restricted)主要负责登录的限制

   active_state(quiesce) 数据库的活动状态

   database_status(suspend) 物理文件与服务进程的状态

参考:

http://docs.oracle.com/cd/E11882_01/server.112/e25494/start005.htm

http://blog.chinaunix.net/uid-23622436-id-3279095.html

 
 
 

 

 

posted on 2013-07-07 11:38  Ivo落班  阅读(664)  评论(0编辑  收藏  举报