oracle hang analyze,hanganalyze 分析数据库挂起
0 概覽
hanganaylze主要步驟:
oradebugsetmypid
oradebugunlimit
--RAC環境
oradebugsetinstall
--級別一般指定為3足夠了
oradebughanganalyze3
--RAC環境
oradebug-g defdump systemstate10
oradebugtracefile_name
解讀 hanganalyze 報告
State of ALL nodes
([nodenum]/cnode/sid/sess_srno/session/ospid/state/[adjlist]):
[124]/1/125/7/0xcb8b7c30/2985/LEAF/
[137]/1/138/85/0xcb8900d0/3456/NLEAF/[124]
這里主要是:
nodenum,將相關信息關聯起來
cnode,數據庫節點編號,rac中有用
sid,會話的 sid
sess_srno,serial#
ospid,pid
state,表示session狀態重點關注LEAF狀態的節點,它們通常就是造成阻塞的關鍵會話
adjlist,關聯會話的nodenum,通常就是blocker的nodenum
1 制造阻塞
session 1
SQL> update scott.emp_t set comm = 1000 where empno=7788;
1 row updated.
session 2
SQL> update scott.emp_t set comm = 1500 where empno = 7788;
2 hanganalyze
[[email?protected] ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Jun 21 21:40:52 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> oradebug setmypid
Statement processed.
SQL> oradebug unlimit
Statement processed.
SQL> oradebug hanganalyze 3
Hang Analysis in /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_3642.trc
SQL> oradebug tracefile_name
/u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_3642.trc
SQL> exit
文件比較長,主要是下面這段
[[email?protected] ~]$ vim /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_3642.trc
State of ALL nodes
([nodenum]/cnode/sid/sess_srno/session/ospid/state/[adjlist]):
[124]/1/125/7/0xcb8b7c30/2985/LEAF/
[137]/1/138/85/0xcb8900d0/3456/NLEAF/[124]
sid = 125 serial = 7 pid = 2985 阻塞了 138,85,3456
3 kill 阻塞會話
kill會話有兩種方式,oracle內kill相關sid,以及系統中kill相關pid
oracle內kill相關sid
alter system kill session 'sid, s.serial#‘;
linux中就是 kill -9
SQL> alter system kill session '125,7';
System altered.
4 查看結果
session 1
SQL> select * from scott.emp_t;
select * from scott.emp_t
*
ERROR at line 1:
ORA-00028: your session has been killed
session 2
1 row updated.
SQL> set lines 200
SQL> select * from scott.emp_t;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- ------------ ---------- ---------- ----------
7369 SMITH CLERK 7902 17-DEC-80 800 20
....
14 rows selected.
5 其他資料
如果感興趣可以查看下面的資料,雖然有些有出入,可以作為參考
Oracle Hanganalyze 分析
查詢Oracle正在執行和執行過的SQL語句
https://www.cndba.cn/xkan/article/2000
https://www.cndba.cn/xkan/article/2000
https://www.cndba.cn/xkan/article/2000
https://www.cndba.cn/xkan/article/2000
https://www.cndba.cn/xkan/article/2000
https://www.cndba.cn/xkan/article/2000
https://www.cndba.cn/xkan/article/2000
https://www.cndba.cn/xkan/article/2000
https://www.cndba.cn/xkan/article/2000
https://www.cndba.cn/xkan/article/2000
版權聲明:本文為博主原創文章,未經博主允許不得轉載。
總結
以上是生活随笔為你收集整理的oracle hang analyze,hanganalyze 分析数据库挂起的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MYSQL数据库实验三多表查询_数据库之
- 下一篇: mysql语句怎么记_Mysql常用语句