ZT:instance Wait Tuning

http://www.praetoriate.com/t_oracle_wait_tuning.htm

The v$active_session_history XE "v$active_session_history" table can be used to view specific events with the highest resource waits.

select

ash.event,

sum(ash.wait_time +

ash.time_waited) ttl_wait_time

from

v$active_session_history ash

where

ash.sample_time between sysdate - 60/2880 and sysdate

group by

ash.event

order by 2;


For a given session, an Oracle user may issue multiple SQL statements and it is the interaction between the SQL and the database that determines the wait conditions. The v$active_session_history XE "v$active_session_history" table can be joined into the v$sqlarea XE "v$sqlarea" and dba_users XE "dba_users" to quickly see the top SQL waits as well as the impacted user and session with which they are associated:

select

ash.user_id,

u.username,

sqla.sql_text,

sum(ash.wait_time + ash.time_waited) wait_time

from

v$active_session_history ash,

v$sqlarea sqla,

dba_users u

where

ash.sample_time > sysdate-1

and

ash.sql_id = sqla.sql_id

and

ash.user_id = u.user_id

group by

ash.user_id,

sqla.sql_text,

u.username

order by 4;

Once the SQL details have been identified, the DBA can drill down deeper by joining v$active_session_history XE "v$active_session_history" with dba_objects XE "dba_objects" and find important information about the interaction between the SQL and specific tables and indexes. What follows is an ASH script that can be used to show the specific events that are causing the highest resource waits. Also, remember that some contention is NOT caused by SQL but by faulty network, slow disk or some other external causes. Also, frequent deadlocks may be caused by improperly indexed foreign keys.

· ash_obj_waits.sql

select

obj.object_name,

obj.object_type,

ash.event,

sum(ash.wait_time + ash.time_waited) wait_time

from

v$active_session_history ash,

dba_objects obj

where

ash.sample_time > sysdate -1

and

ash.current_obj# = obj.object_id

group by

obj.object_name,

obj.object_type,

ash.event

order by 4 desc;

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/267265/viewspace-82897/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/267265/viewspace-82897/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值