oracle hang分析测试
javascript
使用hang分析大部分原因在于产生锁资源的争用
1-2:只有hanganalyze输出,不dump任何进程
3:Level2+Dump出在IN_HANG状态的进程
4:Level3+Dump出在等待链里面的blockers(状态为LLEAF/LEAF_NW/IGN_DMP)
5:Level4+Dump出所有在等待链中的进程(状态为NLEAF);
1.创建测试数据
javascript
create table test as select * from dba_objects;
2.更新表中一条数据但是不提交
javascript
update test set object_id=1 where rownum=1;
3.在开启两个会话并重复执行发现会hang住
javascript
SQL> update test set object_id=1 where rownum=1;
SQL> update test set object_id=1 where rownum=1;
4.开启第四个会话使用 sqlplus -prelim / as sysdba进行登录
javascript
<zhang2:orcldb:/home/oracle>$sqlplus -prelim / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Mon Apr 8 10:45:11 2024
Version 19.21.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
SQL>
5.登录后启动执行oradebug hanganalyze 3
javascript
SQL> oradebug setmypid;
Statement processed.
SQL> oradebug unlimit
Statement processed.
SQL> oradebug hanganalyze 3;
Statement processed.
SQL> oradebug dump systemstate 10;--执行后alert会显示trc路径
Statement processed.
SQL> oradebug tracefile_name --显示日志位置
/u01/app/oracle/diag/rdbms/orcldb/orcldb/trace/orcldb_ora_22062.trc
SQL>oradebug close_trace --使用后关闭
6.在trc 找相关的有用信息进行相关会话的处理
