这次某系统发生严重的阻塞,但是去查顶级会话,发现已经没有该对应的sql_id了,于是我们只用通过
v$active_session_history 视图来寻找。下面是查找的过程:
1、查看当前等待事件
select event,count(*) from v$session where event not in ('SQL*Net message from client','rdbms ipc message')
group by event order by count(*);
2、查找顶层会话阻塞
@?/rdbms/admin/utllockt.sql
3、根据顶层会话查找进程
select SID,SERIAL#,USERNAME,COMMAND, OSUSER , PROCESS,macHINE,PROGRAM, SQL_ID from v$session where sid=&sid;
3、查找顶层ASH历史sql_id
select session_id,sql_id,sample_id,event,sample_time from v$active_session_history where session_id==&sid;
4、根据上面的sql_id 定位历史 sql语句
set long 999999
select sql_text from v$sqltext where sql_id='&sql_id' order by piece;