Oracle数据库shutdown immediate被hang住的几个原因

实验操作环境:

操作系统:Red Hat Enterprise Linux ES release 4 (Nahant Update 6)

数据库 : Oracle Database 10g Release 10.2.0.4.0 – Production  32bit

今晚使用shutdown immediate(其实是执行stop_oracle.sh脚本关闭数据库,如下所示)关闭数据库的时候,

   1: [[email protected] scripts]$ more stop_oracle.sh
   2: lsnrctl stop LISTENER
   3: sleep 15
   4: sqlplus /nolog <<EOF
   5: conn / as sysdba;
   6: alter system switch logfile;
   7: alter system checkpoint;
   8: shutdown immediate;
   9: exit
  10: EOF

在另外一个会话中使用tail  -20f  命令查看告警日志的输出,结果发现数据库等待了很长时间都没有正常关闭,hang住在下面地方:

Active call for process 11121 user ‘oracle‘ program ‘[email protected] (S000)‘

Active call for process 7162 user ‘oracle‘ program ‘[email protected] (S011)‘

截图如下

这时解决办法是找出hang住的进程并杀掉(当时操作没有截图,也没有保存输出信息),因为有些session无法被pmon进程清理,导致数据库无法顺利关闭,需要手工杀掉进程。首先使用ps 和grep找到这两个进程。

[ [email protected]  bdump]$ ps -ef | grep oracle | grep  S000

[ [email protected]  bdump]$ ps -ef | grep oracle | grep  S011

然后使用kill -9  processesid杀掉这两个进程即可,杀掉这两个进程后,从告警日志里面看到里面跳到关闭dispatcher 。如下所示:

1: [ [email protected]  bdump]$ tail  alert_epps.log
   2:   Current log# 3 seq# 242223 mem# 1: /u02/oradata/epps/redo03_01.log
   3: Sun Jan 5 05:14:50 2014
   4: Starting control autobackup
   5: Control autobackup written to DISK device
   6:         handle ‘/u01/app/oracle/product/10.2.0/db_1/dbs/c-2179993557-20140105-0e‘
   7: Sun Jan 5 05:14:54 2014
   8: ALTER SYSTEM ARCHIVE LOG
   9: Sun Jan 5 05:14:55 2014
  10: Thread 1 cannot allocate new log, sequence 242224
  11: Checkpoint not complete
  12:   Current log# 3 seq# 242223 mem# 0: /u01/app/oracle/oradata/epps/redo03_1.log
  13:   Current log# 3 seq# 242223 mem# 1: /u02/oradata/epps/redo03_01.log
  14: Sun Jan 5 05:14:58 2014
  15: Thread 1 advanced to log sequence 242224 (LGWR switch)
  16:   Current log# 5 seq# 242224 mem# 0: /u01/app/oracle/oradata/epps/redo05_1.log
  17:   Current log# 5 seq# 242224 mem# 1: /u02/oradata/epps/redo05_02.log
  18: Sun Jan 5 07:31:56 2014
  19: Thread 1 advanced to log sequence 242225 (LGWR switch)
  20:   Current log# 2 seq# 242225 mem# 0: /u01/app/oracle/oradata/epps/redo02_1.log
  21:   Current log# 2 seq# 242225 mem# 1: /u02/oradata/epps/redo02_02.log
  22: Sun Jan 5 07:32:20 2014
  23: Starting background process EMN0
  24: Shutting down instance: further logons disabled
  25: EMN0 started with pid=43, OS id=7062
  26: Sun Jan 5 07:32:21 2014
  27: Stopping background process CJQ0
  28: Sun Jan 5 07:32:21 2014
  29: Stopping background process QMNC
  30: Sun Jan 5 07:32:23 2014
  31: Stopping background process MMNL
  32: Sun Jan 5 07:32:34 2014
  33: Background process MMNL not dead after 10 seconds
  34: Sun Jan 5 07:32:34 2014
  35: Killing background process MMNL
  36: Sun Jan 5 07:32:35 2014
  37: Stopping background process MMON
  38: Sun Jan 5 07:33:05 2014
  39: Background process MMON not dead after 30 seconds
  40: Sun Jan 5 07:33:05 2014
  41: Killing background process MMON
  42: Sun Jan 5 07:33:06 2014
  43: Shutting down instance (immediate)
  44: License high water mark = 561
  45: Sun Jan 5 07:33:06 2014
  46: Stopping Job queue slave processes, flags = 7
  47: Sun Jan 5 07:33:06 2014
  48: Process OS id : 6088 alive after kill
  49: Errors in file /u01/app/oracle/admin/epps/udump/epps_ora_7055.trc
  50: Sun Jan 5 07:33:09 2014
  51: Waiting for Job queue slaves to complete
  52: Sun Jan 5 07:33:09 2014
  53: Job queue slave processes stopped
  54: Sun Jan 5 07:38:10 2014
  55: Active call for process 11121 user ‘oracle‘ program ‘[email protected] (S000)‘
  56: Active call for process 7162 user ‘oracle‘ program ‘[email protected] (S011)‘
  57: SHUTDOWN: waiting for active calls to complete.
  58: Sun Jan 5 07:57:28 2014
  59: Waiting for dispatcher ‘D000‘ to shutdown
  60: Waiting for dispatcher ‘D001‘ to shutdown
  61: Waiting for dispatcher ‘D002‘ to shutdown
  62: Waiting for dispatcher ‘D003‘ to shutdown
  63: Waiting for dispatcher ‘D004‘ to shutdown
  64: Waiting for dispatcher ‘D005‘ to shutdown
  65: Waiting for dispatcher ‘D006‘ to shutdown
  66: Sun Jan 5 07:59:29 2014
  67: All dispatchers and shared servers shutdown
  68: Sun Jan 5 08:04:30 2014
  69: SHUTDOWN: Active processes prevent shutdown operation
  70: Sun Jan 5 08:09:32 2014
  71: SHUTDOWN: Active processes prevent shutdown operation

