Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2880780
  • 博文数量: 599
  • 博客积分: 16398
  • 博客等级: 上将
  • 技术积分: 6875
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-30 12:04
个人简介

WINDOWS下的程序员出身,偶尔也写一些linux平台下小程序, 后转行数据库行业,专注于ORACLE和DB2的运维和优化。 同时也是ios移动开发者。欢迎志同道合的朋友一起研究技术。 数据库技术交流群:58308065,23618606

文章分类

全部博文(599)

文章存档

2014年(12)

2013年(56)

2012年(199)

2011年(105)

2010年(128)

2009年(99)

分类: Oracle

2013-01-29 11:48:34


PMON的一个关键功能就是在进程失败的时候清理死进程及其相关的资源。

我们来观看一下PMON清理死进程的过程,100246事件可以跟踪PMON的行为。



Event 10246 - Trace PMON Process
This event can be used to trace the actions of the PMON background process

This event can only be enabled in the init.ora file using

    event = "10246 trace name context forever, level 1"

The ALTER SYSTEM command does not appear to work for this event

There only appears to be one level for this event (levels 5 and 10 appear to generate the same output as level 1)




SQL> show parameter event

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
event                                string      10246 trace name context forever,level 1
xml_db_events                        string      enable




开启一个SESSION :

C:\Documents and Settings\htaix>sqlplus test/test@192.168.0.5/huateng

SQL*Plus: Release 10.2.0.1.0 - Production on 星期二 1月 29 11:14:31 2013

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> delete from x;

已删除12行。

SQL> select  sid,serial#,paddr from v$session where sid=userenv('sid');

       SID    SERIAL# PADDR
---------- ---------- --------
        39         10 2A83AC80

SQL> select spid from v$process where addr='2A83AC80';

SPID
------------------------
15428








然后在OS级别KILL掉相关的SERVER PROCESS:

SQL> !ps -ef | grep 15428
oracle   15428     1  0 01:03 ?        00:00:01 oraclehuateng (LOCAL=NO)
oracle   21234 13533  0 01:21 pts/0    00:00:00 /bin/bash -c ps -ef | grep 15428
oracle   21236 21234  0 01:21 pts/0    00:00:00 /bin/bash -c ps -ef | grep 15428

SQL> ! kill -9 15428


此时查询SESSION 会报ORA-03113错误:

SQL> select  sid,serial#,paddr from v$session where sid=userenv('sid');
select  sid,serial#,paddr from v$session where sid=userenv('sid')
*
第 1 行出现错误:
ORA-03113: 通信通道的文件结束



过一段时间后,将会在PMON TRACE文件中发现PMON清理死进程的过程:


*** 2013-01-25 01:22:21.372
marked process 0x2a83ac80 pid=31 serial=4 ospid = 15428 dead  <-- OS PID =15428 标记为死进程
  client details:
    O/S info: user: htaix, term: HT002, ospid: 9532:3440
    machine: WORKGROUP\HT002 program: sqlplus.exe
    application name: SQL*Plus, hash value=3669949024


*** 2013-01-25 01:22:21.401
deleting process 0x2a83ac80 pid=31 serial=4 priority=0 <-- 开始清理死进程
deleting session 0x2aac6f9c sid=39 serial=10           <--清理 SESSION
ksuprog() called at ktur.c:3039
ksuprog() called at ktur.c:3039
ksuprog() called at ktur.c:3039
ksuprog() called at ktur.c:3039
ksuprog() called at ktur.c:3039
ksuprog() called at ktur.c:3039
ksuprog() called at ktur.c:3039
ksuprog() called at ktur.c:3039
ksuprog() called at ktur.c:3039
ksuprog() called at ktur.c:3039
ksuprog() called at ktur.c:3039
ksuprog() called at ktur.c:3039
Audit postponed pending cleanup for session 0x2aac6f9c
deleting session 0x2aac6f9c sid=39 serial=11
Audit postponed pending cleanup for session 0x2aac6f9c
deletion of process 2a83ac80 pid=31 seq=4 prog=TRUE unsuccessful


*** 2013-01-25 01:22:21.447
found process 0x2a83ac80 pid=31 serial=4 ospid = 15428 dead


*** 2013-01-25 01:22:21.468
deleting process 0x2a83ac80 pid=31 serial=4 priority=0
deleting session 0x2aac6f9c sid=39 serial=12
deletion of process 2a83ac80 pid=31 seq=4 successful   <--成功清理完毕死进程
阅读(7050) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~