溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

AWR跨庫(kù)導(dǎo)出與導(dǎo)入的方法是什么

發(fā)布時(shí)間:2021-11-04 17:12:13 來(lái)源:億速云 閱讀:112 作者:iii 欄目:關(guān)系型數(shù)據(jù)庫(kù)

這篇文章主要講解了“AWR跨庫(kù)導(dǎo)出與導(dǎo)入的方法是什么”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來(lái)研究和學(xué)習(xí)“AWR跨庫(kù)導(dǎo)出與導(dǎo)入的方法是什么”吧!

(1)導(dǎo)出

SYS@honor1 > @?/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
------------ ------------ ------------
* 353046371  HONOR        db-oracle-no
                          de1.cloud.la
                          b.eng.bos.re
                          dhat.com
* 353046371  HONOR        db-oracle-no
                          de2.cloud.la
                          b.eng.bos.re
                          dhat.com
The default database id is the local one: '                               353046371'.  To use this
database id, press <return> to continue, otherwise enter an alternative.
Enter value for dbid: 
Using                                353046371 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: 5
Listing the last 5 days of Completed Snapshots
DB Name        Snap Id    Snap Started
------------ --------- ------------------
HONOR             1207 05 Apr 2020 01:56
                  1208 05 Apr 2020 09:38
                  1209 05 Apr 2020 11:00
                  1210 05 Apr 2020 12:00
                  1211 05 Apr 2020 13:00
                  1212 05 Apr 2020 14:00
                  1213 05 Apr 2020 15:00
                  1214 05 Apr 2020 16:00
                  1215 05 Apr 2020 17:00
                  1216 05 Apr 2020 18:00
                  1217 05 Apr 2020 19:00
                  1218 05 Apr 2020 20:00
                  1219 05 Apr 2020 21:00
                  1220 05 Apr 2020 22:01
                  1221 05 Apr 2020 23:00
                  1222 06 Apr 2020 01:55
                  1223 06 Apr 2020 10:34
                  1224 06 Apr 2020 12:00
                  1225 06 Apr 2020 13:00
                  1226 06 Apr 2020 14:00
                  1227 06 Apr 2020 15:00
                  1228 06 Apr 2020 16:00
                  1229 06 Apr 2020 17:00
                  1230 06 Apr 2020 18:00
                  1231 06 Apr 2020 19:00
                  1232 06 Apr 2020 20:00
                  1233 06 Apr 2020 21:00
                  1234 07 Apr 2020 10:07
                  1235 07 Apr 2020 11:00
                  1236 07 Apr 2020 12:00
                  1237 07 Apr 2020 13:00
                  1238 07 Apr 2020 14:00
                  1239 09 Apr 2020 09:55
                  1240 09 Apr 2020 11:00
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 1207
Begin Snapshot Id specified: 1207
Enter value for end_snap: 1217
End   Snapshot Id specified: 1217
Specify the Directory Name
~~~~~~~~~~~~~~~~~~~~~~~~~~
Directory Name                 Directory Path
------------------------------ -------------------------------------------------
DATA_FILE_DIR                  /u01/app/oracle/product/11.2/db_1/demo/schema/sal
                               es_history/
DATA_PUMP_DIR                  /u01/app/oracle/product/11.2/db_1/rdbms/log/
EXPDP                          /rman/expdp
LOG_FILE_DIR                   /u01/app/oracle/product/11.2/db_1/demo/schema/log
                               /
MEDIA_DIR                      /u01/app/oracle/product/11.2/db_1/demo/schema/pro
                               duct_media/
ORACLE_OCM_CONFIG_DIR          /u01/app/oracle/product/11.2/db_1/ccr/hosts/db-or
                               acle-node1.cloud.lab.eng.bos.redhat.com/state
ORACLE_OCM_CONFIG_DIR2         /u01/app/oracle/product/11.2/db_1/ccr/state
SS_OE_XMLDIR                   /u01/app/oracle/product/11.2/db_1/demo/schema/ord
                               er_entry/
SUBDIR                         /u01/app/oracle/product/11.2/db_1/demo/schema/ord
                               er_entry//2002/Sep
XMLDIR                         /u01/app/oracle/product/11.2/db_1/rdbms/xml
Choose a Directory Name from the above list (case-sensitive).
Enter value for directory_name: EXPDP      /* 需要大寫(xiě),小寫(xiě)目錄會(huì)報(bào)錯(cuò) */
Using the dump directory: EXPDP
Specify the Name of the Extract Dump File
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The prefix for the default dump file name is awrdat_1207_1217.
To use this name, press <return> to continue, otherwise enter
an alternative.
Enter value for file_name: 
Using the dump file prefix: awrdat_1207_1217
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|  The AWR extract dump file will be located
|  in the following directory/file:
|   /rman/expdp
|   awrdat_1207_1217.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:
|   /rman/expdp
|   awrdat_1207_1217.log
|
End of AWR Extract
SYS@honor1 > exit

(2)導(dǎo)入

scp到目標(biāo)數(shù)據(jù)庫(kù)服務(wù)器

