EMCA重建OEM时导致DB停顿在quiescing状态

本文记录了一次使用EMCA重建OEM导致生产数据库进入静默状态的问题。介绍了数据库处于quiescing状态的原因及解决方法,包括如何查找并处理阻止数据库进入静默状态的活跃会话。

Created on 04.02.2011
环境:
Oracle版本:
Oracle 10g Release 2  10.2.0.5
OS版本:
Windows Server 2003 Enterprise
摘要:
用EMCA重建OEM时,导致数据库挂起,DB一直处于quiescing状态,除了使用sys和system新的连接无法建立

在生产数据库上重建EM还是具有危险性的,这一点以前没有意识到,因为每一次都很顺利,但这一次真实遇到问题。

用EMCA重建repository之前,实际上每次都会警告,在repository被删除的时候数据库会被置于静默状态。
———————————————————————-
WARNING : While repository is dropped the database will be put in quiesce mode.
———————————————————————-
Do you wish to continue? [yes(Y)/no(N)]: Y

但是从来没有把这个警告当回事。

输入所有的参数之后,repository开始重建,但是一直停顿在下面的提示信息,等待很久后还是如此。
Apr 2, 2011 1:52:04 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at C:\oracle\ora102\cfgtoollogs\emca\OPCON2\emca_2011-04-02_01-46-14-PM.log.
Apr 2, 2011 1:52:15 PM oracle.sysman.emcp.util.DBControlUtil stopOMS
INFO: Stopping Database Control (this may take a while) …
Apr 2, 2011 1:52:18 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) …
Apr 2, 2011 1:52:18 PM oracle.sysman.emcp.EMReposConfig dropRepository
INFO: Dropping the EM repository (this may take a while) …

这个时候如果查询v$instance,会发现db一直处于quiescing状态
SQL> select status,active_state from v$instance;

STATUS       ACTIVE_ST
———— ———
OPEN         quiescing

当数据库处于静默状态时,只有SYS和SYSTEM用户能够在数据库中进行操作,以完成某些不希望被打扰的操作。
SQL> alter system quiesce restricted;
使用上面的SQL进入静默状态时,数据库会等待所有非DBA用户session结束,并不允许非DBA用户建立新的session,在这个过程中,v$instance会一直显示quiescing,在进入静默状态后会显示quiesced。
SQL> alter system unquiesce;
上面的语句离开静默状态。

在我的这个例子中,一直处于quiescing说明有活动的session在阻止DB进入静默状态。

Metalink文档152819.1提供了一个SQL用来查询是那个session阻止了DB进入静默状态。
具体内容如下:

Apparent Hang After Issuing ‘ALTER SYSTEM QUIESCE RESTRICTED’ [ID 152819.1]
Modified 22-OCT-2010     Type PROBLEM     Status PUBLISHED

Problem Description
===================

As a DBA user, you issue the following command to put all running instances
into quiesced state:

SQL> alter system quiesce restricted;

It appears to hang and does not return to the prompt.

Solution Description
====================

Find sessions that have open transactions and take appropriate action, either
by killing these session(s) or asking the owner to end the ongoing transactions
by either committing or rolling back.

You may use this query to find open transactions:

select p.spid, s.osuser, s.machine, s.username, s.sid, s.serial#
from v$session s, v$process p
where p.addr = s.paddr
and s.sid in (select sid from v$lock where type = ‘TX’);

Explanation
===========

The ALTER SYSTEM QUIESCE RESTRICTED command puts all running instances into
quiesced state. At the time an ALTER SYSTEM QUIESCE RESTRICTED command is
issued, there might be active non-DBA sessions in the system, such as inside
a transaction or a query. These sessions can proceed until they become inactive
(the transaction or the query completes). Only after all these sessions become
inactive does the ALTER SYSTEM QUIESCE RESTRICTED command return. Active
transactions as SYS or SYSTEM do not block the database going into a quiesce mode.

The wait event for the session is ‘wait for possible quiesce finish’.

References
==========

Note:102925.1  Tracing sessions: waiting on an enqueue

Posted in Oracle管理 by admin at April 2nd, 2011.
Tags: emca, oem, Oracle, quiesced mode
Oracle Enterprise Manager Configuration Assistant (EMCA) 是 Oracle 数据库安装后用于配置和管理 Oracle Enterprise Manager Database Control 的命令行工具。EMCA 通常在 Oracle 数据库软件安装目录下的 `bin` 子目录中。 ### Oracle Enterprise Manager Configuration Assistant (EMCA) 的位置 EMCA 工具位于 Oracle 安装目录的 `bin` 子目录下,具体路径为: ```shell $ORACLE_HOME/bin/emca ``` 其中,`$ORACLE_HOME` 是 Oracle 数据库软件的安装根目录。例如,在 Linux 或 Unix 系统中,路径可能为: ```shell /u01/app/oracle/product/11.2.0/db_1/bin/emca ``` 在 Windows 系统中,路径可能为: ```shell C:\app\oracle\product\11.2.0\dbhome_1\bin\emca ``` 可以通过设置环境变量 `ORACLE_HOME` 并将其添加到系统 `PATH` 中,以便在任意目录下运行 `emca` 命令[^3]。 ### 如何找到 EMCA 工具 若不确定 `emca` 命令是否可用,可以通过以下方式查找: - 在 Linux/Unix 系统中使用 `which` 命令: ```shell which emca ``` - 在 Linux/Unix 系统中使用 `find` 命令搜索: ```shell find / -name emca -type f 2>/dev/null ``` - 在 Windows 系统中,可以在 Oracle 安装目录的 `bin` 文件夹中查找 `emca.bat` 文件。 此外,确保 `ORACLE_HOME` 环境变量已正确设置,并且 `ORACLE_SID` 已配置为目标数据库的实例标识符,以便 `emca` 命令正常运行[^3]。 ### 示例:运行 EMCA 配置 Database Control 以下是一个典型的 EMCA 命令,用于配置数据库控制: ```shell emca -config dbcontrol db ``` 执行该命令,系统将提示输入数据库 SID、监听端口、管理员账户(如 SYS)密码等信息。配置完成后,Oracle Enterprise Manager 控制台及相关服务(如 OracleRemExecService)将被重新部署[^1]。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值