Migrate AWR metadata or import it to other databases.
We can migrate (import) AWR metadata to other databases, import lower versions to higher versions, generate AWR reports with later versions, and use some new features, such
SQL ordered by Physical Reads (UnOptimized)
SQL ordered by User I/O Wait Time
Export:
Testnode:/home/oracle $ export ORACLE_SID = wy1
Testnode:/home/oracle $ sqlplus/as sysdba
SQL> @? /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 ~
~ 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
------------------------------------
* 3988169241 WY testnode1
* 3988169241 WY testnode2
The default database id is the local one: '000000'. To use this
Database id, press <return> to continue, otherwise enter an alternative.
Enter value for dbid:
Using 3988169241 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>
Specifying a number lists all completed snapshots.
Enter value for num_days:
Listing all Completed Snapshots
...
DB Name Snap Id Snap Started
---------------------------------------
WY 4706 18 Mar 2015
4707 18 Mar 2015 <
4708 18 Mar 2015 <
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 4707 <start SNAP
Begin Snapshot Id specified: 4707 <End SNAP
Enter value for end_snap: 4708
End Snapshot Id specified: 4708
Specify the Directory Name
~~~~~~~~~~~~~~~~~~~~~~~~~~
Directory Name Directory Path
-------------------------------------------------------------------------------
DATA_PUMP_DIR/u01/app/oracle/product/11.2.0/db_1/rdbms/log/
EXPDP/tmp/expdp <
ORACLE_OCM_CONFIG_DIR/u01/app/oracle/product/11.2.0/db_1/Cr/state
ORACLE_OCM_CONFIG_DIR2/u01/app/oracle/product/11.2.0/db_1/Cr/state
XMLDIR/u01/app/oracle/product/11.2.0/db_1/rdbms/xml
Choose a Directory Name from the above list (case-sensitive ).
Enter value for directory_name: EXPDP <Enter DIRECTORY, and the physical path of the DIRECTORY is displayed on the right. note: If the SNAP span is large, a large amount of space is required to store files.
Using the dump directory: EXPDP
Specify the Name of the Extract Dump File
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~
The prefix for the default dump file name is awrdat_4707_4708.
To use this name, press <return> to continue, otherwise enter
An alternative.
Enter value for file_name:
Using the dump file prefix: awrdat_4707_4708
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
| The AWR extract dump file will be located
| In the following directory/file:
|/Tmp/expdp <directory
| Awrdat_4707_4708.dmp <file name
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
|
| *** AWR Extract Started...
|
| This operation will take a few moments.
| Progress of the AWR extract operation can be
| Monitored in the following directory/file:
|/Tmp/expdp
| Awrdat_4707_4708.log
|
Import:
The import process is similar.
SQL> @? /Rdbms/admin/awrload
~~~~~~~~~~
AWR LOAD
~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
~ This script will load the AWR data from a dump file. ~
~ Script will prompt users for the following information :~
~ (1) name of directory object ~
~ (2) name of dump file ~
~ (3) staging schema name to load AWR data ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
Specify the Directory Name
~~~~~~~~~~~~~~~~~~~~~~~~~~
Directory Name Directory Path
-------------------------------------------------------------------------------
AGREE_AWRREPORT_DIR/tmp/xunjian
DATA_PUMP_DIR/u01/app/oracle/admin/orcl/dpdump/
EXPDP/arch/expdp <
ORA10G_PUMP/u01/app/oracle/datapump/ora10g
ORACLE_OCM_CONFIG_DIR/u01/app/oracle/product/11.2.0/db_1/Cr/state
XMLDIR/u01/app/oracle/product/11.2.0/db_1/rdbms/xml
Choose a Directory Name from the list above (case-sensitive ).
Enter value for directory_name: EXPDP <input DIRECTORY name
Using the dump directory: EXPDP
Specify the Name of the Dump File to Load
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~
Please specify the prefix of the dump file (. dmp) to load:
Enter value for file_name: awrdat_4707_4708 <input file name (excluding suffix. dmp)
Loading from the file name: awrdat_4707_4708.dmp
Staging Schema to Load AWR Snapshot Data
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The next step is to create the staging schema
Where the AWR snapshot data will be loaded.
After loading the data into the staging schema,
The data will be transferred into the AWR tables
In the SYS schema.
The default staging schema name is AWR_STAGE.
To use this name, press <return> to continue, otherwise enter
An alternative.
Enter value for schema_name: <Enter, default value
Using the staging schema name: AWR_STAGE
Choose the Default tablespace for the AWR_STAGE user
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~
Choose the AWR_STAGE users's default tablespace. This is
Tablespace in which the AWR data will be staged.
TABLESPACE_NAME
--------------------------------------------------------------------------------
CONTENTS DEFAULT TABLESPACE
---------------------------------------------
SYSAUX
PERMANENT *
USERS
PERMANENT
Pressing <return> will result in the recommended default
Tablespace (identified by *) being used.
Enter value for default_tablespace: <Enter, take the default value
Using tablespace SYSAUX as the default tablespace for the AWR_STAGE
Choose the Temporary tablespace for the AWR_STAGE user
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~
Choose the AWR_STAGE user's temporary tablespace.
TABLESPACE_NAME
--------------------------------------------------------------------------------
CONTENTS DEFAULT TEMP TABLESPACE
--------------------------------------------------
TEMP
TEMPORARY *
Pressing <return> will result in the database's default temporary
Tablespace (identified by *) being used.
Enter value for temporary_tablespace: <press Enter, take the default value
Using tablespace TEMP as the temporary tablespace for AWR_STAGE
... Creating AWR_STAGE user
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| Loading the AWR data from the following
| Directory/file:
|/Arch/expdp
| Awrdat_4707_4708.dmp
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
|
| *** AWR Load Started...
|
| This operation will take a few moments.
| Progress of the AWR load operation can be
| Monitored in the following directory/file:
|/Arch/expdp
| Awrdat_4707_4708.log
|
...
---------------------------------------------------
The road is still light, welcome to make a brick.
Reprinted please indicate the source.