Oracle的官方文档介绍、解释如下

The database is waiting for pmon to clean up processes, but pmon is unable to

clean them. The client connections to the server are causing the shutdown

immediate or normal to hang. Killing them allows pmon to clean up and release

the associated Oracle processes and resources.

What resources are we talking about?

1) Any non committed transactions must be rolled back

2) Any temporary space (sort segments / lobs / session temporary tables) must be freed

3) The session itself and any associated memory consumed by the session.

4) Internal locks / enqueues must be cleaned up

Often Oracle (SMON or PMON depending on whether Shared Server is used) will wait for the OS to terminate the process(es) associated with the session. If the OS never returns, or fails to terminate them, then the instance shutdown will hang with this message (Shutdown Waiting for Active Calls to Complete)

Other means exist to achieve a quick shutdown, as outlined inNote 386408.1- What Is The Fastest Way To Cleanly Shutdown An Oracle Database?

结果解决上面问题后,本以为可以顺利关闭数据库,结果又hang住了,告警日志信息提示为

SHUTDOWN: Active processes prevent shutdown operation

出现这个错误原因:

因为我大概如下的操作导致:

[[email protected] scripts]$ sqlplus / as sysdba

...........

SQL> !

[[email protected] ~]$

..... (执行了一些shell 命令)

然后又使用了sqlplus启动登录了数据库,然后做shutdown immediate操作,这时导致shutdown immediate被hang住。

[[email protected] scripts]$ sqlplus / as sysdba

解决办法:退出当前的会话,回到原始会话,并重新连接,就可以正常的关闭数据库了

参考资料:

http://oracle.chinaitlab.com/optimize/761636_2.html

http://blog.csdn.net/xionglang7/article/details/8997081

http://blog.csdn.net/leshami/article/details/9466559

 
时间: 2024-10-15 02:54:37

Oracle数据库shutdown immediate被hang住的几个原因的相关文章

Oracle 关闭(shutdown immediate)时hang住

昨天晚上生产的两套10.2.0.4的数据库修改了参数,需要重启.在发出shutdown immediate命令后等了大概10分钟的时间,数据库还没有down下来.检查后台alert日志,发现从开始shutdown到最后只输出几条日志,其中最后一条日志是:SHUTDOWN: Active processes prevent shutdown operation. 图为在虚拟机上还原场景时的截图. 开一个新的会话连接显示已连接,但无法查视图,又提示未连接.再次执行shutdown immediate

