背景
我们知道
2,pmon工作内容如下:
后经查询官方手册发现,PMON的工作内容如下:
1,监控后台进程运行状况
2,如果某些进程异常中断,PMON去释放会话资源以及占用的锁LOCK
3,更新事务表的标志以及清除事务XID的标记
4,清除异常中断会话在BUFFER CACHE占用的缓存
5,PMON也负责定期把数据库实例注册到监听器中
结论
1,10246 pmon event的命令:
alter system set events='10246 trace name context forever,level 1';--开启
alter system set events='10246 trace name context off';--关闭
2,可以从10246 PMON TRACE FILE发现PMON在清理中断会话占用的事务表及锁资源信息
3,当然比如像背景中,说其它几点没有看到,我估计是级别不够
4,level 12可以查盾清理占用的latch的情况
5,至于到底不同级别的区别,大家进行对比测试即可,不再复述
测试
1,数据库版本
SQL> select * from v$version where rownum=1;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
2,测试会话
SQL> select spid from v$process where addr=(select paddr from v$session where sid=(select sid from v$mystat where rownum=1));
SPID
------------------------------------------------
9534
SQL> update t_pmon set a=3,b=3;
--注意:运行一段时间
3,手工杀死测试会话对应的操作系统进程
[oracle@seconary ~]$ ps -ef|grep 9534
oracle 9534 1001 1 04:44 ? 00:00:03 oracleguowang (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle 10416 1311 0 04:47 pts/2 00:00:00 grep 9534
[oracle@seconary ~]$ kill -9 9534
4,10246跟踪的PMON TRACE FILE
*** 2015-11-02 04:51:02.339
marked process 0xdd5bc340 pid=30 serial=229 ospid = 9534 dead --标记9534进程死亡
client details:
O/S info: user: oracle, term: pts/4, ospid: 1001
machine: seconary program: sqlplus@seconary (TNS V1-V3)
application name: SQL*Plus, hash value=3669949024
*** 2015-11-02 04:51:02.427
deleting process 0xdd5bc340 pid=30 serial=229 priority=0 --清理对应的操作系统资源
deleting session 0xdc8b3f10 sid=271 serial=7089
*** 2015-11-02 04:51:04.040
deleting session 0xdcafb500 sid=70 serial=7394
*** 2015-11-02 04:51:05.664
ksuprog() called at ktur.c:3039 --调用ORACLE内核参数
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
*** 2015-11-02 04:51:06.898
CLEANUP_ROLLBACK_ENTRIES=100 rollback entries processed --清理测试会话占用的UNDO资源,即占用的回滚段资源
*** 2015-11-02 04:51:09.847
Audit postponed pending cleanup for session 0xdcafb500
deleting session 0xdcafb500 sid=70 serial=7395
Audit postponed pending cleanup for session 0xdcafb500
deletion of process dd5bc340 pid=30 seq=229 prog=TRUE unsuccessful
*** 2015-11-02 04:51:09.967
found process 0xdd5bc340 pid=30 serial=229 ospid = 9534 dead --9534进程死亡
*** 2015-11-02 04:51:10.016
deleting process 0xdd5bc340 pid=30 serial=229 priority=0
deleting session 0xdcafb500 sid=70 serial=7396
5,仍看不到好多PMON的工作内容,如:
4,清除异常中断会话在BUFFER CACHE占用的缓存
所以我们加大跟踪级别,看有无变化
SQL> alter system set events='10246 trace name context forever,level 12';
System altered.
SQL> alter system set events='10246 trace name context off';
System altered.
可以明看到清除锁及LATCH的资源占用
marked process 0xdd5be3c0 pid=32 serial=253 ospid = 20301 dead
client details:
O/S info: user: oracle, term: pts/4, ospid: 1001
machine: seconary program: sqlplus@seconary (TNS V1-V3)
application name: SQL*Plus, hash value=3669949024
*** 2015-11-02 05:21:43.591
cleaning latches proc=dd5be3c0 pid=32 seq=253 --清理LATCH
Latch Cleanup: kcbzch - op=0, lt=0xda2c5c78, b=0xb7fb0728, nb=0x1, bp=0xda6cd580
...complete
所以表明不同的级别跟踪PMON,产生的内容是不同的
至于到底不同级别的区别,大家进行对比测试即可,不再复述
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-1823317/,如需转载,请注明出处,否则将追究法律责任。