RMAN in RAC environment

Configuring parameters in RMAN
==========================
RMAN> CONFIGURE BACKUP OPTIMIZATION ON;
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
RMAN> CONFIGURE CHANNEL 1 DEVICE TYPE SBT_TAPE CONNECT 'SYS/<password>@nplprd1'; # for RAC
RMAN> CONFIGURE CHANNEL 2 DEVICE TYPE SBT_TAPE CONNECT 'SYS/<password>@nplprd2'; # for RAC
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 2;
RMAN> CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2;
RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 84 DAYS;
 
The configuration are written into the control file and then synced to the catalog.
You can view the configured parameters via the command SHOW ALL
 
RMAN> show all;
 
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE CHANNEL 1 DEVICE TYPE DISK CONNECT '*';
CONFIGURE CHANNEL 2 DEVICE TYPE DISK CONNECT '*';
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS  'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=nplprd,OB2BARLIST=nplprd_weekly)' FORMAT   'nplprd_weekly<nplprd_%s:%t:%p>.dbf';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/software/oracle/DB10gR2/dbs/snapcf_nplprd1.f'; # default
 
Tarameters that has not been changed has # default at the end of the line.
The parameters can be selected also from the target database using:
 
SQL> col CONF# for 9999
SQL> col NAME for a25
SQL> col VALUE for a60
SQL> set lines 100
SQL> select * from v$rman_configuration;
CONF# NAME                      VALUE
----- ------------------------- ------------------------------------------------------------
    1 BACKUP OPTIMIZATION       ON
    2 CONTROLFILE AUTOBACKUP    ON
    3 CHANNEL                   1 DEVICE TYPE DISK CONNECT  'SYS/<password>@nplprd1'
    4 CHANNEL                   2 DEVICE TYPE DISK CONNECT  'SYS/<password>@nplprd2'
    5 CHANNEL                   DEVICE TYPE 'SBT_TAPE' PARMS  'ENV=(OB2BARTYPE=Oracle8,OB2AP
                                PNAME=nplprd,OB2BARLIST=nplprd_weekly)' FORMAT   'nplprd_wee
                                kly<nplprd_%s:%t:%p>.dbf'
    7 DEFAULT DEVICE TYPE TO    'SBT_TAPE'
    8 DEVICE TYPE               DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET
    9 DEVICE TYPE               'SBT_TAPE' PARALLELISM 2 BACKUP TYPE TO BACKUPSET
 
CONF# 5 is there because of configure command that is issued at our last backup, see backup command at the end of this post.
The same output can be queried from the rman catalog database with the following command:
 
SQL> select CONF#,NAME,VALUE  from rc_rman_configuration;
 
The configuration is also written to the trace file that is generated in the command:
 
SQL> alter database backup controlfile to trace;
 
In the trace file we will see:
 
-- Configure RMAN configuration record 1
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('BACKUP OPTIMIZATION','ON');
-- Configure RMAN configuration record 2
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CONTROLFILE AUTOBACKUP','ON');
-- Configure RMAN configuration record 3
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CHANNEL','1 DEVICE TYPE DISK CONNECT 
''SYS/<password>@nplprd1''');
-- Configure RMAN configuration record 4
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CHANNEL','2 DEVICE TYPE DISK CONNECT 
''SYS/<password>@nplprd2''');
-- Configure RMAN configuration record 5
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('prd_%s:%t:%p>.dbf''','DEVICE TYPE ''SBT_TAPE'' PARMS  ''ENV=(OB2BARTYPE=Oracle8,OB2APPNAME
=nplprd,OB2BARLIST=nplprd_weekly)'' FORMAT   ''nplprd_weekly<nplprd_%s:%t:%p>.dbf''');
-- Configure RMAN configuration record 7
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('DEFAULT DEVICE TYPE TO','''SBT_TAPE''');
-- Configure RMAN configuration record 8
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('DEVICE TYPE','DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET');
-- Configure RMAN configuration record 9
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('DEVICE TYPE','''SBT_TAPE'' PARALLELISM 2 BACKUP TYPE TO BACKUPSET');
 
Clearing configuration parameters
===========================
Configuration can be cleared in RMAN with the word CLEAR instead of the old value, for example:
 
RMAN> CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' CLEAR;
This command can also be done at the target database using the package dbms_backup_restore, for example if we want to clear conf# 5 we will run:
 
SQL> exec dbms_backup_restore.deleteconfig(5);

Debugging in RMAN
================
RMAN> spool trace to '/tmp/rman_debug';
RMAN> debug on;
RMAN> .
RMAN> .
RMAN> .
RMAN> debug off;
RMAN> spool trace off;
 
Enabling block change tracking
=========================
For faster incremental backups we can use the new feature introduced in 10g of change tracking via external file.
This file is not backed up since it is relevant only for backups and not used when using restore,
so if the file is corrupted or deleted, nothing will happen except for the next incremental backup that will take more time then usual.
To enable this feature, run the following command on the target database.
 
SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING;
 
Since we are using OMF on ASM no need to specify file location, to identify its location, run the following command:
SQL> col FILENAME for a50
SQL> SELECT * FROM V$BLOCK_CHANGE_TRACKING;

STATUS     FILENAME                                                BYTES
---------- -------------------------------------------------- ----------
ENABLED    +DATA/nplprd/changetracking/ctf.290.622221583        11599872
 

Finally, the backup command
========================
RMAN> run {
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS  'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=nplprd,OB2BARLIST=nplprd_weekly)' FORMAT 'nplprd_weekly<nplprd_%s:%t:%p>.dbf';
show all;
backup incremental level 1
 database;
backup
 archivelog all;
DELETE ARCHIVELOG ALL BACKED UP 2 TIMES TO DEVICE TYPE sbt_tape;
DELETE FORCE NOPROMPT OBSOLETE;
}
 

Comments

Popular posts from this blog

Install Oracle Internet Directory (OID) in Standalone mode

Data Guard - Changing IP Addresses

Fixing & Registering ORACLE_HOMES in Central Inventory