数据库处于静默模式ALTER SYSTEM QUIESCE

11gr1 手工建立EM的试验,因为数据库处于静默方式,不知道是我emca –repos drop命令还是哪个应用发出的相应命令,执行删除档案库就一直挂着,也无法登陆,查询了v$session ,146条记录,杀掉相应进程也不行,发出命令去除静默方式,也出现错误:

Alter system unquiesce;

出现错误:25502 说相应的并发Alter system quiesce /unquiesce正在进行中。。。

 

相应静默命令是Alter system quiesce restrict;  难怪无法登陆。

 

官方文档信息为:

You can put the system into quiesced state. The system is in quiesced state if there are no active sessions, other than SYS and SYSTEM. An active session is defined as a session that is currently inside a transaction, a query, a fetch or a PL/SQL procedure, or a session that is currently holding any shared resources (for example, enqueues--enqueues are shared memory structures that serialize access to database resources and are associated with a session or transaction). Database administrators are the only users who can proceed when the system is in quiesced state.

Database administrators can perform. certain actions in the quiesced state that cannot be safely done when the system is not quiesced. These actions include:

Actions that might fail if there are concurrent user transactions or queries. For example, changing the schema of a database table will fail if a concurrent transaction is accessing the same table.

Actions whose intermediate effect could be detrimental to concurrent user transactions or queries. For example, suppose there is a big table T and a PL/SQL package that operates on it. You can split table T into two tables T1 and T2, and change the PL/SQL package to make it refer to the new tables T1 and T2, instead of the old table T.

When the database is in quiesced state, you can do the following:

CREATE TABLE T1 AS SELECT ... FROM T;

CREATE TABLE T2 AS SELECT ... FROM T;

DROP TABLE T;

You can then drop the old PL/SQL package and re-create it.

For systems that must operate continuously, the ability to perform. such actions without shutting down the database is critical.

The Database Resource Manager blocks all actions that were initiated by a user other than SYS or SYSTEM while the system is quiesced. Such actions are allowed to proceed when the system goes back to normal (unquiesced) state. Users do not get any additional error messages from the quiesced state.

 

其意义如下:

你可以将系统设置为静默方式。系统处于静默方式,将无任何活动session,除了SYS and SYSTEM 之外。一个活动的session是指当前处于一个事务、查询、一个fetch语句或者一个PL/SQL过程内部的session,或者是指一个当前拥有任何共享资源(例如:队列队列是共享内存结构,以保证对与session或者事务相关的数据库资源的串行访问)。数据库管理员是当系统处于静默状态时,唯一能进行操作的用户。

在静默模式下,数据库管理员可以执行一些在非静默模式下不能安全执行的特定的动作。这些动作包括:

有并发用户事务或者查询可能会失败的操作。例如:如果改变表的模式将会失败,如果有访问该表的并发事务存在的话。

其中间结果将不利于并发用户事务或者查询的动作。例如:假定有一个大表T和一个在其上操作的PL/SQL包 。你可以将表T分割为2个表T1  T2,并更改PL/SQL包,让其引用新的T1  T2,代替访问旧表T

当数据库处于静默状态,你可以执行下列语句:

CREATE TABLE T1 AS SELECT ... FROM T;

CREATE TABLE T2 AS SELECT ... FROM T;

DROP TABLE T;

然后你摘除旧的PL/SQL包,再重新创建它。

对于必须连续操作不间断的那些系统,执行这种操作而不必关闭数据库的这个能力将是非常重要和可贵的。

当数据库处于静默模式时,数据库资源管理器将阻塞由非SYS or SYSTEM用户发起的所有动作。当系统返回到正常模式(非静默模式)的时候,这些操作才被允许执行。用户不能从静默模式得到任何额外的错误信息。

 

How a Database Is Quiesced

The database administrator uses the ALTER SYSTEM QUIESCE RESTRICTED statement to quiesce the database. Only users SYS and SYSTEM can issue the ALTER SYSTEM QUIESCE RESTRICTED statement. For all instances with the database open, issuing this statement has the following effect:

