Tuesday, June 4, 2013

RMAN Backup scenarios

Always BEST to set: configure controlfile autobackup to on;
                                                                        --------
7-1. Specifying Image Copy or Backup Set Output
RMAN> backup as backupset
database;

RMAN> backup as backupset
device type sbt
database;

RMAN> backup as copy
database;

RMAN> backup
database
format= '/u01/backup_%U ';

RMAN> backup
database
format '+dgroup1';                               --à for ASM

RMAN> backup
database
tag 'weekly_backup';


7-2. Backing Up the Control File
RMAN> configure controlfile autobackup on; 
[OR]
RMAN> backup current controlfile;
RMAN> backup tablespace users include current controlfile;


7-3. Backing Up the Server Parameter File
RMAN> backup spfile;


7-4. Backing Up Datafiles
RMAN> backup  as copy datafile 1,2,3,4
format '/u01/app/oracle/rman/%d_%U.bus';


7-5. Backing Up Tablespaces

RMAN> backup tablespace users, tools;

RMAN> backup tablespace system format '/ora01/prod1/%d_%U.bus';

RMAN> backup as copy tablespace users;

RMAN> backup incremental level 1 tablespace example;



7-6.Making a Whole-Database Backup


RMAN> backup database;                -->    Datafile + Controlfile + SPFile


RMAN> SQL "alter system archive log current"; -à to archive all the redo log generated during the
above backup was going on…


7-7. Backing Up Archived Redo Logs

RMAN> backup archivelog all;

RMAN> backup device type sbt
archivelog like '/disk%arc%'
delete all input;


RMAN> backup database plus archivelog
The above command does the below sequence of steps:

1. Run the alter system archive log current command.
2. Run the backup archivelog all command.
3. Back up the rest of the datafiles specified by the backup database command.
4. Run the alter system archive log current command.
5. Back up the new archive logs generated during the backup operation.


7-8. Backing Up Everything [ datafile+controlfile+archived log file+spfile]
RMAN> configure controlfile autobackup on;
+
RMAN> backup database plus archivelog;

7-9. Incremental backup:
RMAN> list backup by file;
RMAN> backup incremental level 0 database;
RMAN> backup incremental level 1 database;
RMAN> backup incremental level 1 cumulative database;
You can’t perform an incremental copy of a control file, archived redo log, or backup set.


7-19.Making a Compressed Backup   [binary compressed backup]

RMAN> backup
as compressed backupset
database plus archivelog;


7-20. Parallelizing Backups

run
{
allocate channel ch1 device type sbt
parms 'env=(ob_device_1=testtape1)';        
allocate channel ch2 device type sbt
parms 'env=(ob_device_2=testtape12';
backup
database channel ch1
archivelog all channel ch2;
}

OB_DEVICE[_n] --->  parameter to define which tape drives can be used for backups.



PARALLESISM :
RMAN> configure device type disk parallelism 4;
+
run
{
allocate channel d1 device type disk format '/u01/%d_backups/%U';
allocate channel d2 device type disk format '/u02/%d_backups/%U';
allocate channel d3 device type disk format '/u03/%d_backups/%U';
allocate channel d4 device type disk format '/u04/%d_backups/%U';
backup database;
}

If you want to configure persistent backup parallelism

1. First specify the degree of parallelism for the device type you want:
    configure device type disk parallelism 4;
2. Secondly, configure channels:
    configure channel 1 device type disk format '/u01/%d_backups/%U';
    configure channel 2 device type disk format '/u02/%d_backups/%U';
    configure channel 3 device type disk format '/u03/%d_backups/%U';
    configure channel 4 device type disk format '/u04/%d_backups/%U';

No comments:

Post a Comment

Oracle row type vs PostgreSQL record

The Oracle row type concept can be accomplished with the record type in PostgreSQL. Example: Oracle: CURSOR travel_cur IS  SELECT  c.travel_...