Oracle数据库数据恢复、性能优化

找回密码
注册
搜索
热搜: 活动 交友 discuz
发新帖

164

积分

0

好友

16

主题
1#
发表于 2012-3-26 14:29:10 | 查看: 5593| 回复: 1
咨询oracle11g哪个数据表有没历史锁表信息?
事后awr发现top5有锁表信息,但怎么查看具体是哪个表被锁?
Top 5 Timed Foreground Events

Event Waits Time(s) Avg wait (ms) % DB time Wait Class
DB CPU   6,342   77.74   
enq: TX - row lock contention 4 1,008 252004 12.36 Application
在awr中能看到哪个表被锁了么?
2#
发表于 2012-3-26 16:34:18
col instance_number form 999 head INST
col begin_interval_time form a25
col flush_elapsed form a17
col status form 999
col error_count form 999 head ERR
col snap_flag form 999 head SNAP
select * from
(select snap_id,
instance_number,
begin_interval_time,
flush_elapsed,
status,
error_count,
snap_flag
from wrm$_snapshot
where dbid = (select dbid from v$database)
order by snap_id desc)
order by snap_id;

select SESSION_ID,sql_id,USER_ID,SQL_ID,BLOCKING_SESSION,event,SAMPLE_TIME from DBA_HIST_ACTIVE_SESS_HISTORY  
where snap_id=&snap_id   and WAIT_CLASS<>'Idle' group by SESSION_ID,USER_ID,SQL_ID,BLOCKING_SESSION,event,SAMPLE_TIME;

select * from
(select event, waits "Waits", time "Wait Time (s)", pct*100 "Percent of Total", waitclass "Wait Class"
from (select e.event_name event, e.total_waits - nvl(b.total_waits,0) waits,
(e.time_waited_micro - nvl(b.time_waited_micro,0))/1000000 time
, (e.time_waited_micro - nvl(b.time_waited_micro,0))/(select sum(e1.time_waited_micro - nvl(b1.time_waited_micro,0))
from dba_hist_system_event b1 , dba_hist_system_event e1
where b1.snap_id(+) = b.snap_id and e1.snap_id = e.snap_id and b1.dbid(+) = b.dbid
and e1.dbid = e.dbid and b1.instance_number(+) = b.instance_number
and e1.instance_number = e.instance_number
and b1.event_id(+) = e1.event_id
and e1.total_waits > nvl(b1.total_waits,0)
and e1.wait_class <> 'Idle'
) pct
, e.wait_class waitclass
from
dba_hist_system_event b ,
dba_hist_system_event e
where b.snap_id(+) = &pBgnSnap
and e.snap_id = &pEndSnap
and b.event_id(+) = e.event_id
and e.total_waits > nvl(b.total_waits,0)
and e.wait_class <> 'Idle'
order by waits desc
)
where rownum < 11)
;


select * from
(
select
sql.sql_id c1,
sql.buffer_gets_delta c2,
sql.disk_reads_delta c3,
sql.iowait_delta c4
from
dba_hist_sqlstat sql,
dba_hist_snapshot s
where
s.snap_id = sql.snap_id
and
s.snap_id=&snapid
order by
c3 desc)
where rownum < 6
;


select sql_text from dba_hist_sqltext where sql_id='&sql_id';

回复 只看该作者 道具 举报

您需要登录后才可以回帖 登录 | 注册

QQ|手机版|Archiver|Oracle数据库数据恢复、性能优化

GMT+8, 2024-12-24 03:01 , Processed in 0.046913 second(s), 21 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部
TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569