Automatic Workload Repository. it collect database statistics automatically ( every 1 hour as default).
CHECK AWR SETTING:
log in as sysdab:
select snap_interval, retention, topnsql from wrm$_wr_control;
CREATE SNAPSHOT MANUALLY:
exec dbms_workload_repository.create_snapshot();
TURN OFF SNAPHOT COLLECTION:
exec dbms_workload_repository.modify_snapshot_settings(interval => 0);
TURN ON SNAPHOT COLLECTION HOURLY:
exec dbms_workload_repository.modify_snapshot_settings(interval => 60);
SYNTEX:
DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS( retention IN NUMBER DEFAULT NULL, interval IN NUMBER DEFAULT NULL, topnsql IN NUMBER DEFAULT NULL, dbid IN NUMBER DEFAULT NULL); DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS( retention IN NUMBER DEFAULT NULL, interval IN NUMBER DEFAULT NULL, topnsql IN VARCHAR2, dbid IN NUMBER DEFAULT NULL);
CHECK LASTEST COLLECTION:
select systimestamp, most_recent_snap_time, snap_interval from wrm$_wr_control where dbid = (select dbid from v$database);
CHECK ERORR COLLECTION:
select * from wrm$_snap_error
where dbid = (select dbid from v$database)
order by snap_id;
select * from
(select snap_id,
instance_number,
begin_interval_time,
end_interval_time,
flush_elapsed,
status,
error_count,
snap_flag
from wrm$_snapshot
where dbid = (select dbid from v$database)
order by snap_id desc)
where rownum <= 10
order by snap_id;
TRACE AUOT SNAPHOE COLLECTION:
snapshot was automatically collected by MMON background process
MMON action trace
alter session set "_swrf_test_action"=28;
snapshot flush trace
alter session set "_swrf_test_action"=10;
trun off trace
MMON action trace
alter session set "_swrf_test_action"=29;
snapshot flush trace
alter session set "_swrf_test_action"=11;
MORE TRACE INFO:
begin
dbms_monitor.serv_mod_act_trace_enable(service_name=>'SYS$BACKGROUND',
module_name=>'MMON_SLAVE',
action_name=>'Auto-Flush Slave Action');
dbms_monitor.serv_mod_act_trace_enable(service_name=>'SYS$BACKGROUND',
module_name=>'MMON_SLAVE',
action_name=>'Remote-Flush Slave Action');
end;
/
# trace AWR snapshots
alter session set events 'immediate trace name awr_test level 1';
# trace AWR purging
alter session set events 'immediate trace name awr_test level 2';
# trace AWR SQL
alter session set events 'immediate trace name awr_test level 3';
# turn off all of the above, if set
alter session set events 'immediate trace name awr_test level 4';
reference:
metalink document:
No comments:
Post a Comment