[oracle@db-oracle-node1 expdp]$ scp * 192.168.204.231:/rman/expdp
oracle@192.168.204.231's password: 
awrdat_1207_1217.dmp                                                                                                                   100%   12MB  11.8MB/s   00:00    
awrdat_1207_1217.log

導(dǎo)入

11:40:59 SYS@messay > @?/rdbms/admin/awrload.sql
~~~~~~~~~~
AWR LOAD
~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~  This script will load the AWR data from a dump file. The   ~
~  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 into           ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Specify the Directory Name
~~~~~~~~~~~~~~~~~~~~~~~~~~
Directory Name                 Directory Path
------------------------------ -------------------------------------------------
DATA_FILE_DIR                  /oracle/app/oracle/product/11.2/db_1/demo/schema/
                               sales_history/
DATA_PUMP_DIR                  /oracle/app/oracle/admin/messay/dpdump/
EXPDP                          /rman/expdp
LOG_FILE_DIR                   /oracle/app/oracle/product/11.2/db_1/demo/schema/
                               log/
MEDIA_DIR                      /oracle/app/oracle/product/11.2/db_1/demo/schema/
                               product_media/
ORACLE_OCM_CONFIG_DIR          /oracle/app/oracle/product/11.2/db_1/ccr/hosts/si
                               ngle/state
ORACLE_OCM_CONFIG_DIR2         /oracle/app/oracle/product/11.2/db_1/ccr/state
SS_OE_XMLDIR                   /oracle/app/oracle/product/11.2/db_1/demo/schema/
                               order_entry/
SUBDIR                         /oracle/app/oracle/product/11.2/db_1/demo/schema/
                               order_entry//2002/Sep
XMLDIR                         /oracle/app/oracle/product/11.2/db_1/rdbms/xml
Elapsed: 00:00:00.00
Choose a Directory Name from the list above (case-sensitive).
Enter value for directory_name: EXPDP
Using the dump directory: EXPDP
Elapsed: 00:00:00.00
Elapsed: 00:00:00.00
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_1207_1217
Loading from the file name: awrdat_1207_1217.dmp
Elapsed: 00:00:00.00
Elapsed: 00:00:00.00
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: 
Using the staging schema name: AWR_STAGE
Elapsed: 00:00:00.00
Elapsed: 00:00:00.00
Choose the Default tablespace for the AWR_STAGE user
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Choose the AWR_STAGE users's default tablespace.  This is the
tablespace in which the AWR data will be staged.
TABLESPACE_NAME
--------------------------------------------------------------------------------
CONTENTS                    DEFAULT TABLESPACE
--------------------------- ------------------
EXAMPLE
PERMANENT
SYSAUX
PERMANENT                   *
USERS
PERMANENT
Elapsed: 00:00:00.01
Pressing <return> will result in the recommended default
tablespace (identified by *) being used.
Enter value for default_tablespace: 
Using tablespace SYSAUX as the default tablespace for the AWR_STAGE
Elapsed: 00:00:00.00
Elapsed: 00:00:00.00
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                   *
Elapsed: 00:00:00.02
Pressing <return> will result in the database's default temporary
tablespace (identified by *) being used.
Enter value for temporary_tablespace: 
Using tablespace TEMP as the temporary tablespace for AWR_STAGE
Elapsed: 00:00:00.00
Elapsed: 00:00:00.00
... Creating AWR_STAGE user
Elapsed: 00:00:00.16
Elapsed: 00:00:00.05
Elapsed: 00:00:00.00
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|  Loading the AWR data from the following
|  directory/file:
|   /rman/expdp
|   awrdat_1207_1217.dmp
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|  *** AWR Load Started ...
|
|  This operation will take a few moments. The
|  progress of the AWR load operation can be
|  monitored in the following directory/file:
|   /rman/expdp
|   awrdat_1207_1217.log
|
Elapsed: 00:00:00.02
Elapsed: 00:00:56.84
Elapsed: 00:00:25.56
... Dropping AWR_STAGE user
Elapsed: 00:00:17.97
End of AWR Load

(3)生成awr

需要通過(guò)awrrpti.sql腳本生成快照:

11:46:21 SYS@messay > @?/rdbms/admin/awrrpti.sql

(4)刪除導(dǎo)入awr

查詢當(dāng)前快照

select snap_id,dbid,instance_number from dba_hist_snapshot order by 2,1;

刪除導(dǎo)入的快照:

12:07:52 SYS@messay > exec dbms_workload_repository.DROP_SNAPSHOT_RANGE(LOW_SNAP_ID=>1207,HIGH_SNAP_ID=>1217,DBID=>353046371);

再次查詢:

select snap_id,dbid,instance_number from dba_hist_snapshot order by 2,1;

感謝各位的閱讀,以上就是“AWR跨庫(kù)導(dǎo)出與導(dǎo)入的方法是什么”的內(nèi)容了,經(jīng)過(guò)本文的學(xué)習(xí)后,相信大家對(duì)AWR跨庫(kù)導(dǎo)出與導(dǎo)入的方法是什么這一問(wèn)題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是億速云,小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

awr
AI