echo "SESSION EVENT WAIT LIST "
while [ 1 ]
do
echo ">>>"`date`"<<<"
sqlplus -s "/ as sysdba" <<!
set pagesize 2000
set linesize 250
col event format a35
col username for a10
COL BLOCK_SESS FOR A15
col p123 for a15
col sess for a18
col machine for a10
col program format a30
select event,count(1) from v\$session where wait_class<>'Idle' group by event order by 2 desc;
select sql_id,substr(DECODE(COMMAND,1,'DDL',2,'INSERT',3,'Query',6,'UPDATE',7,'DELETE',47,'PL/SQL_package_call',50,'Explain Plan',170,'CALL',189,'MERGE',TO_CHAR(COMMAND)),1,8) OPCODE,count(*) from v\$session where wait_class<>'Idle' group by sql_id,substr(DECODE(COMMAND,1,'DDL',2,'INSERT',3,'Query',6,'UPDATE',7,'DELETE',47,'PL/SQL_package_call',50,'Explain Plan',170,'CALL',189,'MERGE',TO_CHAR(COMMAND)),1,8) order by 3 desc;
select SID||','||SERIAL#||':'||seq# SESS,USERNAME,STATUS,SQL_ID,BLOCKING_INSTANCE||':'||BLOCKING_SESSION BLOCK_SESS,EVENT,p1||','||p2||','||p3 p123,MACHINE,PROGRAM from v\$session where wait_class<>'Idle';
quit
!
sleep 5
done
oracle脚本--- wait事件查询
最新推荐文章于 2023-05-12 10:38:16 发布