본문 바로가기
Oracle/RMAN

[RMAN] 증분백업(Incremental backup)

by 취미툰 2019. 12. 11.
반응형

증분 백업이란 이전에 백업 받았던 백업파일과 비교하여 이전 백업 이후에 변경된 부분만 백업하는 방법입니다.

이 기능은 Enterprise 버전에서 지원이 됩니다.

 

증분 백업 개념

백업 시 설정했던 레벨의 숫자가 자기보다 작거나 같으면 그 시점부터 모든 데이터를 백업받는 것을 증분 백업이라고 합니다.

 

증분 백업에는 2가지 옵션이 존재 합니다.

 

Differential backup

최근 level 0, 1에서 backup이후 변경이 발생한 모든 block을 백업

Cumulative backup

최근 level 0에서 backup이후 변경이 발생한 모든 block을 백업

그림으로 표현한다면 다음과 같습니다.

 

Differential backup

Cumulative backup

 

증분백업 수행방법

 

(1)level 0으로 데이터베이스 전체 백업 받기

RMAN> run {

allocate channel c1 type disk;

allocate channel c2 type disk;

backup

incremental level 0

database

format '/home/oracle/rman/level0_%T_%U';

}

using target database control file instead of recovery catalog

allocated channel: c1

channel c1: SID=19 device type=DISK

 

allocated channel: c2

channel c2: SID=53 device type=DISK

 

Starting backup at 19/12/05

channel c1: starting incremental level 0 datafile backup set

channel c1: specifying datafile(s) in backup set

input datafile file number=00001 name=/oradata/ORCL19C/system01.dbf

input datafile file number=00004 name=/oradata/ORCL19C/undotbs01.dbf

channel c1: starting piece 1 at 19/12/05

channel c2: starting incremental level 0 datafile backup set

channel c2: specifying datafile(s) in backup set

input datafile file number=00003 name=/oradata/ORCL19C/sysaux01.dbf

input datafile file number=00007 name=/oradata/ORCL19C/users01.dbf

channel c2: starting piece 1 at 19/12/05

channel c1: finished piece 1 at 19/12/05

piece handle=/home/oracle/rman/level0_20191205_0ruili1k_1_1 tag=TAG20191205T112540 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:36

channel c2: finished piece 1 at 19/12/05

piece handle=/home/oracle/rman/level0_20191205_0suili1l_1_1 tag=TAG20191205T112540 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:35

Finished backup at 19/12/05

 

Starting Control File and SPFILE Autobackup at 19/12/05

piece handle=/u01/app/oracle/product/19.5.0/db_1/dbs/c-1490444115-20191205-08 comment=NONE

Finished Control File and SPFILE Autobackup at 19/12/05

released channel: c1

released channel: c2

 

$ls -al|grep level0

-rw-r-----.  1 oracle oinstall 838303744 12  5 11:25 level0_20191205_0ruili1k_1_1

-rw-r-----.  1 oracle oinstall 634454016 12  5 11:25 level0_20191205_0suili1l_1_1

 

(2)level 1 누적 증분 백업(cumulative) 받기

 

RMAN> run {

allocate channel c1 type disk;

allocate channel c2 type disk;

backup

incremental level 1 cumulative

database

format '/home/oracle/rman/level1cum_%T_%U';

}

using target database control file instead of recovery catalog

allocated channel: c1

channel c1: SID=37 device type=DISK

 

allocated channel: c2

channel c2: SID=276 device type=DISK

 

Starting backup at 19/12/05

channel c1: starting incremental level 1 datafile backup set

channel c1: specifying datafile(s) in backup set

input datafile file number=00001 name=/oradata/ORCL19C/system01.dbf

input datafile file number=00004 name=/oradata/ORCL19C/undotbs01.dbf

channel c1: starting piece 1 at 19/12/05

channel c2: starting incremental level 1 datafile backup set

channel c2: specifying datafile(s) in backup set

input datafile file number=00003 name=/oradata/ORCL19C/sysaux01.dbf

input datafile file number=00007 name=/oradata/ORCL19C/users01.dbf

channel c2: starting piece 1 at 19/12/05

channel c1: finished piece 1 at 19/12/05

piece handle=/home/oracle/rman/level1cum_20191205_0uuili7j_1_1 tag=TAG20191205T112850 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:01

channel c2: finished piece 1 at 19/12/05

piece handle=/home/oracle/rman/level1cum_20191205_0vuili7j_1_1 tag=TAG20191205T112850 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:01

Finished backup at 19/12/05

 

Starting Control File and SPFILE Autobackup at 19/12/05

piece handle=/u01/app/oracle/product/19.5.0/db_1/dbs/c-1490444115-20191205-09 comment=NONE

Finished Control File and SPFILE Autobackup at 19/12/05

released channel: c1

released channel: c2

 

$ls -al |grep level1

-rw-r-----.  1 oracle oinstall    376832 12  5 11:28 level1cum_20191205_0uuili7j_1_1

-rw-r-----.  1 oracle oinstall     73728 12  5 11:28 level1cum_20191205_0vuili7j_1_1

 

+Block change tracking 기능

 

변경된 데이터 블록만 추적하는 기능으로 변경된 블록의 정보를 특정 파일에 저장하여 관리합니다.

 

SQL*PLUS에 접속하여 Block change tracking 설정

$sqlplus / as sysdba

 

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Dec 5 11:32:26 2019

Version 19.5.0.0.0

 

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

 

Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.5.0.0.0

 

SQL> select * from v$block_change_tracking;

 

 

STATUS  FILENAME            BYTES     CON_ID

------------------------------------------

DISABLED

 

 

SQL> alter database enable block change tracking using file '/home/oracle/backup/block_tracking.dat';

 

Database altered.

 

 

SQL> select * from v$block_change_tracking;

 

STATUS  FILENAME                              BYTES CON_ID

------------------------------------------

ENABLED /home/oracle/backup/block_tracking.dat 11599872   0

반응형

댓글