Vamos imaginar um cenário onde o backup do seu banco de dados precisa ser destinado para uma área que possui retenção de 1 mês, e por questões legais, também precisaria estar em outra área com retenção de 1 ano. Em vez de rodarmos 2 processos de backup distintos, podemos utilizar o recurso de Duplexed Backup Sets fornecido pelo RMAN, onde com apenas uma execução, podemos criar backups totalmente iguais em diferentes locais. As mídias suportadas são disco e fita, porém não podemos duplicar o backupset para disco e fita simultaneamente. O parâmetro FORMAT é usado para definir os destinos dos arquivos de backup. Lembrando que este recurso não existe para backup do tipo image copy, além de não podermos ter duplexição na FRA (Fast Recovery Area). Neste artigo vamos explorar algumas maneiras de implementar este recurso.
RMAN settings level:
Simulando processo no nível das configurações do RMAN, utilizando o seguinte modelo:
CONFIGURE [DATAFILE | ARCHIVELOG] BACKUP COPIES FOR DEVICE TYPE [ DISK | SBT] TO n;
Analisando o valor default do parâmetro acima:
RMAN> SHOW DATAFILE BACKUP COPIES;
RMAN configuration parameters for database with db_unique_name RMANDB are:
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
Com a configuração acima, mesmo emitindo o backup com 2 destinos diferentes, o RMAN fará o backup apenas em 1:
RMAN> BACKUP DEVICE TYPE DISK DATABASE FORMAT '/oracle/dados/RMANDB/BACKUP1/%U', '/oracle/dados/RMANDB/BACKUP2/%U';
Starting backup at 2021-05-03:05:01:16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=74 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=00001 name=/oracle/dados/RMANDB/datafile/o1_mf_system_h8nynqfx_.dbf
input datafile file number=00003 name=/oracle/dados/RMANDB/datafile/o1_mf_sysaux_h8nyq35q_.dbf
input datafile file number=00004 name=/oracle/dados/RMANDB/datafile/o1_mf_undotbs1_h8nyrjdr_.dbf
input datafile file number=00005 name=/oracle/dados/RMANDB/datafile/ts_cortex_catalog.dbf
input datafile file number=00007 name=/oracle/dados/RMANDB/datafile/o1_mf_users_h8nyrkn7_.dbf
channel ORA_DISK_1: starting piece 1 at 2021-05-03:05:01:16
channel ORA_DISK_1: finished piece 1 at 2021-05-03:05:01:41
piece handle=/oracle/dados/RMANDB/BACKUP1/bdvtt4cs_1_1 tag=TAG20210503T050116 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
Finished backup at 2021-05-03:05:01:41
Starting Control File and SPFILE Autobackup at 2021-05-03:05:01:41
piece handle=/oracle/fra/RMANDB/autobackup/2021_05_03/o1_mf_s_1071550901_j8zch6ch_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2021-05-03:05:01:42
RMAN> LIST BACKUP OF DATABASE;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
286 Full 1.28G DISK 00:00:02 2021-05-03:05:01:18
BP Key: 294 Status: AVAILABLE Compressed: NO Tag: TAG20210503T050116
Piece Name: /oracle/dados/RMANDB/BACKUP1/bdvtt4cs_1_1
List of Datafiles in backup set 286
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- ------------------- ----------- ------ ----
1 Full 2653633 2021-05-03:05:01:16 NO /oracle/dados/RMANDB/datafile/o1_mf_system_h8nynqfx_.dbf
3 Full 2653633 2021-05-03:05:01:16 NO /oracle/dados/RMANDB/datafile/o1_mf_sysaux_h8nyq35q_.dbf
4 Full 2653633 2021-05-03:05:01:16 NO /oracle/dados/RMANDB/datafile/o1_mf_undotbs1_h8nyrjdr_.dbf
5 Full 2653633 2021-05-03:05:01:16 NO /oracle/dados/RMANDB/datafile/ts_cortex_catalog.dbf
7 Full 2653633 2021-05-03:05:01:16 NO /oracle/dados/RMANDB/datafile/o1_mf_users_h8nyrkn7_.dbf
RMAN> host 'ls -lthr /oracle/dados/RMANDB/BACKUP2/';
total 0
host command complete
Após remover o backupset (para as evidências expostas no artigo não ficarem poluídas), alteramos o parâmetro do RMAN para que aceite 2 cópias simultâneas:
RMAN> CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 2;
new RMAN configuration parameters:
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 2;
new RMAN configuration parameters are successfully stored
Ao executar o mesmo backup, podemos notar que é criado um Backup Key diferente para cada destino:
RMAN> BACKUP DEVICE TYPE DISK DATABASE FORMAT '/oracle/dados/RMANDB/BACKUP1/%U', '/oracle/dados/RMANDB/BACKUP2/%U';
Starting backup at 2021-05-03:05:04:44
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=00001 name=/oracle/dados/RMANDB/datafile/o1_mf_system_h8nynqfx_.dbf
input datafile file number=00003 name=/oracle/dados/RMANDB/datafile/o1_mf_sysaux_h8nyq35q_.dbf
input datafile file number=00004 name=/oracle/dados/RMANDB/datafile/o1_mf_undotbs1_h8nyrjdr_.dbf
input datafile file number=00005 name=/oracle/dados/RMANDB/datafile/ts_cortex_catalog.dbf
input datafile file number=00007 name=/oracle/dados/RMANDB/datafile/o1_mf_users_h8nyrkn7_.dbf
channel ORA_DISK_1: starting piece 1 at 2021-05-03:05:04:44
channel ORA_DISK_1: finished piece 1 at 2021-05-03:05:06:29 with 2 copies and tag TAG20210503T050444
piece handle=/oracle/dados/RMANDB/BACKUP1/bfvtt4jc_1_1 comment=NONE
piece handle=/oracle/dados/RMANDB/BACKUP2/bfvtt4jc_1_2 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:45
Finished backup at 2021-05-03:05:06:29
Starting Control File and SPFILE Autobackup at 2021-05-03:05:06:29
piece handle=/oracle/fra/RMANDB/autobackup/2021_05_03/o1_mf_s_1071551190_j8zcr6l1_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2021-05-03:05:06:31
RMAN> LIST BACKUP OF DATABASE;
List of Backup Sets
===================
BS Key Type LV Size
------- ---- -- ----------
288 Full 1.28G
List of Datafiles in backup set 288
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- ------------------- ----------- ------ ----
1 Full 2654605 2021-05-03:05:04:44 NO /oracle/dados/RMANDB/datafile/o1_mf_system_h8nynqfx_.dbf
3 Full 2654605 2021-05-03:05:04:44 NO /oracle/dados/RMANDB/datafile/o1_mf_sysaux_h8nyq35q_.dbf
4 Full 2654605 2021-05-03:05:04:44 NO /oracle/dados/RMANDB/datafile/o1_mf_undotbs1_h8nyrjdr_.dbf
5 Full 2654605 2021-05-03:05:04:44 NO /oracle/dados/RMANDB/datafile/ts_cortex_catalog.dbf
7 Full 2654605 2021-05-03:05:04:44 NO /oracle/dados/RMANDB/datafile/o1_mf_users_h8nyrkn7_.dbf
Backup Set Copy #1 of backup set 288
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ ------------------- ---------- ---
DISK 00:00:52 2021-05-03:05:06:25 NO TAG20210503T050444
List of Backup Pieces for backup set 288 Copy #1
BP Key Pc# Status Piece Name
------- --- ----------- ----------
296 1 AVAILABLE /oracle/dados/RMANDB/BACKUP1/bfvtt4jc_1_1
Backup Set Copy #2 of backup set 288
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ ------------------- ---------- ---
DISK 00:00:52 2021-05-03:05:06:25 NO TAG20210503T050444
List of Backup Pieces for backup set 288 Copy #2
BP Key Pc# Status Piece Name
------- --- ----------- ----------
297 1 AVAILABLE /oracle/dados/RMANDB/BACKUP2/bfvtt4jc_1_2
Importante salientar que é possível executar até 4 backups duplexados por vez, como é exposto no limite abaixo:
RMAN> CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 100;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of configure command at 05/03/2021 05:08:01
RMAN-06411: backup copies setting out of range (1-4): 100
Alterando parâmetro para seu valor máximo e mantendo no comando apenas 2 destinos (para verificar o seu comportamento):
RMAN> CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 4;
old RMAN configuration parameters:
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 2;
new RMAN configuration parameters:
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 4;
new RMAN configuration parameters are successfully stored
O resultado foi que mesmo definindo 2 destinos, o RMAN quadruplicou os backups, criando backupsets distintos:
RMAN> BACKUP DEVICE TYPE DISK DATABASE FORMAT '/oracle/dados/RMANDB/BACKUP1/%U', '/oracle/dados/RMANDB/BACKUP2/%U';
Starting backup at 2021-05-03:05:09:56
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=00001 name=/oracle/dados/RMANDB/datafile/o1_mf_system_h8nynqfx_.dbf
input datafile file number=00003 name=/oracle/dados/RMANDB/datafile/o1_mf_sysaux_h8nyq35q_.dbf
input datafile file number=00004 name=/oracle/dados/RMANDB/datafile/o1_mf_undotbs1_h8nyrjdr_.dbf
input datafile file number=00005 name=/oracle/dados/RMANDB/datafile/ts_cortex_catalog.dbf
input datafile file number=00007 name=/oracle/dados/RMANDB/datafile/o1_mf_users_h8nyrkn7_.dbf
channel ORA_DISK_1: starting piece 1 at 2021-05-03:05:09:56
channel ORA_DISK_1: finished piece 1 at 2021-05-03:05:11:42 with 4 copies and tag TAG20210503T050956
piece handle=/oracle/dados/RMANDB/BACKUP1/bhvtt4t4_1_1 comment=NONE
piece handle=/oracle/dados/RMANDB/BACKUP2/bhvtt4t4_1_2 comment=NONE
piece handle=/oracle/dados/RMANDB/BACKUP1/bhvtt4t4_1_3 comment=NONE
piece handle=/oracle/dados/RMANDB/BACKUP2/bhvtt4t4_1_4 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:46
Finished backup at 2021-05-03:05:11:42
Starting Control File and SPFILE Autobackup at 2021-05-03:05:11:42
piece handle=/oracle/fra/RMANDB/autobackup/2021_05_03/o1_mf_s_1071551502_j8zd1yz6_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2021-05-03:05:11:43
RMAN> LIST BACKUP OF DATABASE;
List of Backup Sets
===================
BS Key Type LV Size
------- ---- -- ----------
290 Full 1.28G
List of Datafiles in backup set 290
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- ------------------- ----------- ------ ----
1 Full 2654858 2021-05-03:05:09:56 NO /oracle/dados/RMANDB/datafile/o1_mf_system_h8nynqfx_.dbf
3 Full 2654858 2021-05-03:05:09:56 NO /oracle/dados/RMANDB/datafile/o1_mf_sysaux_h8nyq35q_.dbf
4 Full 2654858 2021-05-03:05:09:56 NO /oracle/dados/RMANDB/datafile/o1_mf_undotbs1_h8nyrjdr_.dbf
5 Full 2654858 2021-05-03:05:09:56 NO /oracle/dados/RMANDB/datafile/ts_cortex_catalog.dbf
7 Full 2654858 2021-05-03:05:09:56 NO /oracle/dados/RMANDB/datafile/o1_mf_users_h8nyrkn7_.dbf
Backup Set Copy #1 of backup set 290
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ ------------------- ---------- ---
DISK 00:01:15 2021-05-03:05:11:37 NO TAG20210503T050956
List of Backup Pieces for backup set 290 Copy #1
BP Key Pc# Status Piece Name
------- --- ----------- ----------
299 1 AVAILABLE /oracle/dados/RMANDB/BACKUP1/bhvtt4t4_1_1
Backup Set Copy #2 of backup set 290
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ ------------------- ---------- ---
DISK 00:01:15 2021-05-03:05:11:37 NO TAG20210503T050956
List of Backup Pieces for backup set 290 Copy #2
BP Key Pc# Status Piece Name
------- --- ----------- ----------
300 1 AVAILABLE /oracle/dados/RMANDB/BACKUP2/bhvtt4t4_1_2
Backup Set Copy #3 of backup set 290
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ ------------------- ---------- ---
DISK 00:01:15 2021-05-03:05:11:37 NO TAG20210503T050956
List of Backup Pieces for backup set 290 Copy #3
BP Key Pc# Status Piece Name
------- --- ----------- ----------
301 1 AVAILABLE /oracle/dados/RMANDB/BACKUP1/bhvtt4t4_1_3
Backup Set Copy #4 of backup set 290
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ ------------------- ---------- ---
DISK 00:01:15 2021-05-03:05:11:37 NO TAG20210503T050956
List of Backup Pieces for backup set 290 Copy #4
BP Key Pc# Status Piece Name
------- --- ----------- ----------
302 1 AVAILABLE /oracle/dados/RMANDB/BACKUP2/bhvtt4t4_1_4
RMAN> host 'ls -lthr /oracle/dados/RMANDB/BACKUP1';
total 2.6G
-rw-r-----. 1 oracle oinstall 1.3G May 3 05:11 bhvtt4t4_1_1
-rw-r-----. 1 oracle oinstall 1.3G May 3 05:11 bhvtt4t4_1_3
host command complete
RMAN> host 'ls -lthr /oracle/dados/RMANDB/BACKUP2';
total 2.6G
-rw-r-----. 1 oracle oinstall 1.3G May 3 05:11 bhvtt4t4_1_2
-rw-r-----. 1 oracle oinstall 1.3G May 3 05:11 bhvtt4t4_1_4
host command complete
Voltando o parâmetro RMAN ao seu valor padrão:
RMAN> CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK CLEAR;
old RMAN configuration parameters:
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
RMAN configuration parameters are successfully reset to default value
Todas essas etapas realizadas com os datafiles também podem ser aplicadas com os ARCHIVELOGs. Mostrando apenas um dos exemplos, já que a ideia é a mesma:
RMAN> CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 2;
new RMAN configuration parameters:
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 2;
new RMAN configuration parameters are successfully stored
O backup duplicado é realizado com sucesso:
RMAN> BACKUP DEVICE TYPE DISK ARCHIVELOG ALL FORMAT '/oracle/dados/RMANDB/BACKUP1/%U', '/oracle/dados/RMANDB/BACKUP2/%U';
Starting backup at 2021-05-03:05:24:19
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=68 RECID=75 STAMP=1069389781
input archived log thread=1 sequence=69 RECID=77 STAMP=1069390191
input archived log thread=1 sequence=70 RECID=78 STAMP=1069391841
input archived log thread=1 sequence=71 RECID=79 STAMP=1069392032
input archived log thread=1 sequence=72 RECID=80 STAMP=1069392053
input archived log thread=1 sequence=73 RECID=83 STAMP=1069392224
input archived log thread=1 sequence=74 RECID=84 STAMP=1069392226
input archived log thread=1 sequence=75 RECID=85 STAMP=1069430460
input archived log thread=1 sequence=76 RECID=86 STAMP=1069567218
input archived log thread=1 sequence=77 RECID=87 STAMP=1069581356
input archived log thread=1 sequence=78 RECID=88 STAMP=1070953640
input archived log thread=1 sequence=79 RECID=89 STAMP=1070992854
input archived log thread=1 sequence=80 RECID=90 STAMP=1071054025
input archived log thread=1 sequence=81 RECID=91 STAMP=1071075652
input archived log thread=1 sequence=82 RECID=92 STAMP=1071117108
input archived log thread=1 sequence=83 RECID=93 STAMP=1071140420
input archived log thread=1 sequence=84 RECID=94 STAMP=1071180017
input archived log thread=1 sequence=85 RECID=95 STAMP=1071190844
input archived log thread=1 sequence=86 RECID=96 STAMP=1071205211
input archived log thread=1 sequence=87 RECID=97 STAMP=1071205218
input archived log thread=1 sequence=88 RECID=98 STAMP=1071219611
input archived log thread=1 sequence=89 RECID=99 STAMP=1071376111
input archived log thread=1 sequence=90 RECID=100 STAMP=1071381640
input archived log thread=1 sequence=91 RECID=101 STAMP=1071396592
input archived log thread=1 sequence=92 RECID=102 STAMP=1071411059
input archived log thread=1 sequence=93 RECID=103 STAMP=1071552261
channel ORA_DISK_1: starting piece 1 at 2021-05-03:05:24:22
channel ORA_DISK_1: finished piece 1 at 2021-05-03:05:24:57 with 2 copies and tag TAG20210503T052421
piece handle=/oracle/dados/RMANDB/BACKUP1/blvtt5o6_1_1 comment=NONE
piece handle=/oracle/dados/RMANDB/BACKUP2/blvtt5o6_1_2 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
Finished backup at 2021-05-03:05:24:57
Starting Control File and SPFILE Autobackup at 2021-05-03:05:24:57
piece handle=/oracle/fra/RMANDB/autobackup/2021_05_03/o1_mf_s_1071552297_j8zdtt6s_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2021-05-03:05:24:58
RMAN> LIST BACKUP OF ARCHIVELOG ALL;
List of Backup Sets
===================
BS Key Size
------- ----------
294 782.24M
List of Archived Logs in backup set 294
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- ------------------- ---------- ---------
1 68 2255756 2021-03-28:10:39:58 2262113 2021-04-09:04:43:00
1 69 2262113 2021-04-09:04:43:00 2262505 2021-04-09:04:49:50
1 70 2262505 2021-04-09:04:49:50 2265296 2021-04-09:05:17:21
1 71 2265296 2021-04-09:05:17:21 2265473 2021-04-09:05:20:32
1 72 2265473 2021-04-09:05:20:32 2265531 2021-04-09:05:20:53
1 73 2265531 2021-04-09:05:20:53 2265643 2021-04-09:05:23:29
1 74 2265643 2021-04-09:05:23:29 2265663 2021-04-09:05:23:44
1 75 2265663 2021-04-09:05:23:44 2290054 2021-04-09:16:01:00
1 76 2290054 2021-04-09:16:01:00 2314554 2021-04-11:06:00:15
1 77 2314554 2021-04-11:06:00:15 2328698 2021-04-11:09:55:53
1 78 2328698 2021-04-11:09:55:53 2332924 2021-04-27:07:07:17
1 79 2332924 2021-04-27:07:07:17 2358174 2021-04-27:18:00:52
1 80 2358174 2021-04-27:18:00:52 2381091 2021-04-28:11:00:22
1 81 2381091 2021-04-28:11:00:22 2394102 2021-04-28:17:00:49
1 82 2394102 2021-04-28:17:00:49 2500292 2021-04-29:04:31:47
1 83 2500292 2021-04-29:04:31:47 2519661 2021-04-29:11:00:18
1 84 2519661 2021-04-29:11:00:18 2546021 2021-04-29:22:00:14
1 85 2546021 2021-04-29:22:00:14 2559326 2021-04-30:01:00:41
1 86 2559326 2021-04-30:01:00:41 2570072 2021-04-30:05:00:08
1 87 2570072 2021-04-30:05:00:08 2570544 2021-04-30:05:00:15
1 88 2570544 2021-04-30:05:00:15 2580734 2021-04-30:09:00:09
1 89 2580734 2021-04-30:09:00:09 2607950 2021-05-01:04:28:27
1 90 2607950 2021-05-01:04:28:27 2620519 2021-05-01:06:00:37
1 91 2620519 2021-05-01:06:00:37 2634806 2021-05-01:10:09:50
1 92 2634806 2021-05-01:10:09:50 2648651 2021-05-01:14:10:57
1 93 2648651 2021-05-01:14:10:57 2655511 2021-05-03:05:24:19
Backup Set Copy #1 of backup set 294
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ ------------------- ---------- ---
DISK 00:00:17 2021-05-03:05:24:53 NO TAG20210503T052421
List of Backup Pieces for backup set 294 Copy #1
BP Key Pc# Status Piece Name
------- --- ----------- ----------
308 1 AVAILABLE /oracle/dados/RMANDB/BACKUP1/blvtt5o6_1_1
Backup Set Copy #2 of backup set 294
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ ------------------- ---------- ---
DISK 00:00:17 2021-05-03:05:24:53 NO TAG20210503T052421
List of Backup Pieces for backup set 294 Copy #2
BP Key Pc# Status Piece Name
------- --- ----------- ----------
309 1 AVAILABLE /oracle/dados/RMANDB/BACKUP2/blvtt5o6_1_2
Voltando parâmetro para seu valor padrão:
RMAN> CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK CLEAR;
old RMAN configuration parameters:
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 2;
RMAN configuration parameters are successfully reset to default value
RUN block level
Podemos utilizar o mesmo recurso diretamente do bloco RUN do RMAN. Observe que deixamos os parâmetros persistentes do RMAN no seu valor padrão (1 cópia para datafile e archivelogs). Disparando backup e validando seu comportamento:
RMAN> run {
ALLOCATE CHANNEL C1 DEVICE TYPE DISK FORMAT '/oracle/dados/RMANDB/BACKUP1/%U','/oracle/dados/RMANDB/BACKUP2/%U';
SET BACKUP COPIES 2;
BACKUP DATABASE;
}2> 3> 4> 5>
released channel: ORA_DISK_1
allocated channel: C1
channel C1: SID=74 device type=DISK
executing command: SET BACKUP COPIES
Starting backup at 2021-05-03:05:42:43
channel C1: starting full datafile backup set
channel C1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oracle/dados/RMANDB/datafile/o1_mf_system_h8nynqfx_.dbf
input datafile file number=00003 name=/oracle/dados/RMANDB/datafile/o1_mf_sysaux_h8nyq35q_.dbf
input datafile file number=00004 name=/oracle/dados/RMANDB/datafile/o1_mf_undotbs1_h8nyrjdr_.dbf
input datafile file number=00005 name=/oracle/dados/RMANDB/datafile/ts_cortex_catalog.dbf
input datafile file number=00007 name=/oracle/dados/RMANDB/datafile/o1_mf_users_h8nyrkn7_.dbf
channel C1: starting piece 1 at 2021-05-03:05:42:43
channel C1: finished piece 1 at 2021-05-03:05:43:18 with 2 copies and tag TAG20210503T054243
piece handle=/oracle/dados/RMANDB/BACKUP1/bqvtt6qj_1_1 comment=NONE
piece handle=/oracle/dados/RMANDB/BACKUP2/bqvtt6qj_1_2 comment=NONE
channel C1: backup set complete, elapsed time: 00:00:35
Finished backup at 2021-05-03:05:43:18
Starting Control File and SPFILE Autobackup at 2021-05-03:05:43:18
piece handle=/oracle/fra/RMANDB/autobackup/2021_05_03/o1_mf_s_1071553398_j8zfx6x9_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2021-05-03:05:43:21
released channel: C1
RMAN> LIST BACKUP OF DATABASE;
List of Backup Sets
===================
BS Key Type LV Size
------- ---- -- ----------
299 Full 1.27G
List of Datafiles in backup set 299
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- ------------------- ----------- ------ ----
1 Full 2656368 2021-05-03:05:42:43 NO /oracle/dados/RMANDB/datafile/o1_mf_system_h8nynqfx_.dbf
3 Full 2656368 2021-05-03:05:42:43 NO /oracle/dados/RMANDB/datafile/o1_mf_sysaux_h8nyq35q_.dbf
4 Full 2656368 2021-05-03:05:42:43 NO /oracle/dados/RMANDB/datafile/o1_mf_undotbs1_h8nyrjdr_.dbf
5 Full 2656368 2021-05-03:05:42:43 NO /oracle/dados/RMANDB/datafile/ts_cortex_catalog.dbf
7 Full 2656368 2021-05-03:05:42:43 NO /oracle/dados/RMANDB/datafile/o1_mf_users_h8nyrkn7_.dbf
Backup Set Copy #1 of backup set 299
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ ------------------- ---------- ---
DISK 00:00:16 2021-05-03:05:43:11 NO TAG20210503T054243
List of Backup Pieces for backup set 299 Copy #1
BP Key Pc# Status Piece Name
------- --- ----------- ----------
316 1 AVAILABLE /oracle/dados/RMANDB/BACKUP1/bqvtt6qj_1_1
Backup Set Copy #2 of backup set 299
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ ------------------- ---------- ---
DISK 00:00:16 2021-05-03:05:43:11 NO TAG20210503T054243
List of Backup Pieces for backup set 299 Copy #2
BP Key Pc# Status Piece Name
------- --- ----------- ----------
317 1 AVAILABLE /oracle/dados/RMANDB/BACKUP2/bqvtt6qj_1_2
RMAN> host 'ls -lthr /oracle/dados/RMANDB/BACKUP1/';
total 1.3G
-rw-r-----. 1 oracle oinstall 1.3G May 3 05:42 bqvtt6qj_1_1
host command complete
RMAN> host 'ls -lthr /oracle/dados/RMANDB/BACKUP2/';
total 1.3G
-rw-r-----. 1 oracle oinstall 1.3G May 3 05:43 bqvtt6qj_1_2
host command complete
Backup command level
Realizando processo diretamente pelo comando de backup, conforme modelo abaixo:
BACKUP AS BACKUPSET COPIES n ... FORMAT <dest1>,<dest2>;
Simulando backup do banco:
RMAN> BACKUP AS BACKUPSET COPIES 2 DATABASE FORMAT '/oracle/dados/RMANDB/BACKUP1/%U','/oracle/dados/RMANDB/BACKUP2/%U';
Starting backup at 2021-05-03:05:55:24
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=00001 name=/oracle/dados/RMANDB/datafile/o1_mf_system_h8nynqfx_.dbf
input datafile file number=00003 name=/oracle/dados/RMANDB/datafile/o1_mf_sysaux_h8nyq35q_.dbf
input datafile file number=00004 name=/oracle/dados/RMANDB/datafile/o1_mf_undotbs1_h8nyrjdr_.dbf
input datafile file number=00005 name=/oracle/dados/RMANDB/datafile/ts_cortex_catalog.dbf
input datafile file number=00007 name=/oracle/dados/RMANDB/datafile/o1_mf_users_h8nyrkn7_.dbf
channel ORA_DISK_1: starting piece 1 at 2021-05-03:05:55:24
channel ORA_DISK_1: finished piece 1 at 2021-05-03:05:55:59 with 2 copies and tag TAG20210503T055524
piece handle=/oracle/dados/RMANDB/BACKUP1/c2vtt7ic_1_1 comment=NONE
piece handle=/oracle/dados/RMANDB/BACKUP2/c2vtt7ic_1_2 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
Finished backup at 2021-05-03:05:55:59
Starting Control File and SPFILE Autobackup at 2021-05-03:05:55:59
piece handle=/oracle/fra/RMANDB/autobackup/2021_05_03/o1_mf_s_1071554159_j8zgo078_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2021-05-03:05:56:00
RMAN> LIST BACKUP OF DATABASE;
List of Backup Sets
===================
BS Key Type LV Size
------- ---- -- ----------
307 Full 1.27G
List of Datafiles in backup set 307
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- ------------------- ----------- ------ ----
1 Full 2657016 2021-05-03:05:55:24 NO /oracle/dados/RMANDB/datafile/o1_mf_system_h8nynqfx_.dbf
3 Full 2657016 2021-05-03:05:55:24 NO /oracle/dados/RMANDB/datafile/o1_mf_sysaux_h8nyq35q_.dbf
4 Full 2657016 2021-05-03:05:55:24 NO /oracle/dados/RMANDB/datafile/o1_mf_undotbs1_h8nyrjdr_.dbf
5 Full 2657016 2021-05-03:05:55:24 NO /oracle/dados/RMANDB/datafile/ts_cortex_catalog.dbf
7 Full 2657016 2021-05-03:05:55:24 NO /oracle/dados/RMANDB/datafile/o1_mf_users_h8nyrkn7_.dbf
Backup Set Copy #1 of backup set 307
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ ------------------- ---------- ---
DISK 00:00:16 2021-05-03:05:55:54 NO TAG20210503T055524
List of Backup Pieces for backup set 307 Copy #1
BP Key Pc# Status Piece Name
------- --- ----------- ----------
325 1 AVAILABLE /oracle/dados/RMANDB/BACKUP1/c2vtt7ic_1_1
Backup Set Copy #2 of backup set 307
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ ------------------- ---------- ---
DISK 00:00:16 2021-05-03:05:55:54 NO TAG20210503T055524
List of Backup Pieces for backup set 307 Copy #2
BP Key Pc# Status Piece Name
------- --- ----------- ----------
326 1 AVAILABLE /oracle/dados/RMANDB/BACKUP2/c2vtt7ic_1_2
Simulando backup dos archivelogs:
RMAN> BACKUP AS BACKUPSET COPIES 2 ARCHIVELOG ALL FORMAT '/oracle/dados/RMANDB/BACKUP1/%U','/oracle/dados/RMANDB/BACKUP2/%U';
Starting backup at 2021-05-03:05:57:09
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=68 RECID=75 STAMP=1069389781
input archived log thread=1 sequence=69 RECID=77 STAMP=1069390191
input archived log thread=1 sequence=70 RECID=78 STAMP=1069391841
input archived log thread=1 sequence=71 RECID=79 STAMP=1069392032
input archived log thread=1 sequence=72 RECID=80 STAMP=1069392053
input archived log thread=1 sequence=73 RECID=83 STAMP=1069392224
input archived log thread=1 sequence=74 RECID=84 STAMP=1069392226
input archived log thread=1 sequence=75 RECID=85 STAMP=1069430460
input archived log thread=1 sequence=76 RECID=86 STAMP=1069567218
input archived log thread=1 sequence=77 RECID=87 STAMP=1069581356
input archived log thread=1 sequence=78 RECID=88 STAMP=1070953640
input archived log thread=1 sequence=79 RECID=89 STAMP=1070992854
input archived log thread=1 sequence=80 RECID=90 STAMP=1071054025
input archived log thread=1 sequence=81 RECID=91 STAMP=1071075652
input archived log thread=1 sequence=82 RECID=92 STAMP=1071117108
input archived log thread=1 sequence=83 RECID=93 STAMP=1071140420
input archived log thread=1 sequence=84 RECID=94 STAMP=1071180017
input archived log thread=1 sequence=85 RECID=95 STAMP=1071190844
input archived log thread=1 sequence=86 RECID=96 STAMP=1071205211
input archived log thread=1 sequence=87 RECID=97 STAMP=1071205218
input archived log thread=1 sequence=88 RECID=98 STAMP=1071219611
input archived log thread=1 sequence=89 RECID=99 STAMP=1071376111
input archived log thread=1 sequence=90 RECID=100 STAMP=1071381640
input archived log thread=1 sequence=91 RECID=101 STAMP=1071396592
input archived log thread=1 sequence=92 RECID=102 STAMP=1071411059
input archived log thread=1 sequence=93 RECID=103 STAMP=1071552261
input archived log thread=1 sequence=94 RECID=104 STAMP=1071553535
input archived log thread=1 sequence=95 RECID=105 STAMP=1071553599
input archived log thread=1 sequence=96 RECID=106 STAMP=1071553824
input archived log thread=1 sequence=97 RECID=107 STAMP=1071554229
channel ORA_DISK_1: starting piece 1 at 2021-05-03:05:57:09
channel ORA_DISK_1: finished piece 1 at 2021-05-03:05:57:34 with 2 copies and tag TAG20210503T055709
piece handle=/oracle/dados/RMANDB/BACKUP1/c4vtt7ll_1_1 comment=NONE
piece handle=/oracle/dados/RMANDB/BACKUP2/c4vtt7ll_1_2 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
Finished backup at 2021-05-03:05:57:34
Starting Control File and SPFILE Autobackup at 2021-05-03:05:57:35
piece handle=/oracle/fra/RMANDB/autobackup/2021_05_03/o1_mf_s_1071554255_j8zgqzl1_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2021-05-03:05:57:36
RMAN> LIST BACKUP OF ARCHIVELOG ALL;
List of Backup Sets
===================
BS Key Size
------- ----------
309 782.54M
List of Archived Logs in backup set 309
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- ------------------- ---------- ---------
1 68 2255756 2021-03-28:10:39:58 2262113 2021-04-09:04:43:00
1 69 2262113 2021-04-09:04:43:00 2262505 2021-04-09:04:49:50
1 70 2262505 2021-04-09:04:49:50 2265296 2021-04-09:05:17:21
1 71 2265296 2021-04-09:05:17:21 2265473 2021-04-09:05:20:32
1 72 2265473 2021-04-09:05:20:32 2265531 2021-04-09:05:20:53
1 73 2265531 2021-04-09:05:20:53 2265643 2021-04-09:05:23:29
1 74 2265643 2021-04-09:05:23:29 2265663 2021-04-09:05:23:44
1 75 2265663 2021-04-09:05:23:44 2290054 2021-04-09:16:01:00
1 76 2290054 2021-04-09:16:01:00 2314554 2021-04-11:06:00:15
1 77 2314554 2021-04-11:06:00:15 2328698 2021-04-11:09:55:53
1 78 2328698 2021-04-11:09:55:53 2332924 2021-04-27:07:07:17
1 79 2332924 2021-04-27:07:07:17 2358174 2021-04-27:18:00:52
1 80 2358174 2021-04-27:18:00:52 2381091 2021-04-28:11:00:22
1 81 2381091 2021-04-28:11:00:22 2394102 2021-04-28:17:00:49
1 82 2394102 2021-04-28:17:00:49 2500292 2021-04-29:04:31:47
1 83 2500292 2021-04-29:04:31:47 2519661 2021-04-29:11:00:18
1 84 2519661 2021-04-29:11:00:18 2546021 2021-04-29:22:00:14
1 85 2546021 2021-04-29:22:00:14 2559326 2021-04-30:01:00:41
1 86 2559326 2021-04-30:01:00:41 2570072 2021-04-30:05:00:08
1 87 2570072 2021-04-30:05:00:08 2570544 2021-04-30:05:00:15
1 88 2570544 2021-04-30:05:00:15 2580734 2021-04-30:09:00:09
1 89 2580734 2021-04-30:09:00:09 2607950 2021-05-01:04:28:27
1 90 2607950 2021-05-01:04:28:27 2620519 2021-05-01:06:00:37
1 91 2620519 2021-05-01:06:00:37 2634806 2021-05-01:10:09:50
1 92 2634806 2021-05-01:10:09:50 2648651 2021-05-01:14:10:57
1 93 2648651 2021-05-01:14:10:57 2655511 2021-05-03:05:24:19
1 94 2655511 2021-05-03:05:24:19 2656517 2021-05-03:05:45:34
1 95 2656517 2021-05-03:05:45:34 2656617 2021-05-03:05:46:39
1 96 2656617 2021-05-03:05:46:39 2656827 2021-05-03:05:50:24
1 97 2656827 2021-05-03:05:50:24 2657118 2021-05-03:05:57:09
Backup Set Copy #1 of backup set 309
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ ------------------- ---------- ---
DISK 00:00:06 2021-05-03:05:57:27 NO TAG20210503T055709
List of Backup Pieces for backup set 309 Copy #1
BP Key Pc# Status Piece Name
------- --- ----------- ----------
328 1 AVAILABLE /oracle/dados/RMANDB/BACKUP1/c4vtt7ll_1_1
Backup Set Copy #2 of backup set 309
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ ------------------- ---------- ---
DISK 00:00:06 2021-05-03:05:57:27 NO TAG20210503T055709
List of Backup Pieces for backup set 309 Copy #2
BP Key Pc# Status Piece Name
------- --- ----------- ----------
329 1 AVAILABLE /oracle/dados/RMANDB/BACKUP2/c4vtt7ll_1_2
É possível utilizar este método sem a necessidade de informar os locais de destino caso o parâmetro do RMAN abaixo esteja configurado:
RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/oracle/dados/RMANDB/BACKUP1/%U','/oracle/dados/RMANDB/BACKUP2/%U';
new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/oracle/dados/RMANDB/BACKUP1/%U', '/oracle/dados/RMANDB/BACKUP2/%U';
new RMAN configuration parameters are successfully stored
released channel: ORA_DISK_1
Resultado dos backups duplicados:
RMAN> BACKUP AS BACKUPSET COPIES 2 DATABASE;
Starting backup at 2021-05-03:06:07:55
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=74 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=00001 name=/oracle/dados/RMANDB/datafile/o1_mf_system_h8nynqfx_.dbf
input datafile file number=00003 name=/oracle/dados/RMANDB/datafile/o1_mf_sysaux_h8nyq35q_.dbf
input datafile file number=00004 name=/oracle/dados/RMANDB/datafile/o1_mf_undotbs1_h8nyrjdr_.dbf
input datafile file number=00005 name=/oracle/dados/RMANDB/datafile/ts_cortex_catalog.dbf
input datafile file number=00007 name=/oracle/dados/RMANDB/datafile/o1_mf_users_h8nyrkn7_.dbf
channel ORA_DISK_1: starting piece 1 at 2021-05-03:06:07:55
channel ORA_DISK_1: finished piece 1 at 2021-05-03:06:08:30 with 2 copies and tag TAG20210503T060755
piece handle=/oracle/dados/RMANDB/BACKUP1/c6vtt89r_1_1 comment=NONE
piece handle=/oracle/dados/RMANDB/BACKUP2/c6vtt89r_1_2 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
Finished backup at 2021-05-03:06:08:30
Starting Control File and SPFILE Autobackup at 2021-05-03:06:08:30
piece handle=/oracle/fra/RMANDB/autobackup/2021_05_03/o1_mf_s_1071554910_j8zhdh62_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2021-05-03:06:08:31
RMAN> LIST BACKUP OF DATABASE;
List of Backup Sets
===================
BS Key Type LV Size
------- ---- -- ----------
311 Full 1.28G
List of Datafiles in backup set 311
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- ------------------- ----------- ------ ----
1 Full 2658085 2021-05-03:06:07:55 NO /oracle/dados/RMANDB/datafile/o1_mf_system_h8nynqfx_.dbf
3 Full 2658085 2021-05-03:06:07:55 NO /oracle/dados/RMANDB/datafile/o1_mf_sysaux_h8nyq35q_.dbf
4 Full 2658085 2021-05-03:06:07:55 NO /oracle/dados/RMANDB/datafile/o1_mf_undotbs1_h8nyrjdr_.dbf
5 Full 2658085 2021-05-03:06:07:55 NO /oracle/dados/RMANDB/datafile/ts_cortex_catalog.dbf
7 Full 2658085 2021-05-03:06:07:55 NO /oracle/dados/RMANDB/datafile/o1_mf_users_h8nyrkn7_.dbf
Backup Set Copy #1 of backup set 311
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ ------------------- ---------- ---
DISK 00:00:16 2021-05-03:06:08:25 NO TAG20210503T060755
List of Backup Pieces for backup set 311 Copy #1
BP Key Pc# Status Piece Name
------- --- ----------- ----------
331 1 AVAILABLE /oracle/dados/RMANDB/BACKUP1/c6vtt89r_1_1
Backup Set Copy #2 of backup set 311
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ ------------------- ---------- ---
DISK 00:00:16 2021-05-03:06:08:25 NO TAG20210503T060755
List of Backup Pieces for backup set 311 Copy #2
BP Key Pc# Status Piece Name
------- --- ----------- ----------
332 1 AVAILABLE /oracle/dados/RMANDB/BACKUP2/c6vtt89r_1_2
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.