Você está na página 1de 2

Oracle AWR

To execute oracle AWR snapshot, DBA rights are required.


AWR snapshot can be captured in two ways,
1. Automatic and
2. Manual.

Automatic:
By default AWR snapshot is taken every one hour and is retained for one week.
To change these default values, run the following command.
BEGIN
DBMS_WORKLOAD_REPOSITORY.modify_snapshot_settings(
retention => 14400,
-- Minutes (= 10 Days). Current value retained if NULL.
interval => 15);
-- Minutes. Current value retained if NULL.
END;

Manual:
To capture the AWR report manually, run the following command:
EXEC DBMS_WORKLOAD_REPOSITORY.create_snapshot;

Run the above procedure when ever we need to capture a snapshot.

Procedure to take snapshots:


Generally we recommend taking a snapshot just before the Load test begins. And there after take
a snapshot for every 15 minutes manually or when ever we require a snapshot. And before
taking any snapshot, please make a note of the snapshot id of the latest snapshot.

Generating AWR report:


To generate AWR report from captured snapshots, run the following script.
@$ORACLE_HOME/rdbms/admin/awrrpt.sql

Running this script will throw prompt asking for the below mentioned things,
Specify the report type:
Choose HTML.
Specify the number of days of snapshots to choose from:
Choose 2 days.
Specify the Begin and End Snapshot Ids:
For example say we have captured 8 snapshots during the entire Load test starting from
snapshot id: 121 to 128.

We need to run the awrrpt.sql eight times to generate 8 AWR reports. To generate the first report
we need to give Begin snapshot id as 121 and end snapshot id as 122. And for second report the
Begin snapshot id as 122 and End snapshot id as 123 and so on. For the last report the Begin
snapshot id would be 128 and End snapshot id is 122 (Not 121).

Specify the SQL id:


If you want to generate a report for particluat SQL id enter the SQL id or else press <return> to
monitor all the available SQLs
Enter the value for report name:
The default report name would be awrsqlrpt_1_<beginsnapshotid>_<endsnapshotid>.html. Press
<return> if you want to use the default report name. But if you want to give some meaningful
name enter the Report file name.
Note: Say if we have captured 8 Snapshots, we have to generate Eight such reports by using
the procedure above.

Você também pode gostar