本文档分为如下几个部分
1.AWR导出awrextr.sql
2.AWR导入awrload.sql
3.为导入awr生成报告awrrpti.sql
4.删除导入的AWR数据dbms_workload_repository.DROP_SNAPSHOT_RANGE
说明:
其实导出脚本awrextr.sql/awrload.sql,是创建了expdp/impdp作业,可以通过v$datapump_jobs视图查询。
(1)导出
SYS@honor1 > @?/rdbms/admin/awrextr.sql ~~~~~~~~~~~~~ AWR EXTRACT ~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ This script will extract the AWR data for a range of snapshots ~ ~ into a dump file. The script will prompt users for the ~ ~ following information: ~ ~ (1) database id ~ ~ (2) snapshot range to extract ~ ~ (3) name of directory object ~ ~ (4) name of dump file ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Databases in this Workload Repository schema ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DB Id DB Name Host ------------ ------------ ------------ * 353046371 HONOR db-oracle-no de1.cloud.la b.eng.bos.re dhat.com * 353046371 HONOR db-oracle-no de2.cloud.la b.eng.bos.re dhat.com The default database id is the local one: ' 353046371'. To use this database id, press <return> to continue, otherwise enter an alternative. Enter value for dbid: Using 353046371 for Database ID Specify the number of days of snapshots to choose from ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Entering the number of days (n) will result in the most recent (n) days of snapshots being listed. Pressing <return> without specifying a number lists all completed snapshots. Enter value for num_days: 5 Listing the last 5 days of Completed Snapshots DB Name Snap Id Snap Started ------------ --------- ------------------ HONOR 1207 05 Apr 2020 01:56 1208 05 Apr 2020 09:38 1209 05 Apr 2020 11:00