AWR data를 Source 서버에서 target 서버로 import 방법
-------------------------------------------------------------
1. datapump을 위해 사전에 디렉토리 생성
SQL> create or replace directory DBPUMP as '/datapump';
2. awrext.sql 실행
$ 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 the ~
~ following information: ~
~ (1) database id ~
~ (2) snapshot range to extract ~
~ (3) name of directory object ~
~ (4) name of dump file ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for dbid: database id명(v$database 에 DBID 컬럼으로 확인가능) <-- 입력
Enter value for num_days: 1 <-- 입력
Enter value for begin_snap: 시작snap번호입력 <-- 입력
Enter value for end_snap: 끝snap번호입력 <-- 입력
Enter value for directory_name: 내려받을 directory명입력 <-- 입력
Enter value for file_name: 파일명입력(확장자명불필요) <-- 입력
..
Using the dump file prefix: awrdatafile
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The AWR extract dump file will be located
| in the following directory/file:
| /datapump
| awrdatafile.dmp
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| *** AWR Extract Started ...
This operation will take a few moments. The
| progress of the AWR load operation can be
| monitored in the following directory/file
End of AWR Extract
SQL> !ls -al /datapump
3. FTP로 dmp 화일을 pump에서 지정했던 디렉토리로 전송해서 target server 에서 import
4. awrload.sql 실행
$ sqlplus "/ as sysdba"
SQL>@?/rdbms/admin/awrload.sql
export 받은 DBID가 같은 동일한 장비에서는 import 가 되지 않으므로 다른 DBID 를 지정해 주어야 한다.
-- 동일한 DBID가 있으면 ORA-20303 에러 발생
ERROR at line 1:
ORA-20105: Unable to move AWR data to SYS
ORA-06512: at "SYS.DBMS_SWRF_INTERNAL", line 5085
ORA-20303: Can not import snapshots because flushing is enabled
ORA-06512: at "SYS.DBMS_SWRF_INTERNAL", line 4493
ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 2503
ORA-06512: at line 4
5. awr 데이터를 다른 DBID값을 넣어서 awrload.sql 수행
SQL>@?/rdbms/admin/awrload.sql 292929 --별도의 DBID입력
6. 새롭게 적재된 Data 를 간단히 조회만 해서 보고자 할 경우
SQL> select dbid,instance_number as inst_id, db_name, instance_name as inst_name from dba_hist_database_instance;
SQL> select * dba_hist_snapshot where dbid='292929' -- 보고싶은 snapshot id 범위 확인
아래 쿼리로 AWR report 생성
SPOOL AWR_TEST.HTMLSET LINESIZE 200 PAGES 0select output from table (dbms_workload_repository.awr_report_html('292929', -- DBID'1', -- Instance #'14', -- begin Snapshut ID'1', -- End Snapshut ID'10' ) -- Report option (0: Default / 8: Including ADDM Information (as a Advice)
);
7. import AWR 추출하기
SQL> @?/rdbms/admin/awrrpti
Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
AWR reports can be generated in the following formats. Please enter the
name of the format at the prompt. Default value is 'html'.
'html' HTML format (default)
'text' Text format
'active-html' Includes Performance Hub active report
Enter value for report_type: html <-- 입력
Type Specified: html
Specify the location of AWR Data
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
AWR_ROOT - Use AWR data from root (default)
Enter value for awr_location: /저장경로입력 <-- 입력
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
------------ ---------- --------- ---------- ------
292929 1 TESTDB2 TESTDB3 p2testdb2 <-- Import한 AWR데이터
123455677 1 TESTDB1 TESTDB4 p1testdb1
Enter value for dbid: 292929 <-- 입력
Enter value for inst_num: 1 <-- 입력
Enter value for num_days: 1 <-- 입력
Enter value for begin_snap: 1 <-- 입력
Enter value for end_snap: 10 <-- 입력
Enter value for report_name: awrrpt_1_1_10 <-- 입력
Report written to awrrpt_1_1_10.html
'oracle' 카테고리의 다른 글
[ORACLE] SQL PLAN 고정 (0) | 2024.06.24 |
---|---|
[ORACLE] ORACLE LIFETIME SUPPORT POLICY (0) | 2024.06.20 |
[ORACLE] FRA 설정 (0) | 2024.06.13 |
[ORACLE] ORA-600 [kkdlcob-objn-exists] [1087263] (0) | 2024.06.11 |
[ORACLE] HINT 정리 (0) | 2024.06.10 |