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

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

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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
### 使用 EMCA 配置 Oracle 网格控制 Enterprise Manager Configuration Assistant (EMCA) 是用于配置和管理 Enterprise Manager 的工具,它可以帮助用户轻松地启用或禁用网格控制功能。以下是关于如何使用 EMCA 来配置 Oracle 网格控制的相关信息。 #### 1. **EMCA 的基本功能** EMCA 可以用来配置以下内容: - 启动或重新配置 Grid Control。 - 配置数据库的远程管理和监控功能。 - 设置 HTTP 和 HTTPS 访问端口。 - 添加或删除受管目标(Managed Targets),例如数据库实例、监听器和其他组件[^2]。 #### 2. **启动 EMCA 并配置 Grid Control** 要通过命令行启动 EMCA 工具并配置 Grid Control,请按照以下说明操作: ```bash $ emca -config dbcontrol db ``` 这将引导您进入一个交互式的配置流程,在其中您可以输入所需的参数来完成配置。下面是该过程中涉及的主要步骤及相关参数解释: - `-config`:指定要执行的操作类型为“配置”。 - `dbcontrol`:表示正在配置的是 Database Control 组件。 - `db`:表明这是针对单个数据库实例的配置。 在实际运行,系统会提示提供如下细节信息: - 数据库 SID:唯一标识您的数据库实例。 - 监听器端口号:默认通常是 1521。 - 主机名:服务器所在的主机名称或者 IP 地址。 - DBConsole URL 前缀:通常保持默认值即可。 - SYS 用户密码:用于验证身份以便进行更深入的设置调整。 #### 3. **常见问题及解决方案** ##### A. **无法找到 EMCA 执行文件** 如果遇到找不到 `emca` 文件的情况,可能是因为环境变量 PATH 中未包含 `$ORACLE_HOME/bin` 路径。可以通过下面的方法解决这个问题: ```bash export ORACLE_HOME=/path/to/oracle/home export PATH=$PATH:$ORACLE_HOME/bin ``` ##### B. **权限不足导致失败** 当以普通用户身份尝试运行 EMCA 可能会因为缺乏必要权限而报错。此应切换到具有适当权限的账户再试一次,比如 oracle 用户: ```bash su - oracle ``` ##### C. **监听器服务不可达** 确保 TNS Listener 处于正常工作状态非常重要,因为它负责接收来自客户端的所有请求并将它们转发给对应的数据库进程。可以使用 netstat 或 lsnrctl status 命令检查当前状况,并根据需要重启 listener 服务: ```bash lsnrctl stop lsnrctl start ``` --- ### 示例脚本:重配现有数据库至新的 Grid 控制台地址 假设我们需要更改某个已有数据库所关联的企业级管理中心的位置,则可按如下方式进行修改: ```bash #!/bin/bash # Reconfigure existing database to new grid control location. emca -reconfig dbcontrol db \ -PORT_NUMBER <new_port> \ -HOST_NAME <new_host> ``` 这里 `<new_port>` 应替换为您希望使用的具体数值;同样地,把 `<new_host>` 替换成新定义的目标机器的名字或者是其公网可达IP地址[^2]。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值