“NOT BACKED UP” and “TAG” RMAN options

A opção NOT BACKED UP do RMAN nos permite realizar o backup dos archivelogs que não tenham atingido a quantidade de backups que é definida. No exemplo abaixo, demonstro que parâmetro TIMES é igual a 1, e podemos ver a partir da segunda execução que novos archivelogs são considerados, e os já contemplados, desconsiderados (“skipping archived logs of thread 1 from sequence 41 to 42; already backed up”):

RMAN> BACKUP ARCHIVELOG ALL NOT BACKED UP 1 TIMES;
 
Starting backup at 2021-03-16:05:43:25
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=41 RECID=48 STAMP=1067319757
input archived log thread=1 sequence=42 RECID=49 STAMP=1067319805
channel ORA_DISK_1: starting piece 1 at 2021-03-16:05:43:25
channel ORA_DISK_1: finished piece 1 at 2021-03-16:05:43:27
piece handle=/oracle/fra/RMANDB/backupset/2021_03_16/o1_mf_annnn_TAG20210316T054325_j50vxg15_.bkp tag=TAG20210316T054325 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 2021-03-16:05:43:27
 
Starting Control File and SPFILE Autobackup at 2021-03-16:05:43:27
piece handle=/oracle/fra/RMANDB/autobackup/2021_03_16/o1_mf_s_1067319807_j50vxhlh_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2021-03-16:05:43:28
 
RMAN> BACKUP ARCHIVELOG ALL NOT BACKED UP 1 TIMES;
 
Starting backup at 2021-03-16:05:43:42
current log archived
using channel ORA_DISK_1
skipping archived logs of thread 1 from sequence 41 to 42; already backed up
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=43 RECID=50 STAMP=1067319825
channel ORA_DISK_1: starting piece 1 at 2021-03-16:05:43:45
channel ORA_DISK_1: finished piece 1 at 2021-03-16:05:43:46
piece handle=/oracle/fra/RMANDB/backupset/2021_03_16/o1_mf_annnn_TAG20210316T054345_j50vy1f3_.bkp tag=TAG20210316T054345 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2021-03-16:05:43:46
 
Starting Control File and SPFILE Autobackup at 2021-03-16:05:43:46
piece handle=/oracle/fra/RMANDB/autobackup/2021_03_16/o1_mf_s_1067319826_j50vy2wq_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2021-03-16:05:43:47

Utilizando o SINCE TIME:

RMAN> BACKUP ARCHIVELOG ALL NOT BACKED UP SINCE TIME 'SYSDATE-1';
 
Starting backup at 2021-03-16:06:02:37
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=35 device type=DISK
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=41 RECID=48 STAMP=1067319757
input archived log thread=1 sequence=42 RECID=49 STAMP=1067319805
input archived log thread=1 sequence=43 RECID=50 STAMP=1067319825
input archived log thread=1 sequence=44 RECID=51 STAMP=1067319834
input archived log thread=1 sequence=45 RECID=52 STAMP=1067320958
channel ORA_DISK_1: starting piece 1 at 2021-03-16:06:02:38
channel ORA_DISK_1: finished piece 1 at 2021-03-16:06:02:39
piece handle=/oracle/fra/RMANDB/backupset/2021_03_16/o1_mf_annnn_TAG20210316T060238_j50x1glm_.bkp tag=TAG20210316T060238 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2021-03-16:06:02:39
 
Starting Control File and SPFILE Autobackup at 2021-03-16:06:02:39
piece handle=/oracle/fra/RMANDB/autobackup/2021_03_16/o1_mf_s_1067320959_j50x1j85_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2021-03-16:06:02:40
 
RMAN> BACKUP ARCHIVELOG ALL NOT BACKED UP SINCE TIME 'SYSDATE-1';
 
Starting backup at 2021-03-16:06:03:06
current log archived
using channel ORA_DISK_1
skipping archived logs of thread 1 from sequence 41 to 45; already backed up
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=46 RECID=53 STAMP=1067320986
channel ORA_DISK_1: starting piece 1 at 2021-03-16:06:03:06
channel ORA_DISK_1: finished piece 1 at 2021-03-16:06:03:07
piece handle=/oracle/fra/RMANDB/backupset/2021_03_16/o1_mf_annnn_TAG20210316T060306_j50x2bm9_.bkp tag=TAG20210316T060306 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2021-03-16:06:03:07
 
Starting Control File and SPFILE Autobackup at 2021-03-16:06:03:07
piece handle=/oracle/fra/RMANDB/autobackup/2021_03_16/o1_mf_s_1067320987_j50x2d2l_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2021-03-16:06:03:08

O recurso de Tags nos permitem identificar de uma maneira mais acessível os backups realizados. Pode ser utilizado nas operações de LIST, RESTORE, SWITCH. Segue alguns exemplos. Realizando backup de uma tablespace:

RMAN> BACKUP TABLESPACE USERS TAG 'BSS';
 
Starting backup at 2021-03-16:06:09:30
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=00007 name=/oracle/dados/RMANDB/datafile/o1_mf_users_h8nyrkn7_.dbf
channel ORA_DISK_1: starting piece 1 at 2021-03-16:06:09:31
channel ORA_DISK_1: finished piece 1 at 2021-03-16:06:09:32
piece handle=/oracle/fra/RMANDB/backupset/2021_03_16/o1_mf_nnndf_BSS_j50xgc5b_.bkp tag=BSS comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2021-03-16:06:09:32
 
Starting Control File and SPFILE Autobackup at 2021-03-16:06:09:32
piece handle=/oracle/fra/RMANDB/autobackup/2021_03_16/o1_mf_s_1067321372_j50xgdmq_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2021-03-16:06:09:33

Consultando:

RMAN> LIST BACKUPSET TAG "BSS";
 
 
List of Backup Sets
===================
 
 
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
100     Full    1.05M      DISK        00:00:00     2021-03-16:06:09:31
        BP Key: 100   Status: AVAILABLE  Compressed: NO  Tag: BSS
        Piece Name: /oracle/fra/RMANDB/backupset/2021_03_16/o1_mf_nnndf_BSS_j50xgc5b_.bkp
  List of Datafiles in backup set 100
  File LV Type Ckp SCN    Ckp Time            Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- ------------------- ----------- ------ ----
  7       Full 1833119    2021-03-16:06:09:31              NO    /oracle/dados/RMANDB/datafile/o1_mf_users_h8nyrkn7_.dbf

Deletando o backupset utilizando a TAG:

RMAN> DELETE BACKUPSET TAG 'BSS';
 
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=115 device type=DISK
 
List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
100     100     1   1   AVAILABLE   DISK        /oracle/fra/RMANDB/backupset/2021_03_16/o1_mf_nnndf_BSS_j50xgc5b_.bkp
 
Do you really want to delete the above objects (enter YES or NO)? YES
deleted backup piece
backup piece handle=/oracle/fra/RMANDB/backupset/2021_03_16/o1_mf_nnndf_BSS_j50xgc5b_.bkp RECID=100 STAMP=1067321371
Deleted 1 objects

Obs: Este procedimento foi criado pelo senhor Ahmed Baraka (www.ahmedbaraka.com) e foi apenas reproduzido por mim em um laboratório pessoal para fins de aprendizado.

Leave a Comment

Your email address will not be published.