Oracle Database instructs the Database Resource Manager in all instances to prevent all inactive sessions (other than SYS and SYSTEM) from becoming active. No user other than SYS and SYSTEM can start a new transaction, a new query, a new fetch, or a new PL/SQL operation.

Oracle Database waits for all existing transactions in all instances that were initiated by a user other than SYS or SYSTEM to finish (either commit or terminate). Oracle Database also waits for all running queries, fetches, and PL/SQL procedures in all instances that were initiated by users other than SYS or SYSTEM and that are not inside transactions to finish. If a query is carried out by multiple successive OCI fetches, Oracle Database does not wait for all fetches to finish. It waits for the current fetch to finish and then blocks the next fetch. Oracle Database also waits for all sessions (other than those of SYS or SYSTEM) that hold any shared resources (such as enqueues) to release those resources. After all these operations finish, Oracle Database places the database into quiesced state and finishes executing the QUIESCE RESTRICTED statement.

If an instance is running in shared server mode, Oracle Database instructs the Database Resource Manager to block logins (other than SYS or SYSTEM) on that instance. If an instance is running in non-shared-server mode, Oracle Database does not impose any restrictions on user logins in that instance.

During the quiesced state, you cannot change the Resource Manager plan in any instance.

The ALTER SYSTEM UNQUIESCE statement puts all running instances back into normal mode, so that all blocked actions can proceed. An administrator can determine which sessions are blocking a quiesce from completing by querying the v$blocking_quiesce view.

See Also:

Oracle Database SQL Language Reference

Oracle Database Administrator's Guide

其意义如下:

数据库怎样静默

数据库管理员使用ALTER SYSTEM QUIESCE RESTRICTED语句来静默一个数据库。只有SYS and SYSTEM用户可以发出该命令。对于所有打开数据库的实例,发出该命令有如下影响:

Oracle数据库在所有实例上会创建数据库资源管理器,来阻止所有非活动的session (不是SYS and SYSTEM发出的)变为活动。除SYS and SYSTEM外,其他任何用户都不能启动一个新的事务,新的查询、新的fetch,新的 PL/SQL操作。

Oracle 数据库等待实例中所有的事务完成,这些事务是由SYS or SYSTEM以外的用户启动的(或者commit 或者终止). Oracle 数据库也等待实例中所有运行的查询、fetchesPL/SQL 过程完成,这些操作也是由SYS or SYSTEM以外的用户启动、并且当前不在事务内部。如果一个查询是由多个成功的OCI fetches来执行,Oracle数据库将不等待所有的fetches 结束。它等待当前的fetch完成,然后阻塞下一个fetchOracle数据库也等待所有持有任何共享资源(例如队列)的进程(除SYS or SYSTEM外)释放这些资源。当所有操作完成后,Oracle数据库将数据库置为静默模式,完成QUIESCE RESTRICTED语句的执行。

如果实例正运行在共享服务器模式,Oracle数据库创建资源管理器以阻塞( SYS or SYSTEM以外的用户) 登陆系统。如果实例运行在非共享服务器模式,Oracle数据库对于用户的登陆不施加任何限制。

在静默模式下,你不能在任何实例上更改资源管理器的计划。

ALTER SYSTEM UNQUIESCE 语句,可以将所有运行的实例置回正常模式, 所以所有被阻塞的动作都能进行。管理员可以查询v$blocking_quiesce视图,确定哪些sessions 被阻塞。

我的试验被阻止,我发出ALTER SYSTEM UNQUIESCE语句,返回ORA-25502错误 说一个并发的ALTER SYSTEM QUIESCE /UNQUIESCE正在进行中,看样子是数据库还在设置静默的过程中.....

 

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7177735/viewspace-722411/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/7177735/viewspace-722411/

你可能感兴趣的:(数据库处于静默模式ALTER SYSTEM QUIESCE)