내맘대로긍정이 알려주는
Oracle 23ai 신기능
무료 세미나 발표자료
OS환경 : Oracle Linux 7.5 (64bit)
DB 환경 : Oracle Database 19.7.0.0
방법 : rman 백업 스크립트 및 정리
rman 이란?
recovery manager (RMAN)은 오라클에서 제공하는 백업 및 복구 작업을 수행하고 백업 전략 관리를 자동화하는 솔루션임
rman 특징
- DB 전체, Tablespace 단위, Datafile 단위, Archive log, Control files 들을 Backup 할 수 있음
- 백업을 run 구문으로 script 로 묶어서 실행할 수 있음
- 증분 백업을 할 수 있음
- 사용되어지지 않은 database block 들은 skip 함
- VALIDATE 명령을 통해 Corrupted block 을 확인할 수 있음
- 운영중 백업 시 begin backup 구문을 사용 할 필요가 없음
- OS 의 open file limit 을 피하기 위해 open file limit 을 지정할 수 있으며, backup 의 사이즈의 limit 을 줄
수 있다. 또한 file 당, second 당 reads 를 지정해서 부하를 조정할 수 있음
백업 방식
- COPY 방식 : 현재파일을 그대로 1:1로 그대로 백업하는 방식
사용방법 : backup as copy database;
- BACKUP SET 방식 : 빈블록을 뺴고 모아서 저장하는 방식
사용방법 : backup as backupset database; 또는 backup database;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | $ ls -al /app/oracle/rman total 2907344 drwxr-xr-x 2 oracle dba 4096 Jun 10 18:18 . drwxr-xr-x 12 oracle dba 152 Jun 10 17:02 .. -rw-r----- 1 oracle dba 11304960 Jun 10 18:06 db_ctl_c-1569825744-20200620-01 -rw-r----- 1 oracle dba 11304960 Jun 10 18:18 db_ctl_c-1569825744-20200620-02 -rw-r----- 1 oracle dba 48128 Jun 10 18:06 ORCL_49v388sf_1_1_FULL_database_20200620.bk <-- 백업셋 방식의 백업본 -rw-r----- 1 oracle dba 909688832 Jun 10 18:06 ORCL_4av388sg_1_1_FULL_database_20200620.bk <-- 백업셋 방식의 백업본 -rw-r----- 1 oracle dba 4096 Jun 10 18:06 ORCL_4bv388sn_1_1_FULL_database_20200620.bk <-- 백업셋 방식의 백업본 -rw-r----- 1 oracle dba 576724992 Jun 10 18:18 ORCL_data_D-ORCL_I-1569825744_TS-SYSAUX_FNO-2_4fv389ke_FULL_database_20200620.bk <-- IMAGE COPY 방식의 백업본 -rw-r----- 1 oracle dba 828383232 Jun 10 18:18 ORCL_data_D-ORCL_I-1569825744_TS-SYSTEM_FNO-1_4dv389k4_FULL_database_20200620.bk <-- IMAGE COPY 방식의 백업본 -rw-r----- 1 oracle dba 634396672 Jun 10 18:18 ORCL_data_D-ORCL_I-1569825744_TS-UNDOTBS1_FNO-3_4ev389kb_FULL_database_20200620.bk <-- IMAGE COPY 방식의 백업본 -rw-r----- 1 oracle dba 5251072 Jun 10 18:18 ORCL_data_D-ORCL_I-1569825744_TS-USERS_FNO-4_4gv389kh_FULL_database_20200620.bk <-- IMAGE COPY 방식의 백업본 -rw-r--r-- 1 oracle dba 7143 Jun 10 18:06 rman_202006201806.log |
rman 접속 및 백업 리스트 확인
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | $ rman target / Recovery Manager: Release 19.0.0.0.0 - Production on Sat Jun 10 18:21:44 2020 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. connected to target database: ORCL (DBID=1569825744) RMAN> list backup; using target database control file instead of recovery catalog List of Backup Sets =================== BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 129 2.47M DISK 00:00:00 10-JUN-20 BP Key: 129 Status: EXPIRED Compressed: NO Tag: TAG20200620T175803 Piece Name: /app/oracle/rman/ORCL_45v388db_1_1_FULL_database_20200620.bk List of Archived Logs in backup set 129 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 85 1786792 10-JUN-20 1786812 10-JUN-20 1 86 1786812 10-JUN-20 1787188 10-JUN-20 1 87 1787188 10-JUN-20 1787191 10-JUN-20 1 88 1787191 10-JUN-20 1787194 10-JUN-20 1 89 1787194 10-JUN-20 1787243 10-JUN-20 1 90 1787243 10-JUN-20 1787256 10-JUN-20 1 91 1787256 10-JUN-20 1787276 10-JUN-20 1 92 1787276 10-JUN-20 1789197 10-JUN-20 1 93 1789197 10-JUN-20 1789211 10-JUN-20 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 130 Full 867.53M DISK 00:00:05 10-JUN-20 BP Key: 130 Status: EXPIRED Compressed: NO Tag: TAG20200620T175804 Piece Name: /app/oracle/rman/ORCL_46v388dc_1_1_FULL_database_20200620.bk |
rman 설정 값 확인
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | RMAN> show all; RMAN configuration parameters for database with db_unique_name ORCL are: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE BACKUP OPTIMIZATION OFF; # default CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE CONTROLFILE AUTOBACKUP ON; # default CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE MAXSETSIZE TO UNLIMITED; # default CONFIGURE ENCRYPTION FOR DATABASE OFF; # default CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/app/oracle/product/19c/dbs/snapcf_orcl.f'; # default |
show all 설정 값 설명
- CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
Backup 보관 주기나 backup본의 갯수를 설정함
- CONFIGURE BACKUP OPTIMIZATION OFF;
이미 backup 된 동일한(checkpoint SCN등) datafile, archived redolog, backup set이 있다면 skip함
- CONFIGURE DEFAULT DEVICE TYPE TO DISK;
default backup device를 설정함
- CONFIGURE CONTROLFILE AUTOBACKUP ON;
RMAN의 BACKUP이나 COPY 명령등의 수행후 자동으로 control file backup을 수행함
- CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F';
autobackup되는 control file의 기본 format을 변경함
- CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
특정 device에 automatic channel allocation 될때 channel의 갯수를 지정함
- CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
DATAFILE, CONTROL FILE의 backup set의 copy본 갯수를 지정함
- CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
ARCHIVELOG FILE의 backup set의 copy본 갯수를 지정함
- CONFIGURE MAXSETSIZE TO UNLIMITED;
backupset의 maximum size를 설정함
- CONFIGURE ENCRYPTION FOR DATABASE OFF;
모든 RMAN 백업이 암호화되도록 설정함
- CONFIGURE ENCRYPTION ALGORITHM 'AES128';
기본 백업 암호화 알고리즘을 AES 128 비트 암호화로 구성함
- CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ;
데이터 백업파일을 백업셋을 이용할 시 압축 방식을 지정함
- CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS;
RMAN 출력 로그 저장기간을 지정된 일 수로 구성함
- CONFIGURE ARCHIVELOG DELETION POLICY TO NONE;
flash recovery area의 archived redo log에 대한 삭제 여부를 설정함
- CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/app/oracle/product/19c/dbs/snapcf_orcl.f';
RMAN은 resync시 생성되는 임시 snapshot control file의 이름을 지정함
백업방법
백업 전 환경설정
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON; new RMAN configuration parameters: CONFIGURE CONTROLFILE AUTOBACKUP ON; new RMAN configuration parameters are successfully stored RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/app/oracle/rman/db_ctl_%F'; new RMAN configuration parameters: CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/app/oracle/rman/db_ctl_%F'; new RMAN configuration parameters are successfully stored RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/app/oracle/rman/%d_%U_%T.bk'; new RMAN configuration parameters: CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/app/oracle/rman/%d_%U_%T.bk'; new RMAN configuration parameters are successfully stored released channel: ORA_DISK_1 |
설정된 내용 확인
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | RMAN> show all; RMAN configuration parameters for database with db_unique_name ORCL are: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE BACKUP OPTIMIZATION OFF; # default CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/app/oracle/rman/db_ctl_%F'; CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/app/oracle/rman/%d_%U_%T.bk'; CONFIGURE MAXSETSIZE TO UNLIMITED; # default CONFIGURE ENCRYPTION FOR DATABASE OFF; # default CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/app/oracle/product/19c/dbs/snapcf_orcl.f'; # default |
rman 백업 (BACKUP SET 방식)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | RMAN> backup database; Starting backup at 10-JUL-20 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=71 device type=DISK channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00001 name=/app/oracle/oradata/ORCL/system01.dbf input datafile file number=00003 name=/app/oracle/oradata/ORCL/undotbs01.dbf input datafile file number=00002 name=/app/oracle/oradata/ORCL/sysaux01.dbf input datafile file number=00004 name=/app/oracle/oradata/ORCL/users01.dbf channel ORA_DISK_1: starting piece 1 at 10-JUL-20 channel ORA_DISK_1: finished piece 1 at 10-JUL-20 piece handle=/app/oracle/rman/ORCL_08v4vfou_1_1_20200710.bk tag=TAG20200710T164102 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07 Finished backup at 10-JUL-20 Starting Control File and SPFILE Autobackup at 10-JUL-20 piece handle=/app/oracle/rman/db_ctl_c-1572570942-20200710-02 comment=NONE Finished Control File and SPFILE Autobackup at 10-JUL-20 |
백업셋 방식의 경우 /app/oracle/rman/ORCL_08v4vfou_1_1_20200710.bk 라는 파일(백업셋)
안에 모든 데이터파일이 백업되어 있음
백업 확인 (BACKUP SET 방식)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | RMAN> list backup; List of Backup Sets =================== BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 4 Full 1.31G DISK 00:00:06 10-JUL-20 BP Key: 4 Status: AVAILABLE Compressed: NO Tag: TAG20200710T164102 Piece Name: /app/oracle/rman/ORCL_08v4vfou_1_1_20200710.bk List of Datafiles in backup set 4 File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name ---- -- ---- ---------- --------- ----------- ------ ---- 1 Full 2505458 10-JUL-20 NO /app/oracle/oradata/ORCL/system01.dbf 2 Full 2505458 10-JUL-20 NO /app/oracle/oradata/ORCL/sysaux01.dbf 3 Full 2505458 10-JUL-20 NO /app/oracle/oradata/ORCL/undotbs01.dbf 4 Full 2505458 10-JUL-20 NO /app/oracle/oradata/ORCL/users01.dbf BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 5 Full 10.20M DISK 00:00:00 10-JUL-20 BP Key: 5 Status: AVAILABLE Compressed: NO Tag: TAG20200710T164109 Piece Name: /app/oracle/rman/db_ctl_c-1572570942-20200710-02 SPFILE Included: Modification time: 10-JUL-20 SPFILE db_unique_name: ORCL Control File Included: Ckp SCN: 2505469 Ckp time: 10-JUL-20 |
백업 삭제 (BACKUP SET 방식)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | RMAN> delete backupset; using channel ORA_DISK_1 List of Backup Pieces BP Key BS Key Pc# Cp# Status Device Type Piece Name ------- ------- --- --- ----------- ----------- ---------- 4 4 1 1 AVAILABLE DISK /app/oracle/rman/ORCL_08v4vfou_1_1_20200710.bk 5 5 1 1 AVAILABLE DISK /app/oracle/rman/db_ctl_c-1572570942-20200710-02 6 6 1 1 AVAILABLE DISK /app/oracle/rman/db_ctl_c-1572570942-20200710-03 Do you really want to delete the above objects (enter YES or NO)? yes [YES 입력] deleted backup piece backup piece handle=/app/oracle/rman/ORCL_08v4vfou_1_1_20200710.bk RECID=4 STAMP=1045413662 deleted backup piece backup piece handle=/app/oracle/rman/db_ctl_c-1572570942-20200710-02 RECID=5 STAMP=1045413669 deleted backup piece backup piece handle=/app/oracle/rman/db_ctl_c-1572570942-20200710-03 RECID=6 STAMP=1045413776 Deleted 3 objects |
rman 백업 (COPY 방식)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | RMAN> backup as copy database; Starting backup at 10-JUL-20 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile copy input datafile file number=00001 name=/app/oracle/oradata/ORCL/system01.dbf output file name=/app/oracle/rman/ORCL_data_D-ORCL_I-1572570942_TS-SYSTEM_FNO-1_0iv4vg5m_20200710.bk tag=TAG20200710T164750 RECID=12 STAMP=1045414074 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07 channel ORA_DISK_1: starting datafile copy input datafile file number=00003 name=/app/oracle/oradata/ORCL/undotbs01.dbf output file name=/app/oracle/rman/ORCL_data_D-ORCL_I-1572570942_TS-UNDOTBS1_FNO-3_0jv4vg5t_20200710.bk tag=TAG20200710T164750 RECID=13 STAMP=1045414081 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07 channel ORA_DISK_1: starting datafile copy input datafile file number=00002 name=/app/oracle/oradata/ORCL/sysaux01.dbf output file name=/app/oracle/rman/ORCL_data_D-ORCL_I-1572570942_TS-SYSAUX_FNO-2_0kv4vg64_20200710.bk tag=TAG20200710T164750 RECID=14 STAMP=1045414086 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03 channel ORA_DISK_1: starting datafile copy input datafile file number=00004 name=/app/oracle/oradata/ORCL/users01.dbf output file name=/app/oracle/rman/ORCL_data_D-ORCL_I-1572570942_TS-USERS_FNO-4_0lv4vg67_20200710.bk tag=TAG20200710T164750 RECID=15 STAMP=1045414087 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01 Finished backup at 10-JUL-20 Starting Control File and SPFILE Autobackup at 10-JUL-20 piece handle=/app/oracle/rman/db_ctl_c-1572570942-20200710-04 comment=NONE Finished Control File and SPFILE Autobackup at 10-JUL-20 |
카피 방식의 경우 데이터파일을 개별적으로 복제백업함(COPY)
/app/oracle/oradata/ORCL/system01.dbf 데이터파일의 경우
/app/oracle/rman/ORCL_data_D-ORCL_I-1572570942_TS-SYSTEM_FNO-1_0iv4vg5m_20200710.bk 라는 이름으로
백업됨
백업 확인 (COPY 방식)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | RMAN> list copy; specification does not match any control file copy in the repository specification does not match any archived log in the repository List of Datafile Copies ======================= Key File S Completion Time Ckp SCN Ckp Time Sparse ------- ---- - --------------- ---------- --------------- ------ 12 1 A 10-JUL-20 2511796 10-JUL-20 NO Name: /app/oracle/rman/ORCL_data_D-ORCL_I-1572570942_TS-SYSTEM_FNO-1_0iv4vg5m_20200710.bk Tag: TAG20200710T164750 14 2 A 10-JUL-20 2511802 10-JUL-20 NO Name: /app/oracle/rman/ORCL_data_D-ORCL_I-1572570942_TS-SYSAUX_FNO-2_0kv4vg64_20200710.bk Tag: TAG20200710T164750 13 3 A 10-JUL-20 2511799 10-JUL-20 NO Name: /app/oracle/rman/ORCL_data_D-ORCL_I-1572570942_TS-UNDOTBS1_FNO-3_0jv4vg5t_20200710.bk Tag: TAG20200710T164750 15 4 A 10-JUL-20 2511814 10-JUL-20 NO Name: /app/oracle/rman/ORCL_data_D-ORCL_I-1572570942_TS-USERS_FNO-4_0lv4vg67_20200710.bk Tag: TAG20200710T164750 |
백업 삭제 (COPY 방식)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | RMAN> delete copy; released channel: ORA_DISK_1 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=71 device type=DISK specification does not match any control file copy in the repository specification does not match any archived log in the repository List of Datafile Copies ======================= Key File S Completion Time Ckp SCN Ckp Time Sparse ------- ---- - --------------- ---------- --------------- ------ 12 1 A 10-JUL-20 2511796 10-JUL-20 NO Name: /app/oracle/rman/ORCL_data_D-ORCL_I-1572570942_TS-SYSTEM_FNO-1_0iv4vg5m_20200710.bk Tag: TAG20200710T164750 14 2 A 10-JUL-20 2511802 10-JUL-20 NO Name: /app/oracle/rman/ORCL_data_D-ORCL_I-1572570942_TS-SYSAUX_FNO-2_0kv4vg64_20200710.bk Tag: TAG20200710T164750 13 3 A 10-JUL-20 2511799 10-JUL-20 NO Name: /app/oracle/rman/ORCL_data_D-ORCL_I-1572570942_TS-UNDOTBS1_FNO-3_0jv4vg5t_20200710.bk Tag: TAG20200710T164750 15 4 A 10-JUL-20 2511814 10-JUL-20 NO Name: /app/oracle/rman/ORCL_data_D-ORCL_I-1572570942_TS-USERS_FNO-4_0lv4vg67_20200710.bk Tag: TAG20200710T164750 Do you really want to delete the above objects (enter YES or NO)? yes deleted datafile copy datafile copy file name=/app/oracle/rman/ORCL_data_D-ORCL_I-1572570942_TS-SYSTEM_FNO-1_0iv4vg5m_20200710.bk RECID=12 STAMP=1045414074 deleted datafile copy datafile copy file name=/app/oracle/rman/ORCL_data_D-ORCL_I-1572570942_TS-SYSAUX_FNO-2_0kv4vg64_20200710.bk RECID=14 STAMP=1045414086 deleted datafile copy datafile copy file name=/app/oracle/rman/ORCL_data_D-ORCL_I-1572570942_TS-UNDOTBS1_FNO-3_0jv4vg5t_20200710.bk RECID=13 STAMP=1045414081 deleted datafile copy datafile copy file name=/app/oracle/rman/ORCL_data_D-ORCL_I-1572570942_TS-USERS_FNO-4_0lv4vg67_20200710.bk RECID=15 STAMP=1045414087 Deleted 4 objects |
손상된 블록 감지
VALIDATE DATABASE 명령을 이용하면 물리적으로 손상된 데이터베이스 블록을 쉽게 확인할 수 있음
손상된 블록이 감지되는 경우, 그 정보는 Automatic Diagnostic Repository에 저장됨
참고 : 오라클 ADRCI 정의 및 사용법 ( https://positivemh.tistory.com/544 )
데이터베이스, 테이블스페이스, 데이터파일, 블록, 아카이브로그, spfile, 컨트롤파일 단위로 명령을 수행할 수 있음
validate 명령 실행(database)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | RMAN> validate database; Starting validate at 10-JUL-20 using channel ORA_DISK_1 channel ORA_DISK_1: starting validation of datafile channel ORA_DISK_1: specifying datafile(s) for validation input datafile file number=00001 name=/app/oracle/oradata/ORCL/system01.dbf input datafile file number=00003 name=/app/oracle/oradata/ORCL/undotbs01.dbf input datafile file number=00002 name=/app/oracle/oradata/ORCL/sysaux01.dbf input datafile file number=00004 name=/app/oracle/oradata/ORCL/users01.dbf channel ORA_DISK_1: validation complete, elapsed time: 00:00:07 List of Datafiles ================= File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 1 OK 0 18294 136960 2512812 File Name: /app/oracle/oradata/ORCL/system01.dbf Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 100680 Index 0 12769 Other 0 5217 File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 2 OK 0 21780 70400 2512760 File Name: /app/oracle/oradata/ORCL/sysaux01.dbf Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 7414 Index 0 5113 Other 0 36093 File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 3 OK 0 2992 118400 2512812 File Name: /app/oracle/oradata/ORCL/undotbs01.dbf Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 0 Index 0 0 Other 0 115408 File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 4 OK 0 333 640 1060405 File Name: /app/oracle/oradata/ORCL/users01.dbf Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 70 Index 0 17 Other 0 220 channel ORA_DISK_1: starting validation of datafile channel ORA_DISK_1: specifying datafile(s) for validation including current control file for validation including current SPFILE in backup set channel ORA_DISK_1: validation complete, elapsed time: 00:00:01 List of Control File and SPFILE =============================== File Type Status Blocks Failing Blocks Examined ------------ ------ -------------- --------------- SPFILE OK 0 2 Control File OK 0 646 Finished validate at 10-JUL-20 |
문제가 발견된 경우 Block Failing 에 0이 아닌 숫자가 나옴
validate 명령 실행(tablespace)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | RMAN> validate tablespace users; Starting validate at 10-JUL-20 using channel ORA_DISK_1 channel ORA_DISK_1: starting validation of datafile channel ORA_DISK_1: specifying datafile(s) for validation input datafile file number=00004 name=/app/oracle/oradata/ORCL/users01.dbf channel ORA_DISK_1: validation complete, elapsed time: 00:00:01 List of Datafiles ================= File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 4 OK 0 333 640 1060405 File Name: /app/oracle/oradata/ORCL/users01.dbf Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 70 Index 0 17 Other 0 220 Finished validate at 10-JUL-20 |
validate 명령 실행(datafile)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | RMAN> validate datafile 1; Starting validate at 10-JUL-20 using channel ORA_DISK_1 channel ORA_DISK_1: starting validation of datafile channel ORA_DISK_1: specifying datafile(s) for validation input datafile file number=00001 name=/app/oracle/oradata/ORCL/system01.dbf channel ORA_DISK_1: validation complete, elapsed time: 00:00:03 List of Datafiles ================= File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 1 OK 0 18294 136960 2512812 File Name: /app/oracle/oradata/ORCL/system01.dbf Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 100680 Index 0 12769 Other 0 5217 channel ORA_DISK_1: starting validation of datafile channel ORA_DISK_1: specifying datafile(s) for validation including current control file for validation including current SPFILE in backup set channel ORA_DISK_1: validation complete, elapsed time: 00:00:01 List of Control File and SPFILE =============================== File Type Status Blocks Failing Blocks Examined ------------ ------ -------------- --------------- SPFILE OK 0 2 Control File OK 0 646 Finished validate at 10-JUL-20 |
validate 명령 실행(block)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | RMAN> validate datafile 1 block 10; Starting validate at 10-JUL-20 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=65 device type=DISK channel ORA_DISK_1: starting validation of datafile channel ORA_DISK_1: specifying datafile(s) for validation input datafile file number=00001 name=/app/oracle/oradata/ORCL/system01.dbf channel ORA_DISK_1: validation complete, elapsed time: 00:00:01 List of Datafiles ================= File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 1 OK 0 0 1 11 File Name: /app/oracle/oradata/ORCL/system01.dbf Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 0 Index 0 0 Other 0 1 Finished validate at 10-JUL-20 |
validate 명령 실행(archive log)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | RMAN> validate archivelog all; Starting validate at 10-JUL-20 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=83 device type=DISK channel ORA_DISK_1: starting validation of archived log channel ORA_DISK_1: specifying archived log(s) for validation input archived log thread=1 sequence=38 RECID=1 STAMP=1045414935 input archived log thread=1 sequence=39 RECID=2 STAMP=1045414935 input archived log thread=1 sequence=40 RECID=3 STAMP=1045414937 channel ORA_DISK_1: validation complete, elapsed time: 00:00:01 List of Archived Logs ===================== Thrd Seq Status Blocks Failing Blocks Examined Name ---- ------- ------ -------------- --------------- --------------- 1 38 OK 0 44453 /app/oracle/arch/1381044790206.arc 1 39 OK 0 1 /app/oracle/arch/1391044790206.arc 1 40 OK 0 2 /app/oracle/arch/1401044790206.arc Finished validate at 10-JUL-20 |
validate 명령 실행(spfile)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | RMAN> validate spfile; Starting validate at 10-JUL-20 using channel ORA_DISK_1 channel ORA_DISK_1: starting validation of datafile channel ORA_DISK_1: specifying datafile(s) for validation including current SPFILE in backup set channel ORA_DISK_1: validation complete, elapsed time: 00:00:00 List of Control File and SPFILE =============================== File Type Status Blocks Failing Blocks Examined ------------ ------ -------------- --------------- SPFILE OK 0 2 Finished validate at 10-JUL-20 |
validate 명령 실행(current controlfile)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | RMAN> validate current controlfile; Starting validate at 10-JUL-20 using channel ORA_DISK_1 channel ORA_DISK_1: starting validation of datafile channel ORA_DISK_1: specifying datafile(s) for validation including current control file for validation channel ORA_DISK_1: validation complete, elapsed time: 00:00:01 List of Control File and SPFILE =============================== File Type Status Blocks Failing Blocks Examined ------------ ------ -------------- --------------- Control File OK 0 646 Finished validate at 10-JUL-20 |
validate 명령 실행(controlfile copy)
backup as copy current controlfile; 명령 또는 alter database backup controlfile to ... 명령으로 나온 파일검증 가능
backup as copy current controlfile 명령 수행시
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | RMAN> backup as copy current controlfile; Starting backup at 10-JUL-20 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile copy copying current control file output file name=/app/oracle/rman/ORCL_cf_D-ORCL_id-1572570942_19v4vht6_20200710.bk tag=TAG20200710T171726 RECID=20 STAMP=1045415846 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01 Finished backup at 10-JUL-20 Starting Control File and SPFILE Autobackup at 10-JUL-20 piece handle=/app/oracle/rman/db_ctl_c-1572570942-20200710-07 comment=NONE Finished Control File and SPFILE Autobackup at 10-JUL-20 RMAN> validate controlfilecopy all; Starting validate at 10-JUL-20 using channel ORA_DISK_1 channel ORA_DISK_1: starting validation of datafile channel ORA_DISK_1: specifying datafile(s) for validation input control file copy name=/app/oracle/rman/ORCL_cf_D-ORCL_id-1572570942_19v4vht6_20200710.bk channel ORA_DISK_1: validation complete, elapsed time: 00:00:01 List of Datafile Copies ======================= File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 0 OK 0 0 646 0 File Name: /app/oracle/rman/ORCL_cf_D-ORCL_id-1572570942_19v4vht6_20200710.bk Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 0 Index 0 0 Other 0 646 Finished validate at 10-JUL-20 |
validate 명령 실행(controlfile copy)
alter database backup controlfile to 수행시
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | SQL> alter database backup controlfile to '/home/oracle/control_back.ctl'; Database altered. RMAN> validate controlfilecopy '/home/oracle/control_back.ctl'; Starting validate at 10-JUL-20 using channel ORA_DISK_1 channel ORA_DISK_1: starting validation of datafile channel ORA_DISK_1: specifying datafile(s) for validation input control file copy name=/home/oracle/control_back.ctl channel ORA_DISK_1: validation complete, elapsed time: 00:00:01 List of Datafile Copies ======================= File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 0 OK 0 0 646 0 File Name: /home/oracle/control_back.ctl Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 0 Index 0 0 Other 0 646 Finished validate at 10-JUL-20 |
validate 명령 실행(recover ared)
1 2 3 4 5 6 7 8 9 | RMAN> validate recovery area; Starting validate at 10-JUL-20 using channel ORA_DISK_1 specification does not match any archived log in the repository specification does not match any datafile copy in the repository specification does not match any backup set in the repository validate cancelled because there are no files to validate Finished validate at 10-JUL-20 |
현재 fra 설정안되어있어서 나오지 않음
백업 스크립트
백업 스크립트
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | $ cat /home/oracle/rman_backup.sh #!/bin/bash # 20200610_positivemh.tistory.com # rman_backup.sh # Oracle rman backup #=================================================================== # Oracle Environment Setting: #=================================================================== umask 022 export ORACLE_SID=orcl export ORACLE_BASE=/app/oracle; export ORACLE_HOME=$ORACLE_BASE/product/19c; export TNS_ADMIN=$ORACLE_HOME/network/admin #=================================================================== # PATH Setting: #=================================================================== export PATH=$ORACLE_HOME/bin:/usr/bin:/usr/local/bin:/usr/sbin:/bin export LD_LIBRARY_PATH=$ORACLE_HOME/rdbms/lib:$ORACLE_HOME/lib export BKDIR=/app/oracle/rman export BKDIROLD=/app/oracle/rman_old mkdir -p /app/oracle/rman mkdir -p /app/oracle/rman_old export date=`date '+%Y%m%d%H%M'` mv $BKDIR/rman*.log $BKDIROLD/ echo "Rman Backup Start Time : `date` ------------------------ Start" echo "Rman Backup Start Time : `date` ------------------------ Start " >> $BKDIR/rman_$date.log rman target / << EOF >> $BKDIR/rman_$date.log run { CONFIGURE RETENTION POLICY TO REDUNDANCY 1; CONFIGURE MAXSETSIZE TO UNLIMITED; CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '$BKDIR/%d_%U_FULL_database_%T.bk'; CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '$BKDIR/db_ctl_%F'; CROSSCHECK ARCHIVELOG ALL; DELETE NOPROMPT EXPIRED ARCHIVELOG ALL; BACKUP AS BACKUPSET database PLUS ARCHIVELOG; CROSSCHECK BACKUP; DELETE NOPROMPT BACKUPSET COMPLETED BEFORE 'SYSDATE-7'; DELETE NOPROMPT ARCHIVELOG UNTIL TIME 'SYSDATE-8'; } quit; EOF echo "Rman Backup End Time : `date` ------------------------ End " echo "Rman Backup End Time : `date` ------------------------ End " >> $BKDIR/rman_$date.log |
쉘 스크립트 설명
6~25번 째 줄 : 환경설정
27번 째 줄 : 이전에 백업시 발생한 로그파일 rman_old 경로로 백업
29~30번 째 줄 : 백업 로그 파일에 시작 시간 기록
32번 째 줄 : rman 시작
34~47번 째 줄 : rman 스크립트
36~40번 째 줄 : rman 환경설정
41번 째 줄 : 아카이브로그 크로스 체크(로컬에 저장된 아카이브 파일과 rman에서 보이는 정보 크로스 체크)
42번 째 줄 : (크로스 체크로 확인된)로컬에서 삭제된 아카이브로그 rman에서도 안보이게끔 삭제(만료된 아카이브파일)
43번 째 줄 : 데이터베이스 전체(데이터파일,컨트롤파일,spfile)와 아카이브로그를 backupset 방식으로 백업함
[PLUS ARCHIVELOG 구문이 수행하는 내용]
1. ALTER SYSTEM ARCHIVE LOG CURRENT 명령 실행
2. BACKUP ARCHIVELOG ALL 명령을 실행, 백업 최적화(BACKUP OPTIMIZATION)가 활성화 된 경우 아직 백업되지 않은 로그 만 백업함
3. BACKUP 명령에 지정된 파일을 백업함
4. ALTER SYSTEM ARCHIVE LOG CURRENT 명령을 실행함
5. 백업 중에 생성 된 로그를 포함하여 나머지 아카이브 된 로그를 백업함
44번 째 줄 : rman 백업본 크로스 체크
45번 째 줄 : 7일 지난 백업셋 삭제
46번 째 줄 : 8일 지난 아카이브 로그 삭제
53~54번 째 줄 : 백업 로그 파일에 종료 시간 기록
* NOPROMPT 옵션 : 42번 쨰 줄, 46~47번 째 줄에 있는 NOPROMPT 옵션은 DELETE 시 yes, no를 물어보지 않고 yes로 실행되게끔 하는 옵션임
실행 권한 부여
1 2 3 | $ chmod u+x /home/oracle/rman_backup.sh $ ls -al rman_backup.sh -rwxr--r-- 1 oracle dba 1910 Jun 10 18:00 rman_backup.sh |
crontab 등록
매일 새벽 4시 0분에 백업이 실행되게끔 설정
1 2 | $ crontab -e 0 4 * * * /home/oracle/rman_backup.sh |
테스트로 백업스크립트 실행
1 2 3 4 | $ sh /home/oracle/rman_backup.sh mv: cannot stat ??/app/oracle/rman/rman*.log??: No such file or directory Rman Backup Start Time : Wed Jun 10 19:37:50 KST 2020 ------------------------ Start Rman Backup End Time : Wed Jun 10 19:38:08 KST 2020 ------------------------ End |
백업 로그 확인
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | $ cat /app/oracle/rman/rman_202006101937.log Rman Backup Start Time : Wed Jun 10 19:37:50 KST 2020 ------------------------ Start Recovery Manager: Release 19.0.0.0.0 - Production on Wed Jun 10 19:37:50 2020 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. connected to target database: ORCL (DBID=1569825744) RMAN> RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> using target database control file instead of recovery catalog old RMAN configuration parameters: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; new RMAN configuration parameters: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; new RMAN configuration parameters are successfully stored old RMAN configuration parameters: CONFIGURE MAXSETSIZE TO UNLIMITED; new RMAN configuration parameters: CONFIGURE MAXSETSIZE TO UNLIMITED; new RMAN configuration parameters are successfully stored old RMAN configuration parameters: CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/app/oracle/rman/%d_%U_FULL_database_%T.bk'; new RMAN configuration parameters: CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/app/oracle/rman/%d_%U_FULL_database_%T.bk'; new RMAN configuration parameters are successfully stored old RMAN configuration parameters: CONFIGURE CONTROLFILE AUTOBACKUP ON; new RMAN configuration parameters: CONFIGURE CONTROLFILE AUTOBACKUP ON; new RMAN configuration parameters are successfully stored old RMAN configuration parameters: CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/app/oracle/rman/db_ctl_%F'; new RMAN configuration parameters: CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/app/oracle/rman/db_ctl_%F'; new RMAN configuration parameters are successfully stored allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=59 device type=DISK validation failed for archived log archived log file name=/app/oracle/arch/11131042045008.arc RECID=91 STAMP=1042745546 validation failed for archived log archived log file name=/app/oracle/arch/11141042045008.arc RECID=92 STAMP=1042745547 validation failed for archived log archived log file name=/app/oracle/arch/11151042045008.arc RECID=93 STAMP=1042745548 validation failed for archived log archived log file name=/app/oracle/arch/11161042045008.arc RECID=94 STAMP=1042745555 validation failed for archived log archived log file name=/app/oracle/arch/11171042045008.arc RECID=95 STAMP=1042745563 validation failed for archived log archived log file name=/app/oracle/arch/11181042045008.arc RECID=96 STAMP=1042745653 validation failed for archived log archived log file name=/app/oracle/arch/11191042045008.arc RECID=97 STAMP=1042745695 validation failed for archived log archived log file name=/app/oracle/arch/11201042045008.arc RECID=98 STAMP=1042745703 validation succeeded for archived log archived log file name=/app/oracle/arch/11211042045008.arc RECID=99 STAMP=1042745864 validation succeeded for archived log archived log file name=/app/oracle/arch/11221042045008.arc RECID=100 STAMP=1042745864 validation succeeded for archived log archived log file name=/app/oracle/arch/11231042045008.arc RECID=101 STAMP=1042745867 Crosschecked 11 objects released channel: ORA_DISK_1 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=59 device type=DISK List of Archived Log Copies for database with db_unique_name ORCL ===================================================================== Key Thrd Seq S Low Time ------- ---- ------- - --------- 91 1 113 X 10-JUN-20 Name: /app/oracle/arch/11131042045008.arc 92 1 114 X 10-JUN-20 Name: /app/oracle/arch/11141042045008.arc 93 1 115 X 10-JUN-20 Name: /app/oracle/arch/11151042045008.arc 94 1 116 X 10-JUN-20 Name: /app/oracle/arch/11161042045008.arc 95 1 117 X 10-JUN-20 Name: /app/oracle/arch/11171042045008.arc 96 1 118 X 10-JUN-20 Name: /app/oracle/arch/11181042045008.arc 97 1 119 X 10-JUN-20 Name: /app/oracle/arch/11191042045008.arc 98 1 120 X 10-JUN-20 Name: /app/oracle/arch/11201042045008.arc deleted archived log archived log file name=/app/oracle/arch/11131042045008.arc RECID=91 STAMP=1042745546 deleted archived log archived log file name=/app/oracle/arch/11141042045008.arc RECID=92 STAMP=1042745547 deleted archived log archived log file name=/app/oracle/arch/11151042045008.arc RECID=93 STAMP=1042745548 deleted archived log archived log file name=/app/oracle/arch/11161042045008.arc RECID=94 STAMP=1042745555 deleted archived log archived log file name=/app/oracle/arch/11171042045008.arc RECID=95 STAMP=1042745563 deleted archived log archived log file name=/app/oracle/arch/11181042045008.arc RECID=96 STAMP=1042745653 deleted archived log archived log file name=/app/oracle/arch/11191042045008.arc RECID=97 STAMP=1042745695 deleted archived log archived log file name=/app/oracle/arch/11201042045008.arc RECID=98 STAMP=1042745703 Deleted 8 EXPIRED objects Starting backup at 10-JUN-20 current log archived using channel ORA_DISK_1 channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=121 RECID=99 STAMP=1042745864 input archived log thread=1 sequence=122 RECID=100 STAMP=1042745864 input archived log thread=1 sequence=123 RECID=101 STAMP=1042745867 input archived log thread=1 sequence=124 RECID=102 STAMP=1042745877 channel ORA_DISK_1: starting piece 1 at 10-JUN-20 channel ORA_DISK_1: finished piece 1 at 10-JUN-20 piece handle=/app/oracle/rman/ORCL_54v2e2gl_1_1_FULL_database_20200610.bk tag=TAG20200610T193757 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 10-JUN-20 Starting backup at 10-JUN-20 using channel ORA_DISK_1 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00001 name=/app/oracle/oradata/ORCL/system01.dbf input datafile file number=00003 name=/app/oracle/oradata/ORCL/undotbs01.dbf input datafile file number=00002 name=/app/oracle/oradata/ORCL/sysaux01.dbf input datafile file number=00004 name=/app/oracle/oradata/ORCL/users01.dbf channel ORA_DISK_1: starting piece 1 at 10-JUN-20 channel ORA_DISK_1: finished piece 1 at 10-JUN-20 piece handle=/app/oracle/rman/ORCL_55v2e2gm_1_1_FULL_database_20200610.bk tag=TAG20200610T193758 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07 Finished backup at 10-JUN-20 Starting backup at 10-JUN-20 current log archived using channel ORA_DISK_1 channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=125 RECID=103 STAMP=1042745885 channel ORA_DISK_1: starting piece 1 at 10-JUN-20 channel ORA_DISK_1: finished piece 1 at 10-JUN-20 piece handle=/app/oracle/rman/ORCL_56v2e2gu_1_1_FULL_database_20200610.bk tag=TAG20200610T193805 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 10-JUN-20 Starting Control File and SPFILE Autobackup at 10-JUN-20 piece handle=/app/oracle/rman/db_ctl_c-1569825744-20200610-03 comment=NONE Finished Control File and SPFILE Autobackup at 10-JUN-20 using channel ORA_DISK_1 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/app/oracle/rman/ORCL_54v2e2gl_1_1_FULL_database_20200610.bk RECID=155 STAMP=1042745877 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/app/oracle/rman/ORCL_55v2e2gm_1_1_FULL_database_20200610.bk RECID=156 STAMP=1042745878 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/app/oracle/rman/ORCL_56v2e2gu_1_1_FULL_database_20200610.bk RECID=157 STAMP=1042745886 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/app/oracle/rman/db_ctl_c-1569825744-20200610-03 RECID=158 STAMP=1042745887 Crosschecked 4 objects using channel ORA_DISK_1 specification does not match any backup in the repository released channel: ORA_DISK_1 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=59 device type=DISK specification does not match any archived log in the repository RMAN> RMAN> Recovery Manager complete. Rman Backup End Time : Wed Jun 10 19:38:08 KST 2020 ------------------------ End |
로그 설명
2번 째 줄 : 백업 로그 파일에 시작 시간 기록
4번 째 줄 : rman 시작
11~42번 째 줄 : rman 환경설정
44~68번 째 줄 : 아카이브로그 크로스 체크(로컬에 저장된 아카이브 파일과 rman에서 보이는 정보 크로스 체크)
71~119번 째 줄 : (크로스 체크로 확인된)로컬에서 삭제된 아카이브로그 rman에서도 안보이게끔 삭제(만료된 아카이브파일)
123~166번 째 줄 : 데이터베이스 전체(데이터파일,컨트롤파일,spfile)와 아카이브로그를 backupset 방식으로 백업함
123~136번 째 줄 : 아카이브로그를 백업파일로 만듬
138~150번 째 줄 : 데이터베이스(데이터파일)를 백업파일로 만듬
152~162번 째 줄 : ALTER SYSTEM ARCHIVE LOG CURRENT 명령을 실행 한 뒤 백업 중에 생성 된 로그를 포함하여 나머지 아카이브 로그를 백업파일로 만듬
164~166번 째 줄 : 컨트롤 파일과 spfile을 백업파일로 만듬
168~177번 째 줄 : rman 백업본 크로스 체크
180~181번 째 줄 : 7일 지난 백업셋 삭제
현재 해당하는 파일이 없어서 specification does not match any backup in the repository 로 표시됨
183~186번 째 줄 : 8일 지난 아카이브 로그 삭제
현재 해당파는 파일이 없어서 specification does not match any archived log in the repository 로 표시됨
191~192번 째 줄 : 백업 로그 파일에 종료 시간 기록
DB종료 후 OS에서 날짜를 10일 뒤로 변경 후 다시 스크립트 실행
현재 : 20년06월10일
변경 : 20년06월20일
확인
1 2 | $ date Sat Jun 20 19:45:02 KST 2020 |
DB 기동 후 백업스크립트 실행
1 2 3 4 | $ sh /home/oracle/rman_backup.sh mv: cannot stat ??/app/oracle/rman/rman*.log??: No such file or directory Rman Backup Start Time : Sat Jun 20 19:46:31 KST 2020 ------------------------ Start Rman Backup End Time : Sat Jun 20 19:46:45 KST 2020 ------------------------ End |
백업 로그 확인
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | $ cat rman_202006201946.log Rman Backup Start Time : Sat Jun 20 19:46:31 KST 2020 ------------------------ Start Recovery Manager: Release 19.0.0.0.0 - Production on Sat Jun 20 19:46:31 2020 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. connected to target database: ORCL (DBID=1569825744) RMAN> RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> using target database control file instead of recovery catalog old RMAN configuration parameters: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; new RMAN configuration parameters: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; new RMAN configuration parameters are successfully stored old RMAN configuration parameters: CONFIGURE MAXSETSIZE TO UNLIMITED; new RMAN configuration parameters: CONFIGURE MAXSETSIZE TO UNLIMITED; new RMAN configuration parameters are successfully stored old RMAN configuration parameters: CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/app/oracle/rman/%d_%U_FULL_database_%T.bk'; new RMAN configuration parameters: CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/app/oracle/rman/%d_%U_FULL_database_%T.bk'; new RMAN configuration parameters are successfully stored old RMAN configuration parameters: CONFIGURE CONTROLFILE AUTOBACKUP ON; new RMAN configuration parameters: CONFIGURE CONTROLFILE AUTOBACKUP ON; new RMAN configuration parameters are successfully stored old RMAN configuration parameters: CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/app/oracle/rman/db_ctl_%F'; new RMAN configuration parameters: CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/app/oracle/rman/db_ctl_%F'; new RMAN configuration parameters are successfully stored allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=74 device type=DISK validation succeeded for archived log archived log file name=/app/oracle/arch/11211042045008.arc RECID=99 STAMP=1042745864 validation succeeded for archived log archived log file name=/app/oracle/arch/11221042045008.arc RECID=100 STAMP=1042745864 validation succeeded for archived log archived log file name=/app/oracle/arch/11231042045008.arc RECID=101 STAMP=1042745867 validation succeeded for archived log archived log file name=/app/oracle/arch/11241042045008.arc RECID=102 STAMP=1042745877 validation succeeded for archived log archived log file name=/app/oracle/arch/11251042045008.arc RECID=103 STAMP=1042745885 Crosschecked 5 objects released channel: ORA_DISK_1 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=74 device type=DISK specification does not match any archived log in the repository Starting backup at 20-JUN-20 current log archived using channel ORA_DISK_1 channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=121 RECID=99 STAMP=1042745864 input archived log thread=1 sequence=122 RECID=100 STAMP=1042745864 input archived log thread=1 sequence=123 RECID=101 STAMP=1042745867 input archived log thread=1 sequence=124 RECID=102 STAMP=1042745877 input archived log thread=1 sequence=125 RECID=103 STAMP=1042745885 input archived log thread=1 sequence=126 RECID=104 STAMP=1043610393 channel ORA_DISK_1: starting piece 1 at 20-JUN-20 channel ORA_DISK_1: finished piece 1 at 20-JUN-20 piece handle=/app/oracle/rman/ORCL_58v38eop_1_1_FULL_database_20200620.bk tag=TAG20200620T194633 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 20-JUN-20 Starting backup at 20-JUN-20 using channel ORA_DISK_1 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00001 name=/app/oracle/oradata/ORCL/system01.dbf input datafile file number=00003 name=/app/oracle/oradata/ORCL/undotbs01.dbf input datafile file number=00002 name=/app/oracle/oradata/ORCL/sysaux01.dbf input datafile file number=00004 name=/app/oracle/oradata/ORCL/users01.dbf channel ORA_DISK_1: starting piece 1 at 20-JUN-20 channel ORA_DISK_1: finished piece 1 at 20-JUN-20 piece handle=/app/oracle/rman/ORCL_59v38eor_1_1_FULL_database_20200620.bk tag=TAG20200620T194635 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07 Finished backup at 20-JUN-20 Starting backup at 20-JUN-20 current log archived using channel ORA_DISK_1 channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=127 RECID=105 STAMP=1043610402 channel ORA_DISK_1: starting piece 1 at 20-JUN-20 channel ORA_DISK_1: finished piece 1 at 20-JUN-20 piece handle=/app/oracle/rman/ORCL_5av38ep2_1_1_FULL_database_20200620.bk tag=TAG20200620T194642 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 20-JUN-20 Starting Control File and SPFILE Autobackup at 20-JUN-20 piece handle=/app/oracle/rman/db_ctl_c-1569825744-20200620-00 comment=NONE Finished Control File and SPFILE Autobackup at 20-JUN-20 using channel ORA_DISK_1 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/app/oracle/rman/ORCL_54v2e2gl_1_1_FULL_database_20200610.bk RECID=155 STAMP=1042745877 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/app/oracle/rman/ORCL_55v2e2gm_1_1_FULL_database_20200610.bk RECID=156 STAMP=1042745878 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/app/oracle/rman/ORCL_56v2e2gu_1_1_FULL_database_20200610.bk RECID=157 STAMP=1042745886 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/app/oracle/rman/db_ctl_c-1569825744-20200610-03 RECID=158 STAMP=1042745887 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/app/oracle/rman/ORCL_58v38eop_1_1_FULL_database_20200620.bk RECID=159 STAMP=1043610393 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/app/oracle/rman/ORCL_59v38eor_1_1_FULL_database_20200620.bk RECID=160 STAMP=1043610395 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/app/oracle/rman/ORCL_5av38ep2_1_1_FULL_database_20200620.bk RECID=161 STAMP=1043610402 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/app/oracle/rman/db_ctl_c-1569825744-20200620-00 RECID=162 STAMP=1043610403 Crosschecked 8 objects using channel ORA_DISK_1 List of Backup Pieces BP Key BS Key Pc# Cp# Status Device Type Piece Name ------- ------- --- --- ----------- ----------- ---------- 155 155 1 1 AVAILABLE DISK /app/oracle/rman/ORCL_54v2e2gl_1_1_FULL_database_20200610.bk 156 156 1 1 AVAILABLE DISK /app/oracle/rman/ORCL_55v2e2gm_1_1_FULL_database_20200610.bk 157 157 1 1 AVAILABLE DISK /app/oracle/rman/ORCL_56v2e2gu_1_1_FULL_database_20200610.bk 158 158 1 1 AVAILABLE DISK /app/oracle/rman/db_ctl_c-1569825744-20200610-03 deleted backup piece backup piece handle=/app/oracle/rman/ORCL_54v2e2gl_1_1_FULL_database_20200610.bk RECID=155 STAMP=1042745877 deleted backup piece backup piece handle=/app/oracle/rman/ORCL_55v2e2gm_1_1_FULL_database_20200610.bk RECID=156 STAMP=1042745878 deleted backup piece backup piece handle=/app/oracle/rman/ORCL_56v2e2gu_1_1_FULL_database_20200610.bk RECID=157 STAMP=1042745886 deleted backup piece backup piece handle=/app/oracle/rman/db_ctl_c-1569825744-20200610-03 RECID=158 STAMP=1042745887 Deleted 4 objects released channel: ORA_DISK_1 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=74 device type=DISK List of Archived Log Copies for database with db_unique_name ORCL ===================================================================== Key Thrd Seq S Low Time ------- ---- ------- - --------- 99 1 121 A 10-JUN-20 Name: /app/oracle/arch/11211042045008.arc 100 1 122 A 10-JUN-20 Name: /app/oracle/arch/11221042045008.arc 101 1 123 A 10-JUN-20 Name: /app/oracle/arch/11231042045008.arc 102 1 124 A 10-JUN-20 Name: /app/oracle/arch/11241042045008.arc 103 1 125 A 10-JUN-20 Name: /app/oracle/arch/11251042045008.arc 104 1 126 A 10-JUN-20 Name: /app/oracle/arch/11261042045008.arc deleted archived log archived log file name=/app/oracle/arch/11211042045008.arc RECID=99 STAMP=1042745864 deleted archived log archived log file name=/app/oracle/arch/11221042045008.arc RECID=100 STAMP=1042745864 deleted archived log archived log file name=/app/oracle/arch/11231042045008.arc RECID=101 STAMP=1042745867 deleted archived log archived log file name=/app/oracle/arch/11241042045008.arc RECID=102 STAMP=1042745877 deleted archived log archived log file name=/app/oracle/arch/11251042045008.arc RECID=103 STAMP=1042745885 deleted archived log archived log file name=/app/oracle/arch/11261042045008.arc RECID=104 STAMP=1043610393 Deleted 6 objects RMAN> RMAN> Recovery Manager complete. Rman Backup End Time : Sat Jun 20 19:46:45 KST 2020 ------------------------ End |
로그 설명
2번 째 줄 : 백업 로그 파일에 시작 시간 기록
4번 째 줄 : rman 시작
11~42번 째 줄 : rman 환경설정
44~56번 째 줄 : 아카이브로그 크로스 체크(로컬에 저장된 아카이브 파일과 rman에서 보이는 정보 크로스 체크)
59~62번 째 줄 : (크로스 체크로 확인된)로컬에서 삭제된 아카이브로그 rman에서도 안보이게끔 삭제(만료된 아카이브파일)
현재 해당하는 파일이 없어서 specification does not match any archived log in the repository 로 표시됨
65~110번 째 줄 : 데이터베이스 전체(데이터파일,컨트롤파일,spfile)와 아카이브로그를 backupset 방식으로 백업함
65~80번 째 줄 : 아카이브로그를 백업파일로 만듬
82~94번 째 줄 : 데이터베이스(데이터파일)를 백업파일로 만듬
96~106번 째 줄 : ALTER SYSTEM ARCHIVE LOG CURRENT 명령을 실행 한 뒤 백업 중에 생성 된 로그를 포함하여 나머지 아카이브 로그를 백업파일로 만듬
108~110번 째 줄 : 컨트롤 파일과 spfile을 백업파일로 만듬
112~129번 째 줄 : rman 백업본 크로스 체크
132~149번 째 줄 : 7일 지난 백업셋 삭제
6월10일자 DB 및 아카이브 백업파일 3개와 컨트롤파일 백업파일 1개 총 4개가 삭제됨
152~190번 째 줄 : 8일 지난 아카이브 로그 삭제
6월10일에 생성된 Seq 121~126까지 아카이브 로그파일이 삭제됨
196~197번 째 줄 : 백업 로그 파일에 종료 시간 기록
rman 백업 스크립트가 정삭적으로 잘 동작함
백업된 목록 확인
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | $ rman target / Recovery Manager: Release 19.0.0.0.0 - Production on Sat Jun 20 19:57:04 2020 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. connected to target database: ORCL (DBID=1569825744) RMAN> list backup; using target database control file instead of recovery catalog List of Backup Sets =================== BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 159 1.78M DISK 00:00:00 20-JUN-20 BP Key: 159 Status: AVAILABLE Compressed: NO Tag: TAG20200620T194633 Piece Name: /app/oracle/rman/ORCL_58v38eop_1_1_FULL_database_20200620.bk List of Archived Logs in backup set 159 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 121 1794047 10-JUN-20 1794213 10-JUN-20 1 122 1794213 10-JUN-20 1794216 10-JUN-20 1 123 1794216 10-JUN-20 1794219 10-JUN-20 1 124 1794219 10-JUN-20 1794304 10-JUN-20 1 125 1794304 10-JUN-20 1794324 10-JUN-20 1 126 1794324 10-JUN-20 1795344 20-JUN-20 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 160 Full 867.98M DISK 00:00:04 20-JUN-20 BP Key: 160 Status: AVAILABLE Compressed: NO Tag: TAG20200620T194635 Piece Name: /app/oracle/rman/ORCL_59v38eor_1_1_FULL_database_20200620.bk List of Datafiles in backup set 160 File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name ---- -- ---- ---------- --------- ----------- ------ ---- 1 Full 1795356 20-JUN-20 NO /app/oracle/oradata/ORCL/system01.dbf 2 Full 1795356 20-JUN-20 NO /app/oracle/oradata/ORCL/sysaux01.dbf 3 Full 1795356 20-JUN-20 NO /app/oracle/oradata/ORCL/undotbs01.dbf 4 Full 1795356 20-JUN-20 NO /app/oracle/oradata/ORCL/users01.dbf BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 161 6.50K DISK 00:00:00 20-JUN-20 BP Key: 161 Status: AVAILABLE Compressed: NO Tag: TAG20200620T194642 Piece Name: /app/oracle/rman/ORCL_5av38ep2_1_1_FULL_database_20200620.bk List of Archived Logs in backup set 161 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 127 1795344 20-JUN-20 1795363 20-JUN-20 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 162 Full 10.77M DISK 00:00:00 20-JUN-20 BP Key: 162 Status: AVAILABLE Compressed: NO Tag: TAG20200620T194643 Piece Name: /app/oracle/rman/db_ctl_c-1569825744-20200620-00 SPFILE Included: Modification time: 20-JUN-20 SPFILE db_unique_name: ORCL Control File Included: Ckp SCN: 1795376 Ckp time: 20-JUN-20 |
참조 :
https://docs.oracle.com/en/database/oracle/oracle-database/19/rcmrf/index.htmlhttp://haisins.epac.to/wordpress/?p=3854
https://docs.oracle.com/database/121/RCMRF/rcmsynta009.htm#RCMRF113
https://sarc.io/index.php/oracledatabase/521-rman
http://www.juliandyke.com/Research/RMAN/BackupCommand.php
http://www.dbguide.net/db.db?cmd=view&boardUid=13942&boardConfigUid=9&boardIdx=97&boardStep=1
https://docs.oracle.com/html/E10643_07/rcmsynta2024.htm
'ORACLE > Backup&Recover' 카테고리의 다른 글
rman 백업 스크립트(Windows Server) (3) | 2020.07.26 |
---|---|
rman block corruption 복구 테스트 (0) | 2020.07.13 |
rac db(asm)에서 특정시점의 데이터를 single db(filesystem) 로 dbname 변경 후 복구 테스트2 (0) | 2020.02.28 |
rac db(asm)에서 특정시점의 데이터를 single db(filesystem) 로 dbname 변경 후 복구 테스트 (0) | 2020.02.24 |
오라클 rman에서 show all 정보와 list backup 정보는 어디있을까? (0) | 2020.02.24 |