一、開啓等待事件採集器
須要修改setup_instruments 配置表中對應的採集器配置項
update setup_instruments set ENABLED ='YES',TIMED='YES' where name like 'wait/%'
二、開啓等待事件的保存表配置項
修改setup_consumers 配置表 中對應的配置項
update setup_consumers set ENABLED='YES' where name like '%wait%'
三、建立視圖
create view sys.test_waits as
select sum(timer_wait) as timer_wait,sum(number_of_bytes)
as number_of_bytes,event_name,operation from events_waits_current where
EVENT_NAME !='idle' group by EVENT_NAME,OPERATION
四、查看耗時的等待事件
select sys.format_time(timer_wait),sys.format_bytes(number_of_bytes),event_name,operation from sys.test_waits
where sys.format_time(timer_wait) not regexp 'ns|us|ms' order by sys.format_time(timer_wait) descide