Wednesday, 20 June 2012

AWR Snapshot - Details


How to Change the AWR Snapshot Settings:

Default is 60 Minutes. Following will change to 30 Minutes:
EXEC DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS( interval => 30);

Changes the interval setting to two hours and the retention setting to two weeks for the local database:
execute dbms_workload_repository.modify_snapshot_settings(interval => 120,retention => 20160);

If you query the DBA_HIST_WR_CONTROL table after this procedure is executed, you will see the changes to these settings.
SELECT * FROM DBA_HIST_WR_CONTROL;

By setting the value of the interval as 0, we set the new interval between each snapshot collection as 110 years:
execute DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS(interval => 0);

The default settings for 'interval' and 'retention' are (60 min and 7 days respectively), and values for both 'interval' and 'retention' dbms_workload_repository.modify_snapshot_settings(...) procedure is expressed in minutes. 

How to Manually Create Snapshots:

When you wish to create performance snapshots outside of the fixed intervals, then DBMS_WORKLOAD_REPOSITORY package can also be used:
EXEC DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT('TYPICAL');

How to Manually Drop Snapshots Range:

DBMS_WORKLOAD_REPOSITORY.DROP_SNAPSHOT_RANGE( 
low_snap_id IN NUMBER, 
high_snap_id IN NUMBER 
dbid IN NUMBER DEFAULT NULL);


Cheers !!!!!!!

No comments:

Post a Comment