Oracle数据库的经典问题 snapshot too old是什么原因引起的

Oracle数据库的经典问题 snapshot too old是什么原因引起的 ORACLE经典错误求解:ORA-1555错误(Snapshot too old ) - ... 书上说是因为the rollback image need for read consistency has prbably been overwriteten by an active transaction. 我就奇怪了,如果一个transaction占用了一些回滚段,直到它commit前,这些回滚段空间应该被锁定了

shutdown immediate时 hang住 (转载)

shutdown immediate 经常关库时hang住,在alert中有 License high water mark = 4All dispatchers and shared servers shutdown 多等一会会出现SHUTDOWN: Active processes prevent shutdown operation 造成这个现象的原因是(也可能是em的原因,这篇与em无关): 之前的session没有断开,而后又使用了host切换到OS提示符下,导致数据库无法正常关闭 [

Oracle数据库修改密码思路

如果你想修改自己的邮箱密码,不用想太多,改了就好,只要改的密码自己要记得.可是数据库密码就不一样了,数据库必然会有与之相对应的应用或者其他使用人员.如果贸然修改必然会引起其他人员或者用户的问题. 因此,在修密码之前必须先确定这次修改能不会导致令人难以接受的问题,比如应用长时间无法连接服务,其他人员使用老的密码无法连接数据库. 考虑缓存机制服务的情况,为了尽量减少服务中断的时间,这是看起来最好的方案: 1.修改配置文件. 由于是缓存机制服务,改过配置文件并不对现在运行的服务产生影响,因此选一个时间

ORACLE 11g 由新特性引发lsnrctl hang住卡死迷雾的详细剖析历程

1.问题描述 同事说卡住了,连接oracle数据库很慢,需要很久,连上了做一个简单的查询也非常慢,感觉像是hang主了一般. 2.分析oracle服务器负载 一开始登录进去,查看oracle服务器,负载很低,服务器毫无压力,感觉不是服务器卡的问题了: [[email protected] data]# w 19:59:47 up 122 days,  4:32,  4 users,  load average: 0.65, 0.71, 0.59 USER     TTY      FROM   

记一次数据库无法增删改趋于HANG住状态的故障诊断和处理

数据库无法增删改,包括v$transaction视图无法查询,类似于HANG的状态,我首先我通过查询v$session_wait视图,情况如下: SQL> select sid,event,p1,p2,p3,wait_time,seconds_in_wait,state from v$session_wait where wait_class <> 'Idle'; SID EVENT                                             P1      

NDMCDB数据库hang住故障分析 - cursor: pin S wait on X

问题描述: 上午刚刚到办公室,就有监控人员邮件反馈,昨晚NDMCDB407数据库被重启过,让我分析一下数据库重启的原因.由于昨晚业务有版本上线,所以短信警告关闭了,所以没有短信下发到我手机上,而且故障时相关人员也没有通知到我. 1     检查alert日志 从alert日志中,可以看到,先是在03:29时有一个job运行失败了: Fri Aug 22 03:29:29 2014 Errors in file/opt/oracle/diag/rdbms/ndmcdb/NDMCDB/trace/N

查看Oracle数据库被锁住的表,删除锁表的进程

锁表处理及查询 查看Oracle数据库被锁住的表,删除锁表的进程 1.查看被锁住的表 SELECT dob.object_name table_name,    lo.locked_mode, lo.session_id, vss.serial#, vss.action action, vss.osuser osuser, vss.logon_time, vss.process ap_pid, vps.spid db_pid FROM v$locked_object lo, dba_object

AIX上 断开的NFS 挂载点 导致 Oracle instance hang 住

翻译自mos文章:Disconnected NFS Mount Point Causes Instance to Hang on AIX (文档 ID 1445600.1) 适用于: Oracle Server - Enterprise Edition - Version: 10.2.0.1 and later   [Release: 10.2 and later ] IBM AIX on POWER Systems (64-bit) IBM AIX on POWER Systems (32-b