신문지한장

[B&R] oracle RMAN 본문

Oracle/Backup&Recovery

[B&R] oracle RMAN

신문지한장 2024. 5. 10. 14:17
  • 사전 작업
mkdir -p /data/backup/rman/
mkdir -p /data/backup/ctlbackup/
chown -R oracle:dba /data
chmod -R 775 /data
  • 자동 채널 할당
rman target /

RMAN> configure default device type to disk;

using target database control file instead of recovery catalog
old RMAN configuration parameters:
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
new RMAN configuration parameters:
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
new RMAN configuration parameters are successfully stored
  • default device 경로 설정
RMAN> configure channel device type disk
2> format '/data/backup/rman/%U_%T';

old RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '/data/backup/rman/%U_%T';
new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '/data/backup/rman/%U_%T';
new RMAN configuration parameters are successfully stored

RMAN> configure controlfile autobackup on;

RMAN> configure controlfile autobackup format for device type disk to '/data/backup/ctlbackup/%F';

  • 경로 지정 없이 백업
RMAN> backup tablespace users;

Starting backup at 23-MAY-22
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=84 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=00007 name=/oracle/app/oracle/oradata/TEST19/users01.dbf
channel ORA_DISK_1: starting piece 1 at 23-MAY-22
channel ORA_DISK_1: finished piece 1 at 23-MAY-22
piece handle=/data/backup/rman/2t0u834j_1_1_20220523 tag=TAG20220523T172747 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 23-MAY-22

Starting Control File Autobackup at 23-MAY-22
piece handle=/oracle/app/oracle/oradata/TEST19/arch/TEST19/autobackup/2022_05_23/o1_mf_n_1105464469_k8pkd5bq_.bkp comment=NONE
Finished Control File Autobackup at 23-MAY-22
  • 백업된 파일 확인
[test19]oracle:/data/backup/rman> ls -lart
-rw-r-----. 1 oracle dba    2506752  5월 23 17:27 2t0u834j_1_1_20220523

// 작업형 명령어로 여러 개를 서로 다른 경로에 백업 받는 방법
RMAN> run {
2> allocate channel c1 type disk maxpiecesize 10M;
3> allocate channel c2 type disk maxpiecesize 50M;
4> backup
5> tablespace users channel c1
6> format '/data/backup/rman/%U_%T'
7> tablespace example channel c2
8> format '/data/backup/rman/%U_%T';
9> }
  • 차등 증분 백업

일요일에 level 0으로 데이터 베이스를 전체 백업

RMAN> run {
2> allocate channel c1 type disk;
3> allocate channel c2 type disk;
4> backup
5>   incremental level 0
6> database
7>   format '/data/backup/rman/%U_%T';
8> }

channel c2: backup set complete, elapsed time: 00:00:01
channel c1: finished piece 1 at 16-MAY-22
piece handle=/data/backup/rman/070tkosg_1_1_20220516 tag=TAG20220516T093551 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 16-MAY-22
released channel: c1
released channel: c2

월요일에 level 3으로 users tablespce만 차등 증분 백업

RMAN> run {
2> allocate channel c1 type disk;
3> backup
4>   incremental level 3
5> tablespace users;
6> }

1_mf_nnnd3_TAG20220516T094132_k837fwhk_.bkp tag=TAG20220516T094132 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 16-MAY-22
released channel: c1

수요일에 level 3으로 누적 증분 백업

RMAN> run {
2> allocate channel c2 type disk;
3> backup
4>   incremental level 3 cumulative
5> tablespace example;
6> }

allocated channel: c2
channel c2: SID=33 device type=DISK

Starting backup at 16-MAY-22
channel c2: starting incremental level 3 datafile backup set
channel c2: specifying datafile(s) in backup set
input datafile file number=00005 name=/oracle/app/oracle/oradata/orcl11/example01.dbf
channel c2: starting piece 1 at 16-MAY-22
channel c2: finished piece 1 at 16-MAY-22
piece handle=/oracle/app/oracle/fast_recovery_area/ORCL11/backupset/2022_05_16/o1_mf_nnnd3_TAG20220516T094252_k837jdyb_.bkp tag=TAG20220516T094252 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:01
Finished backup at 16-MAY-22
released channel: c2

'Oracle > Backup&Recovery' 카테고리의 다른 글

[B&R] oracle LOGMINER (11g 이하)  (0) 2024.05.10
[B&R] oracle Migration [ 11g to 19c (PDB) ]  (0) 2024.05.10
[B&R] oracle CSScan  (0) 2024.05.10
expdp crontab 설정  (0) 2024.04.04
[B&R] oracle parameter file 손실  (4) 2024.01.04