Paralleles Backup in RAC über mehrere Instanzen

In RAC kann eine parallelisierte Sicherung mit dem Recovery Manager über mehrere Instanzen durchgeführt werden. Dieses kannn zum einen durch direkte Allokierung mehrere Kanäle auf die einzelnen Instanzen erfolgen:

RMAN>  run

2> {
3> allocate channel c1 device type disk connect 'sys/oracle@rac1:1521/orcl.localdomain';
4> allocate channel c2 device type disk connect 'sys/oracle@rac2:1521/orcl.localdomain';
5> backup as compressed backupset database;
6> }

allocated channel: c1
channel c1: SID=55 instance=orcl1 device type=DISK

allocated channel: c2
channel c2: SID=57 instance=orcl2 device type=DISK

Starting backup at 12-APR-12
channel c1: starting compressed full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/racdisk/oradata/orcl/system01.dbf
input datafile file number=00004 name=/u01/racdisk/oradata/orcl/users01.dbf
input datafile file number=00003 name=/u01/racdisk/oradata/orcl/undotbs01.dbf
channel c1: starting piece 1 at 12-APR-12
channel c2: starting compressed full datafile backup set
channel c2: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/racdisk/oradata/orcl/sysaux01.dbf
input datafile file number=00005 name=/u01/racdisk/oradata/orcl/example01.dbf
input datafile file number=00006 name=/u01/racdisk/oradata/orcl/undotbs02.dbf
channel c2: starting piece 1 at 12-APR-12
channel c2: finished piece 1 at 12-APR-12
piece handle=/u01/racdisk/flash_recovery_area/ORCL/backupset/2012_04_12/o1_mf_nnndf_TAG20120412T135356__2eb69bd.bkp tag=TAG20120412T135356 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:57
channel c1: finished piece 1 at 12-APR-12
piece handle=/u01/racdisk/flash_recovery_area/ORCL/backupset/2012_04_12/o1_mf_nnndf_TAG20120412T135356__2c7ced0.bkp tag=TAG20120412T135356 comment=NONE
channel c1: backup set complete, elapsed time: 00:01:08
Finished backup at 12-APR-12

Starting Control File and SPFILE Autobackup at 12-APR-12
piece handle=/u01/racdisk/flash_recovery_area/ORCL/autobackup/2012_04_12/o1_mf_s_780414904__6d69a88.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 12-APR-12
released channel: c1
released channel: c2

Durch Abfrage der View gv$session_longops werden die einzelnen Prozesse des Sicherungsvorgangs angezeigt. Das unten ausgegebene Beispiel zeigt die Ausführung über die Instanz 1 und 2.

SQL> SELECT INST_ID, TOTALWORK, SOFAR, OPNAME

2 FROM GV$SESSION_LONGOPS
3 WHERE OPNAME LIKE 'RMAN: full datafile%' AND SOFAR<>TOTALWORK;

INST_ID  TOTALWORK      SOFAR OPNAME
---------- ---------- ---------- ------------------------------
2      88960      69630 RMAN: full datafile backup
2          0      51108 RMAN: full datafile backup
1      94720      66814 RMAN: full datafile backup
1          0      51836 RMAN: full datafile backup

Werden nicht mehrere Kanäle erstellt, so wird die Sicherung nur auf dem Knoten gestartet, mit dem der Recovery Manager verbunden ist.

RMAN> show all;

RMAN configuration parameters for database with db_unique_name ORCL are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/racdisk/flash_recovery_area/controlfilesnap/snapcf_orcl1.f';

 

RMAN> backup as compressed backupset database;

Starting backup at 12-APR-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=43 instance=orcl1 device type=DISK
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/racdisk/oradata/orcl/system01.dbf
input datafile file number=00002 name=/u01/racdisk/oradata/orcl/sysaux01.dbf
input datafile file number=00005 name=/u01/racdisk/oradata/orcl/example01.dbf
input datafile file number=00003 name=/u01/racdisk/oradata/orcl/undotbs01.dbf
input datafile file number=00006 name=/u01/racdisk/oradata/orcl/undotbs02.dbf
input datafile file number=00004 name=/u01/racdisk/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at 12-APR-12
channel ORA_DISK_1: finished piece 1 at 12-APR-12
piece handle=/u01/racdisk/flash_recovery_area/ORCL/backupset/2012_04_12/o1_mf_nnndf_TAG20120412T135717__ee7ae45.bkp tag=TAG20120412T135717 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:15
Finished backup at 12-APR-12

