========
Rman can back up the following types of files:
=========
• Archived redo log files
• Backup pieces
• Control files
• Datafiles Spfile
• spfile.
Note: It is ABCDS
RMAN will back up full backups, incremental backups, control file autobackups, and archive redo
log files. Keep in mind that flashback logs, online redo log files, and the current control file are not backed up.
Note: Always enable the autobackup for spfile (only backed up if db starting using spfile) and control file feature.
=====
RMAN> configure controlfile autobackup on;
RMAN> configure spfile autobackup on;
========
How to configure RMAN to write to specific locations on disk.
RMAN> configure channel 1 device type disk format ‘/ora01/rman/rman1_%U.bk’;
Note: CONFIGURE command must be executed before you run the BACKUP command.
=========
Backup Database.
=========
The term “RMAN level 0 incremental backup” doesn’t exactly describe itself very well, either. A level
0 incremental backup is backing up the exact same blocks as a full backup. In other words, the following
two commands back up the exact same blocks in a database:
RMAN> backup as backupset full database;
RMAN> backup as backupset incremental level=0 database;
RMAN> backup database not backed up since time=’sysdate-1′;
RMAN> backup database skip readonly skip offline skip inaccessible; backup database skip offline;
RMAN> backup database skip readonly;
RMAN> backup database skip inaccessible;
————-
Backup Sets versus Image Copies
The default backup mode of RMAN instructs it to only back up blocks that have been used in a datafile;
these are known as backup sets. RMAN can also make byte-for-byte copies of the datafiles; these are
known as image copies. Creating a backup set is the default type of backup that RMAN creates. The next
command creates a backup set backup of the database:
RMAN> backup database; backup as backupset database;
You can instruct RMAN to create image copies by using the AS COPY command. The following
creates image copies of every datafile in the database:
RMAN> backup as copy database; backup incremental level=0 database plus archivelog;
=======
Backup tablespace.
======
RMAN> backup tablespace system, sysaux;
RMAN> configure exclude for tablespace users; configure exclude for tablespace users clear; <== to clear the excluded tablespace.
=======
Backup datafile.
======
RMAN> backup datafile ‘/app/sanjay/11R2/system01.dbf’;
RMAN> backup datafile 1,5;
RMAN> backup as copy datafile 3;
RMAN> backup incremental level 1 datafile 4;
RMAN> backup database not backed up; <== To backup the datafile not backed up.
=======
Backup controlfile.
======
RMAN> backup current controlfile;
RMAN> configure controlfile autobackup format for device type disk to ‘/app/sanjay/rman/rman_ctl_%F.bk’;
=======
Backup spfile.
======
RMAN> backup spfile;
Note: RMAN can only back up the spfile if the instance was started using a spfile.
=========
Backup Archive logs.
=========
RMAN> backup archivelog all;
RMAN> backup archivelog all delete input;
RMAN> backup archivelog sequence 300;
RMAN> backup archivelog sequence between 300 and 400 thread 1;
RMAN> backup archivelog from time “sysdate-7″ until time “sysdate-1″;