Upload
dbareddy
View
221
Download
0
Embed Size (px)
Citation preview
7/29/2019 How to Create AWR Report Manually
1/3
How to create AWR report manually
Oracle database 10g
If you do not have Oracle Enterprise Manager tool installed then you can create the AWR
reports manually using the following commands:
1. Creating Snapshot
BEGINDBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT ();END;/
The list of the snapshot Ids along with database Ids is availabe in the viewDBA_HIST_SNAPSHOT.
2. Dropping a Range of Snapshots.
Refer to the DBA_HIST_SNAPSHOT view column SNAP_ID to view availablesnapshots. To delete contain SNAP_ID from from 102 to 122,
BEGINDBMS_WORKLOAD_REPOSITORY.DROP_SNAPSHOT_RANGE (low_snap_id =>102, high_snap_id => 122, dbid => 8187786345);END;/
3. Modifying Snapshot Settings
If you want to modify the retention period as 43200 minutes (30 days), the intervalbetween each snapshot is specified as 30 minutes, and the number of Top SQL to flush
for each SQL criteria as 100 then use following:
BEGINDBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS( retention=> 43200,interval => 30, topnsql => 100, dbid => 7123356265);END;/The dbid is optional.
4. Extract the AWR Data
The awrextr.sqlscript extracts the AWR data for a range of snapshots from the databaseinto a Data Pump export file. Once created, this dump file can be transported to anothersystem where the extracted data can be loaded. To run the awrextr.sql script, you need tobe connected to the database as the SYS user.
To extract AWR data at the SQL prompt, enter:
SQL> @$ORACLE_HOME/rdbms/admin/awrextr.sql
7/29/2019 How to Create AWR Report Manually
2/3
5. Load the AWR Data
Once the export dump file is transported to the target system, you can load the extractedAWR data using the awrload.sql script. The awrload.sql script will first create a stagingschema where the snapshot data is transferred from the Data Pump file into the database.The data is then transferred from the staging schema into the appropriate AWR tables. To
run the awrload.sql script, you need to be connected to the database as the SYS user.
To load AWR data at the SQL prompt, enter:
SQL> @$ORACLE_HOME/rdbms/admin/awrload.sql
6. Generate AWR Reports
The awrrpt.sql SQL script generates an HTML or text report that displays statistics for arange of snapshot Ids.To generate an HTML or text report for a range of snapshot Ids, run the awrrpt.sql scriptat the SQL prompt:
SQL> @$ORACLE_HOME/rdbms/admin/awrrpt.sql
First, you need to specify whether you want an HTML or a text report.
Enter value for report_type: text
Specify the number of days for which you want to list snapshot Ids.
Enter value for num_days: 2
After the list displays, you are prompted for the beginning and ending snapshot Id for theworkload repository report.
Enter value for begin_snap: 95Enter value for end_snap: 97
Next, accept the default report name or enter a report name. The default name is acceptedin the following example:
Enter value for report_name:Using the report name awrrpt_1_95_97
The workload repository report is generated.
awrrpt.sql
The awrrpt.sql SQL script generates an HTML or text report that displays statistics for arange of snapshot Ids.
awrrpti.sql
The awrrpti.sql SQL script generates an HTML or text report that displays statistics for arange of snapshot Ids on a specified database and instance.
awrsqrpt.sql
The awrsqrpt.sql SQL script generates an HTML or text report that displays statistics of a
7/29/2019 How to Create AWR Report Manually
3/3
particular SQL statement for a range of snapshot Ids. Run this report to inspect or debugthe performance of a SQL statement.
awrsqrpi.sql
The awrsqrpi.sql SQL script generates an HTML or text report that displays statistics of aparticular SQL statement for a range of snapshot Ids on a specified database and instance.Run this report to inspect or debug the performance of a SQL statement on a specificdatabase and instance.
awrddrpt.sql
The awrddrpt.sql SQL script generates an HTML or text report that compares detailedperformance attributes and configuration settings between two selected time periods.
awrddrpi.sql
The awrddrpi.sql SQL script generates an HTML or text report that compares detailedperformance attributes and configuration settings between two selected time periods on aspecific database and instance.