OS 환경 : Oracle Linux 8.7 (64bit)
DB 환경 : Oracle Database 19.27.0.0
방법 : 오라클 19c bct(Block Change Tracking) 활성화 후 레벨0 증분백업 재수행시 bct 파일 확인 테스트
오라클 19c에서 bct(Block Change Tracking)기능을 활성화하면 레벨0 백업 후 이후 데이터의 변경내용이 bct file에 저장됨
만약 레벨0 백업을 하고 데이터가 쌓인뒤 한번 더 레벨0 백업을 수행하면 bct file이 어떻게 되는지 테스트를 진행해봄
참고 : Oracle Block change tracking 기능 ( https://positivemh.tistory.com/179 )
Block Change Tracking(BCT) 기능 설명
bct 기능은 증분 백업(incremental backup) 성능을 향상시키기 위해 변경된 블록 정보를 기록하는 기능임
db에서 발생하는 각 업데이트가 어떤 데이터 파일 블록에 영향을 주었는지 추적함
bct 기능이 활성화되어 있으면 rman은 데이터 파일 전체를 스캔하지 않고,
작은 비트맵 파일(block change tracking file) 을 읽어서 변경된 블록만 백업함
이로 인해 백업 시간이 단축되고 i/o 부하가 크게 감소함
기본값은 disable이고 증분 백업을 사용하는 환경에서는 활성화하는 것이 권장됨
bct 파일은 초기 설정 이후 별도의 유지보수가 필요하지 않음
standby db에서 bct를 활성화하려면 Oracle Active Data Guard 옵션 라이센스가 필요함
테스트
bct 기능 활성화
|
1
2
3
|
SQL> alter database enable block change tracking using file '/app/oracle/rman/block_tracking.txt';
Database altered.
|
샘플 테이블 생성
|
1
2
3
4
5
|
SQL>
create table tbl1 as select * from dba_objects;
insert into tbl1 select * from tbl1;
..반복해서 1gb까지 생성
commit;
|
샘플 테이블 크기 확인
|
1
2
3
4
5
|
SQL> select bytes/1024/1024 from dba_segments where segment_name ='TBL1';
BYTES/1024/1024
---------------
1152
|
로그스위치 5번, 체크포인트 5번 수행
|
1
2
3
4
5
6
7
8
9
10
11
|
SQL>
alter system switch logfile;
alter system switch logfile;
alter system switch logfile;
alter system switch logfile;
alter system switch logfile;
alter system checkpoint;
alter system checkpoint;
alter system checkpoint;
alter system checkpoint;
alter system checkpoint;
|
1차 풀백업
|
1
2
3
4
5
6
7
8
|
$ rman target /
RMAN> run {
allocate channel c1 type disk;
allocate channel c2 type disk;
backup incremental level 0 database format '/oraimsi/rman/level0_%T_%U';
release channel c1;
release channel c2;
}
|
bct 파일 크기 확인
|
1
2
3
4
|
$ cd /app/oracle/rman/
$ ll
total 11332
-rw-r----- 1 oracle oinstall 11600384 Nov 14 19:40 block_tracking.txt
|
내용 확인
|
1
2
3
4
|
$ strings block_tracking.txt > t1.txt
$ cat t1.txt
}|{z
EORA19DBF
|
추가 테이블 생성
|
1
2
3
|
SQL> create table tbl2 as select * from tbl1;
Table created.
|
1차 증분 백업
|
1
2
3
4
5
6
7
8
|
RMAN>
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
backup incremental level 1 database format '/oraimsi/rman/level1_%T_%U';
release channel c1;
release channel c2;
}
|
bct 파일 크기 확인
|
1
2
3
4
|
$ cd /app/oracle/rman/
$ ll
total 11332
-rw-r----- 1 oracle oinstall 11600384 Nov 14 19:55 block_tracking.txt
|
내용 확인
|
1
2
3
4
|
$ strings block_tracking.txt > t2.txt
$ cat t2.txt
}|{z
EORA19DBF
|
변화 없음
추가 테이블 생성
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
SQL>
create table tbl3 as select * from tbl1;
create table tbl4 as select * from tbl1 where rownum<=100;
create table tbl5 as select * from tbl1 where rownum<=100;
create table tbl6 as select * from tbl1 where rownum<=100;
create table tbl7 as select * from tbl1 where rownum<=100;
create table tbl8 as select * from tbl1 where rownum<=100;
create table tbl9 as select * from tbl1 where rownum<=100;
create table tbl10 as select * from tbl1 where rownum<=100;
create table tbl11 as select * from tbl1 where rownum<=100;
create table tbl12 as select * from tbl1 where rownum<=100;
create table tbl13 as select * from tbl1 where rownum<=100;
create table tbl14 as select * from tbl1 where rownum<=100;
create table tbl15 as select * from tbl1 where rownum<=100;
create table tbl16 as select * from tbl1 where rownum<=100;
create table tbl17 as select * from tbl1 where rownum<=100;
create table tbl18 as select * from tbl1 where rownum<=100;
create table tbl19 as select * from tbl1 where rownum<=100;
create table tbl20 as select * from tbl1 where rownum<=100;
create table tbl21 as select * from tbl1 where rownum<=100;
create table tbl22 as select * from tbl1 where rownum<=100;
create table tbl23 as select * from tbl1 where rownum<=100;
|
bct 파일 크기 확인
|
1
2
3
4
|
$ cd /app/oracle/rman/
$ ll
total 11332
-rw-r----- 1 oracle oinstall 11600384 Nov 14 19:56 block_tracking.txt
|
내용 확인
|
1
2
3
4
|
$ strings block_tracking.txt > t3.txt
$ cat t3.txt
}|{z
EORA19DBF
|
변화 없음
2차 증분 백업
|
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
|
RMAN>
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
backup incremental level 1 database format '/oraimsi/rman/level1_%T_%U';
release channel c1;
release channel c2;
}
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=268 device type=DISK
allocated channel: c2
channel c2: SID=47 device type=DISK
Starting backup at 2025-11-14 19:57:24
channel c1: starting incremental level 1 datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00005 name=/oraimsi/oradata/ORA19DBFS/sysaux02.dbf
input datafile file number=00003 name=/app/oracle/oradata/ORA19DBFS/undotbs01.dbf
input datafile file number=00002 name=/app/oracle/oradata/ORA19DBFS/sysaux01.dbf
channel c1: starting piece 1 at 2025-11-14 19:57:24
channel c2: starting incremental level 1 datafile backup set
channel c2: specifying datafile(s) in backup set
input datafile file number=00004 name=/app/oracle/oradata/ORA19DBFS/users01.dbf
input datafile file number=00001 name=/app/oracle/oradata/ORA19DBFS/system01.dbf
channel c2: starting piece 1 at 2025-11-14 19:57:24
channel c1: finished piece 1 at 2025-11-14 19:57:25
piece handle=/oraimsi/rman/level1_20251114_0q48pkp4_26_1_1 tag=TAG20251114T195724 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
channel c1: starting incremental level 1 datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00006 name=/oraimsi/oradata/ORA19DBFS/system02.dbf
channel c1: starting piece 1 at 2025-11-14 19:57:25
channel c2: finished piece 1 at 2025-11-14 19:57:25
piece handle=/oraimsi/rman/level1_20251114_0r48pkp4_27_1_1 tag=TAG20251114T195724 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:01
channel c1: finished piece 1 at 2025-11-14 19:57:32
piece handle=/oraimsi/rman/level1_20251114_0s48pkp5_28_1_1 tag=TAG20251114T195724 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:07
Finished backup at 2025-11-14 19:57:32
Starting Control File and SPFILE Autobackup at 2025-11-14 19:57:32
piece handle=/app/oracle/product/19c/dbs/c-1166340695-20251114-05 comment=NONE
Finished Control File and SPFILE Autobackup at 2025-11-14 19:57:33
released channel: c1
released channel: c2
|
datafile 백업이 2025-11-14 19:57:24에 시작해서 2025-11-14 19:57:32에 종료됨
8초만에 완료됨
결론1 :
테스트 db에서 테이블을 그렇게 많이 만들지 않아서 그런가 bct 파일에는 큰 변화가 없었음
이렇게 끝내긴 아쉬워서 테스트 한김에 bct를 비활성화 했을때 2차 증분 백업이 시간이 얼마나 걸리는지 테스트해봄
기존 테이블 삭제
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
SQL>
drop table TBL10 purge;
drop table TBL11 purge;
drop table TBL12 purge;
drop table TBL13 purge;
drop table TBL14 purge;
drop table TBL15 purge;
drop table TBL16 purge;
drop table TBL17 purge;
drop table TBL18 purge;
drop table TBL19 purge;
drop table TBL2 purge;
drop table TBL20 purge;
drop table TBL21 purge;
drop table TBL22 purge;
drop table TBL23 purge;
drop table TBL3 purge;
drop table TBL4 purge;
drop table TBL5 purge;
drop table TBL6 purge;
drop table TBL7 purge;
drop table TBL8 purge;
drop table TBL9 purge;
|
백업 및 아카이브 로그 삭제
|
1
2
3
4
|
rman target / << EOF
delete noprompt backup;
delete noprompt archivelog all;
EOF
|
bct 기능 비활성화
|
1
2
3
|
SQL> alter database disable block change tracking;
Database altered.
|
1차 풀백업
|
1
2
3
4
5
6
7
8
|
$ rman target /
RMAN> run {
allocate channel c1 type disk;
allocate channel c2 type disk;
backup incremental level 0 database format '/oraimsi/rman/level0_%T_%U';
release channel c1;
release channel c2;
}
|
추가 테이블 생성
|
1
2
3
|
SQL> create table tbl2 as select * from tbl1;
Table created.
|
1차 증분 백업
|
1
2
3
4
5
6
7
8
|
RMAN>
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
backup incremental level 1 database format '/oraimsi/rman/level1_%T_%U';
release channel c1;
release channel c2;
}
|
추가 테이블 생성
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
SQL>
create table tbl3 as select * from tbl1;
create table tbl4 as select * from tbl1 where rownum<=100;
create table tbl5 as select * from tbl1 where rownum<=100;
create table tbl6 as select * from tbl1 where rownum<=100;
create table tbl7 as select * from tbl1 where rownum<=100;
create table tbl8 as select * from tbl1 where rownum<=100;
create table tbl9 as select * from tbl1 where rownum<=100;
create table tbl10 as select * from tbl1 where rownum<=100;
create table tbl11 as select * from tbl1 where rownum<=100;
create table tbl12 as select * from tbl1 where rownum<=100;
create table tbl13 as select * from tbl1 where rownum<=100;
create table tbl14 as select * from tbl1 where rownum<=100;
create table tbl15 as select * from tbl1 where rownum<=100;
create table tbl16 as select * from tbl1 where rownum<=100;
create table tbl17 as select * from tbl1 where rownum<=100;
create table tbl18 as select * from tbl1 where rownum<=100;
create table tbl19 as select * from tbl1 where rownum<=100;
create table tbl20 as select * from tbl1 where rownum<=100;
create table tbl21 as select * from tbl1 where rownum<=100;
create table tbl22 as select * from tbl1 where rownum<=100;
create table tbl23 as select * from tbl1 where rownum<=100;
|
2차 증분 백업
|
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
|
RMAN>
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
backup incremental level 1 database format '/oraimsi/rman/level1_%T_%U';
release channel c1;
release channel c2;
}
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=268 device type=DISK
allocated channel: c2
channel c2: SID=280 device type=DISK
Starting backup at 2025-11-14 20:12:28
channel c1: starting incremental level 1 datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00005 name=/oraimsi/oradata/ORA19DBFS/sysaux02.dbf
input datafile file number=00003 name=/app/oracle/oradata/ORA19DBFS/undotbs01.dbf
input datafile file number=00002 name=/app/oracle/oradata/ORA19DBFS/sysaux01.dbf
channel c1: starting piece 1 at 2025-11-14 20:12:28
channel c2: starting incremental level 1 datafile backup set
channel c2: specifying datafile(s) in backup set
input datafile file number=00004 name=/app/oracle/oradata/ORA19DBFS/users01.dbf
input datafile file number=00001 name=/app/oracle/oradata/ORA19DBFS/system01.dbf
channel c2: starting piece 1 at 2025-11-14 20:12:28
channel c1: finished piece 1 at 2025-11-14 20:12:43
piece handle=/oraimsi/rman/level1_20251114_1648pllc_38_1_1 tag=TAG20251114T201228 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:15
channel c1: starting incremental level 1 datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00006 name=/oraimsi/oradata/ORA19DBFS/system02.dbf
channel c1: starting piece 1 at 2025-11-14 20:12:44
channel c2: finished piece 1 at 2025-11-14 20:12:44
piece handle=/oraimsi/rman/level1_20251114_1748pllc_39_1_1 tag=TAG20251114T201228 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:16
channel c1: finished piece 1 at 2025-11-14 20:12:51
piece handle=/oraimsi/rman/level1_20251114_1848plls_40_1_1 tag=TAG20251114T201228 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:07
Finished backup at 2025-11-14 20:12:51
Starting Control File and SPFILE Autobackup at 2025-11-14 20:12:51
piece handle=/app/oracle/product/19c/dbs/c-1166340695-20251114-08 comment=NONE
Finished Control File and SPFILE Autobackup at 2025-11-14 20:12:52
released channel: c1
released channel: c2
|
datafile 백업이 2025-11-14 20:12:28에 시작해서 2025-11-14 20:12:51에 종료됨
23초 소요됨
참고. bct 비활성화 후 백업시 alert log에 남는 내용
bct 비활성화 후 백업시 alert log에 아래와 같은 내용이 남겨짐
|
1
2
3
4
5
6
|
2025-11-14T20:12:28.742065+09:00
The change tracking is being disabled, skip initialization
2025-11-14T20:12:28.819334+09:00
The change tracking is being disabled, skip initialization
2025-11-14T20:12:44.066748+09:00
The change tracking is being disabled, skip initialization
|
bct를 disable 했지만 rman 백업시 이전에는 bct를 사용한 기록을 기억하고 bct 파일을 읽으려는 시도를 하다가
실제 확인해보니 비활성화 되있어서 skip을 하는 것 처럼 보이지만 정확한 이유는 모르겠음
bct를 의도적으로 비활성화 한 경우 무시하면 되는 메세지이긴 함
결론 :
테스트1 : 테스트 db에서 테이블을 그렇게 많이 만들지 않아서 그런가 bct 파일에는 큰 변화가 없었음
테스트2 :
bct 기능을 활성화 했을때는 동일 양이 8초만에 백업되었고, bct 기능을 비활성화 했을때는 23초나 소요됨
이렇게 적은양의 db에서도 차이가 15초나 나는데 용량이 크면 더 차이가 많이 날듯함
참조 :
https://positivemh.tistory.com/179
https://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/V-BLOCK_CHANGE_TRACKING.html
https://docs.oracle.com/en/database/oracle/oracle-database/19/bradv/backing-up-database.html#GUID-4E1F605A-76A7-48D0-9D9B-7343B4327E2A
738410.1
'ORACLE > Backup&Recover' 카테고리의 다른 글
| 오라클 19c rman 일부 테이블스페이스 백업 후 복구 시나리오 (0) | 2025.12.05 |
|---|---|
| 오라클 19c rman 증분 백업 및 복구 시나리오 (2) | 2025.11.27 |
| 오라클 11g to 19c 업그레이드 시 restore point 이용 복원 테스트(compatible 변경) (0) | 2025.10.10 |
| 오라클 11g to 19c 업그레이드 시 restore point 이용 복원 테스트 (0) | 2025.10.08 |
| 오라클 19c 핫백업시 redo 발생량 차이 확인 (0) | 2025.10.03 |