您的位置:首页 > 数据库

关闭数据库遇到SHUTDOWN: Active processes prevent shutdown operation

2015-12-13 19:39 741 查看
近期遇到一客户数据库关闭时遇到无法关闭的情况。

经检查是关闭前使用了sqlplus窗口直接使用host命名回到SHELL操作界面,然后又sqlplus / as sysdba登陆了数据库(具体切换了三、四次);

在之后的发出关闭命令shutdown immediate;后,命令一直HANG住;此时查看ALERT日志,有“SHUTDOWN: Active processes prevent shutdown operation”提示;

一开始以为是有活动会话没有关闭,查询ps -ef|grep LOCAL  和ps -ef|grep ora_j的进程,均无相应进程;也未配置EM--DB CONSOLE之类。

刚开始以为是遇到有活动会话导致的,数据库版本是AIX6.1+11.2.0.1单实例;

因此根据以往经验会提示出哪个进程导致SHUTDOWN无法完成,根据提示进程号进行KILL进程,就会正常关闭。

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

==》根据观察,在ORACLE10G及以上版本,会是如下提示:

Active call for process 12345 user 'oracle' program 'oracle@abcd'

SHUTDOWN: waiting for active calls to complete.

也就是指出哪个进程引起的等待,此时kill -9 12345 进程即可。

==》但是在ORACLE 8I版本中,是不会提示哪个进程ACTIVE引起关闭进程HANG的。

在等待的过程中,耽误了10多分钟。后根据alert提示查询,结合之前工程师的操作;

问题可能是sqlplus时host到os下操作,后又sqlplus / as sysdba登陆,如此反复多次。

-------因为在发出shutdown immediate;的命令行窗口命令仍在执行状态,事实上此时可以使用CTRL+C来取消关闭命令。

本次就使用了CTRL+C来取消关闭命令,后一路exit退出,并重新使用TELNET登陆进行关闭操作,正常完成。

############
这里也是一个重要提醒,在发出shutdown immediate;的命令行窗口,最好新建的会话来执行,避免此类问题。

关库前最好将ps -ef|grep LOCAL  和ps -ef|grep ora_j的进程,是否有大事务在进行及大事务回滚在进行等问题进行确认;

确认之后切换日志、执行检查点,再关闭数据库,此时关库风险会小很多,即使遇到无法关闭去KILL进程,也相应更安全。

#################################故障时

1.无法关闭时的alert日志
Sun Dec 13 00:25:15 2015
Shutting down instance (immediate)
Stopping background process SMCO
Shutting down instance: further logons disabled
Sun Dec 13 00:25:17 2015
Stopping background process CJQ0
Stopping background process QMNC
Stopping background process MMNL
Stopping background process MMON
License high water mark = 78
Stopping Job queue slave processes, flags = 7
Job queue slave processes stopped
All dispatchers and shared servers shutdown
Sun Dec 13 00:30:21 2015
SHUTDOWN: Active processes prevent shutdown operation
Sun Dec 13 00:35:23 2015
SHUTDOWN: Active processes prevent shutdown operation
Sun Dec 13 00:40:24 2015
SHUTDOWN: Active processes prevent shutdown operation
Sun Dec 13 00:45:25 2015
SHUTDOWN: Active processes prevent shutdown operation
Sun Dec 13 00:48:31 2015

Instance shutdown cancelled


2.此类问题的解决方法:

参考文档:

Shutdown Immediate Hangs / Active Processes Prevent Shutdown (文档 ID 416658.1)

Alert Log: Shutdown Waiting for Active Calls to Complete (文档 ID 1039389.6)

What Is The Fastest Way To Cleanly Shutdown An Oracle Database? (文档 ID 386408.1)

以下解决方案来自文档 ID 416658.1:

1. Given OEM connections are active (SYSMAN and DBSNMP), de-activate these sessions, i.e. by stopping the agent/DBConsole
2. Then shutdown immediate as normal
- OR -
There may be processes still running and holding locks at the time a shutdown is issued.
Sometimes these are failed jobs or transactions, which are effectively 'zombies', which are not able to receive a signal from Oracle.
If this occurs, the only way to shutdown the database is by doing:
sql>
shutdown abort
startup restrict
shutdown normal

The startup does any necessary recovery and cleanup, so that a valid cold backup can be taken afterward.
If this issue occurs frequently, it would be a good practice to see if there are any active user processes running in v$session or v$process before shutting down the instance.
If the problem persists, and no apparent user processes are active, you can set this event prior to issuing the shutdown command in order to see what is happening. This will dump a systemstate every 5 minutes while shutdown is hanging
SQL>
connect / as sysdba
alter session set events '10400 trace name context forever, level 1';
Then issue the shutdown command.

3. You can kill the sessions preventing shutdown. Refer: Alert Log: Shutdown Waiting for Active Calls to Complete (Doc ID 1039389.6)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: