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> ~ (2) snapshot range to extract ~
~ (3) name of directory object ~
~ (4) name of dump file ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Databases in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Using 96312462 for Database> 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 without
specifying a number lists all completed snapshots.
输入num_days的值: 3
Listing the last 3 days of Completed Snapshots
Specify the Begin and End Snapshot> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
输入begin_snap的值: 2782
Begin Snapshot> 输入end_snap的值: 2806
End Snapshot> Specify the Directory Name
~~~~~~~~~~~~~~~~~~~~~~~~~~
Directory Name Directory Path
------------------------------ -------------------------------------------------
ADMIN_DIR /data/oracle/product/10.2/database/md/admin
DATA_PUMP_DIR /data/oracle/product/10.2/database/rdbms/log/
D_AWR /data1/awr
ORACLE_OCM_CONFIG_DIR /data/oracle/product/10.2/database/ccr/state
WORK_DIR /data/oracle/product/10.2/database/work
Choose a Directory Name from the above list (case-sensitive).
输入directory_name的值: D_AWR
Using the dump directory: D_AWR
Specify the Name of the Extract Dump File
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The prefix for the default dump file name is awrdat_2782_2806.
To use this name, press to continue, otherwise enter
an> 输入file_name的值: awr_testrac_2782_2806
Using the dump file prefix: awr_testrac_2782_2806
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The AWR extract dump file will be located
| in the following directory/file:
| /data1/awr
| awr_testrac_2782_2806.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:
| /data1/awr
| awr_testrac_2782_2806.log
|
WHERE (dbid, snap_id) IN (SELECT dbid, snap_id FROM SYS.WRM$_SNAPSHOT WHERE DBID = 96312462 AND SNAP_ID >=
2782 AND SNAP_ID host ls -l /data1/awr/awr_testrac*
-rw-rw---- 1 oracle oinstall 17158144 Nov 16 17:32 /data1/awr/awr_testrac_2782_2806.dmp
-rw-rw-r-- 1 oracle oinstall 25939 Nov 16 17:32 /data1/awr/awr_testrac_2782_2806.log
其中dmp文件就是脚本利用数据泵导出的snap数据,将这个文件拷贝到目标数据库上执行导入,就可以实现AWR数据的迁移。
oracle视频教程请关注:http://u.youku.com/user_video/id_UMzAzMjkxMjE2.html