RMAN에는 controlfile autobackup이라는 기능이 있습니다. 언제 이 기능이 동작하는지 확인해보겠습니다.

 

먼저 RMAN에 접속합니다.

1. catalog db를 사용하지 않으므로 그냥 바로 접속합니다.

$ rman target /
Recovery Manager: Release 12.1.0.2.0 - 
Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.
connected to target database: XX(DBID=XX)
RMAN>
 
2. 현재의 설정을 확인해봅니다. default인 경우에 뒤에 코멘트로 친절하게 알려주네요.
RMAN> show all;
...
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
...
 
3. 현재 controlfile 백업이 얼마나 되어 있는지 확인해봅니다. 아직 하나도 없네요.
RMAN> list backup of controlfile;
specification does not match any backup in the repository
 
4. 이제 controlfile 백업을 해봅니다.
RMAN> RUN {
ALLOCATE CHANNEL ch00 TYPE disk;
BACKUP
  FORMAT '/home/oracle/cntl_2016'
  CURRENT CONTROLFILE;
RELEASE CHANNEL ch00;
}
 
5. 다시 백업파일 확인. controlfile 백업이 잘 수행되었습니다.
RMAN> list backup of controlfile;
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1       Full    17.11M     DISK        00:00:02     01-JUN-16
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20160601T183730
        Piece Name: /home/oracle/cntl_2016
  Control File Included: Ckp SCN: 123456      Ckp time: 01-JUN-16
 
6. 이제 AUTOBACKUP을 ON으로 변경하고 위와 동일한 작업을 해봅니다.
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
RMAN> RUN {
 ALLOCATE CHANNEL ch00 TYPE disk;
 BACKUP
      FORMAT '/home/oracle/cntl_2016_2'
      CURRENT CONTROLFILE;
 RELEASE CHANNEL ch00;
}
RMAN> list backup of controlfile;
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1       Full    17.11M     DISK        00:00:02     01-JUN-16
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20160601T183730
        Piece Name: /home/oracle/cntl_2016
  Control File Included: Ckp SCN: 123456      Ckp time: 01-JUN-16

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2       Full    17.11M     DISK        00:00:02     01-JUN-16
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20160601T184730
        Piece Name: /home/oracle/cntl_2016-2
  Control File Included: Ckp SCN: 123457      Ckp time: 01-JUN-16

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3       Full    17.11M     DISK        00:00:02     01-JUN-16
        BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: TAG20160601T184730
        Piece Name: /home2/controlfile/backup/c-123-456
  Control File Included: Ckp SCN: 123458      Ckp time: 01-JUN-16

 

명시적으로 지정한 controlfile 백업말고 다른 파일이 하나 자동으로 백업된걸 확인할수 있습니다.(위의 결과에서 3번에 해당)

컨트롤파일을 받는 경우말고 데이터파일이나 아카이브파일을 백업받을때도 AUTOBACKUP설정이 ON되어 있으면 controlfile이 같이 백업됩니다.

관리정책에 따라 명시적으로 명령어를 수행(수동 혹은 스크립트를 이용한 자동)하여 백업할수도 있고 아니면 해당 설정만 ON해놓는 것으로 자동 백업이 되도록 할수도 있습니다.