Starting Control File and SPFILE Autobackup at 12-APR-12
piece handle=/u01/racdisk/flash_recovery_area/ORCL/autobackup/2012_04_12/o1_mf_s_780415114__1357f283.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 12-APR-12

 

Die Abfrage der View gv$session_longops zeigt die Verwendung nur einer Instanz.

SQL> SELECT INST_ID, TOTALWORK, SOFAR, OPNAME

2 FROM GV$SESSION_LONGOPS
3 WHERE OPNAME LIKE 'RMAN: full datafile%' AND SOFAR<>TOTALWORK;

INST_ID  TOTALWORK      SOFAR OPNAME
---------- ---------- ---------- ------------------------------
1     183680      34298 RMAN: full datafile backup
1          0      17126 RMAN: full datafile backup

Um eine manuelle Allokierung der Kanäle bei einer parallelen Sicherung über mehrere Instanzen überflüssig zu machen, können diese Kanäle direkt vorkonfiguriert werden.

RMAN> configure channel 1 device type disk connect 'sys/oracle@rac1:1521/orcl.localdomain';

new RMAN configuration parameters:
CONFIGURE CHANNEL 1 DEVICE TYPE DISK CONNECT '*';
new RMAN configuration parameters are successfully stored

RMAN> configure channel 2 device type disk connect 'sys/oracle@rac2:1521/orcl.localdomain';

new RMAN configuration parameters:
CONFIGURE CHANNEL 2 DEVICE TYPE DISK CONNECT '*';
new RMAN configuration parameters are successfully stored

Zusätzlich muss der standardisierte Parallelisierungsgrad entsprechend angepasst werden.

RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;

old RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters are successfully stored

Bei der Durchführung der Sicherung müssen die Kanäle nun nicht mehr erstellt werden, dieses erfolgt automatisch:

RMAN> backup as compressed backupset database;

Starting backup at 12-APR-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=55 instance=orcl1 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=57 instance=orcl2 device type=DISK
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/racdisk/oradata/orcl/system01.dbf
input datafile file number=00004 name=/u01/racdisk/oradata/orcl/users01.dbf
input datafile file number=00003 name=/u01/racdisk/oradata/orcl/undotbs01.dbf
channel ORA_DISK_1: starting piece 1 at 12-APR-12
channel ORA_DISK_2: starting compressed full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/racdisk/oradata/orcl/sysaux01.dbf
input datafile file number=00005 name=/u01/racdisk/oradata/orcl/example01.dbf
input datafile file number=00006 name=/u01/racdisk/oradata/orcl/undotbs02.dbf
channel ORA_DISK_2: starting piece 1 at 12-APR-12
channel ORA_DISK_2: finished piece 1 at 12-APR-12
piece handle=/u01/racdisk/flash_recovery_area/ORCL/backupset/2012_04_12/o1_mf_nnndf_TAG20120412T140721__330dca63.bkp tag=TAG20120412T140721 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:59
channel ORA_DISK_1: finished piece 1 at 12-APR-12
piece handle=/u01/racdisk/flash_recovery_area/ORCL/backupset/2012_04_12/o1_mf_nnndf_TAG20120412T140721__32de0c3b.bkp tag=TAG20120412T140721 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:10
Finished backup at 12-APR-12

Starting Control File and SPFILE Autobackup at 12-APR-12
piece handle=/u01/racdisk/flash_recovery_area/ORCL/autobackup/2012_04_12/o1_mf_s_780415712__36ffefe1.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 12-APR-12

Die View gv$session_longops zeigt nun wieder die Verwendung mehrere Instanzen für die Durchführung der Sicherung.

SQL> SELECT INST_ID, TOTALWORK, SOFAR, OPNAME

2 FROM GV$SESSION_LONGOPS
3 WHERE OPNAME LIKE 'RMAN: full datafile%' AND SOFAR<>TOTALWORK;

INST_ID  TOTALWORK      SOFAR OPNAME
---------- ---------- ---------- ------------------------------
1      94720      32638 RMAN: full datafile backup
1          0      19247 RMAN: full datafile backup
2      88960      19324 RMAN: full datafile backup
2          0      12858 RMAN: full datafile backup