Exporting and importing Oracle AWR STATSPACK snapshots:-
Exporting and importing Oracle AWR STATSPACK snapshots:-
To extract AWR data:
At the SQL prompt, enter:
@$ORACLE_HOME/rdbms/admin/awrext.sql
A list of the databases in the AWR schema is displayed.
Specify the database from which the AWR data will be extracted:
Enter value for db_id: 1377863381
In this example, the database with the database identifier of 1377863381 is selected.
Specify the number of days for which you want to list snapshot Ids.
Enter value for num_days: 2
A list of existing snapshots for the specified time range is displayed. In this example, snapshots captured in the last 2 days are displayed.
Define the range of snapshots for which AWR data will be extracted by specifying a beginning and ending snapshot Id:
Enter value for begin_snap: 30
Enter value for end_snap: 40
In this example, the snapshot with a snapshot Id of 30 is selected as the beginning snapshot, and the snapshot with a snapshot Id of 40 is selected as the ending snapshot.
A list of directory objects is displayed.
Specify the directory object pointing to the directory where the export dump file will be stored:
Enter value for directory_name: DATA_PUMP_DIR
In this example, the directory object DATA_PUMP_DIR is selected.
Specify the prefix for name of the export dump file (the .dmp suffix will be automatically appended):
Enter value for file_name: awrdata_30_40
In this example, an export dump file named awrdata_30_40 will be created in the directory corresponding to the directory object you specified:
Dump file set for SYS.SYS_EXPORT_TABLE_01 is:
AWRDATA_30_40.DMP
Job "SYS"."SYS_EXPORT_TABLE_01" successfully completed at 08:58:20
Depending on the amount of AWR data that needs to be extracted, the AWR extract operation may take a while to complete. Once the dump file is created, you can use Data Pump to transport the file to another system.
Loading AWR Data:-
SCP the dumpfile to the server which we need to load the AWR data.
At the SQL prompt, enter:
sql>@$ORACLE_HOME/rdbms/admin/awrload.sql
Specify the directory object pointing to the directory where the export dump file is located:
Enter value for directory_name: DATA_PUMP_DIR
Specify the prefix for name of the export dump file (the .dmp suffix will be automatically appended):
Enter value for file_name: awrdata_30_40
Specify the name of the staging schema where the AWR data will be loaded:
Enter value for schema_name: AWR_STAGE
Specify the default tablespace for the staging schema:
Enter value for default_tablespace: SYSAUX
Specify the temporary tablespace for the staging schema:
Enter value for temporary_tablespace: TEMP
A staging schema named AWR_STAGE will be created where the AWR data will be loaded. After the AWR data is loaded into the AWR_STAGE schema, the data will be transferred into the AWR tables in the SYS schema:
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Completed 113 CONSTRAINT objects in 11 seconds