使用$ORACLE_HOME/rdbms/admin/awrextr.sql
$ sqlplus '/as sysdba' SQL*Plus: Release 11.2.0.4.0 Production on Fri Nov 6 13:45:43 2015 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL> @$ORACLE_HOME/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 ------------ ------------ ------------ * 1302125221 ORCL oracledb1 * 1302125221 ORCL oracledb2 The default database id is the local one: '1302125221'. To use this database id, press <return> to continue, otherwise enter an alternative. Enter value for dbid: 1302125221 Using 1302125221 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: 1 Listing the last day's Completed Snapshots DB Name Snap Id Snap Started ------------ --------- ------------------ ORCL 5481 06 Nov 2015 00:00 5482 06 Nov 2015 01:00 5483 06 Nov 2015 02:00 5484 06 Nov 2015 03:00 5485 06 Nov 2015 04:00 5486 06 Nov 2015 05:00 5487 06 Nov 2015 06:00 5488 06 Nov 2015 07:00 5489 06 Nov 2015 08:00 5490 06 Nov 2015 09:00 5491 06 Nov 2015 10:00 DB Name Snap Id Snap Started ------------ --------- ------------------ ORCL 5492 06 Nov 2015 11:00 5493 06 Nov 2015 12:00 5494 06 Nov 2015 13:00 Specify the Begin and End Snapshot Ids ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Enter value for begin_snap: 5489 Begin Snapshot Id specified: 5489 Enter value for end_snap: 5494 End Snapshot Id specified: 5494 Specify the Directory Name ~~~~~~~~~~~~~~~~~~~~~~~~~~ Directory Name Directory Path ------------------------------ ------------------------------------------------- DATA_PUMP_DIR /u01/app/oracle/product/11.2.0/dbhome_1/rdbms/log / DUMPDIR /u01/app/oracle/ EXPDP_DIR /home/oracle/dump ORACLE_OCM_CONFIG_DIR /u01/app/oracle/product/11.2.0/dbhome_1/ccr/hosts /oracledb1/state ORACLE_OCM_CONFIG_DIR2 /u01/app/oracle/product/11.2.0/dbhome_1/ccr/state XMLDIR /u01/app/oracle/product/11.2.0/dbhome_1/rdbms/xml Choose a Directory Name from the above list (case-sensitive). Enter value for directory_name: DUMPDIR Using the dump directory: DUMPDIR Specify the Name of the Extract Dump File ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The prefix for the default dump file name is awrdat_5489_5494. To use this name, press <return> to continue, otherwise enter an alternative. Enter value for file_name: Using the dump file prefix: awrdat_5489_5494 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | The AWR extract dump file will be located | in the following directory/file: | /u01/app/oracle/ | awrdat_5489_5494.dmp | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | *** AWR Extract Started ... | | This operation will take a few moments. The | progress of the AWR extract operation can be | monitored in the following directory/file: | /u01/app/oracle/ | awrdat_5489_5494.log | End of AWR Extract SQL>