AWR的SNAP生成后,不一定要在原数据库上生成报告,可以利用AWR提供的导出、导入功能,将AWR数据迁移到测试数据库上进一步分析。
AWR的导出并不复杂,利用有权限的用户调用$ORACLE_HOME/rdbms/admin/awrextr.sql脚本就可以了:
SQL> @?/rdbms/admin/awrextr.sql
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Disclaimer: This SQL/Plus script. should only be called under
the guidance of Oracle Support.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~
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
------------ ------------ ------------
* 96312462 TESTRAC racnode1
* 96312462 TESTRAC racnode2
* 96312462 TESTRAC racnode3
3944144691 CCICDB ccicdbsrv5
The default database id is the local one: ' 96312462'. To use this
database id, press <return> to continue, otherwise enter an alternative.
输入dbid的值:
Using 96312462 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.
输入num_days的值: 3
Listing the last 3 days of Completed Snapshots
DB Name Snap Id Snap Started
------------ --------- ------------------
TESTRAC 2758 14 11月2010 00:00
2759 14 11月2010 01:00
2760 14 11月2010 02:00
.
.
.
2780 14 11月2010 22:00
2781 14 11月2010 23:00
2782 15 11月2010 00:00
2783 15 11月2010 01:00