If you’re not sure where RMAN will be backing up your database files, you need to read the article, because it describes how to configure RMAN to create the backup files in the location of your choice. Here is how I usually configure RMAN to write to specific locations on disk (note that the CONFIGURE command must be executed before you run the BACKUP command):
RMAN> configure channel 1 device type disk format '/u01/O12C/rman/rman1_%U.bk';
After a backup location is configured, I almost always use a command similar to the one shown next to back up the entire database:
RMAN> backup incremental level=0 database plus archivelog;
This command ensures that RMAN will back up all data files in the database, all available archive redo logs generated prior to the backup, and all archive redo logs generated during the backup. This command also ensures that you have all the data files and archive redo logs that would be required to restore and recover your database.
If you have the autobackup of the control file feature enabled, run this command next:
RMAN> configure controlfile autobackup on;
The last task RMAN does as part of the backup is to generate a backup set that contains a backup of the control file. This control file will contain all information regarding the backup that took place and any archive redo logs that were generated during the backup.
Tip Always enable the autobackup of the control file feature.
There are many nuances to the RMAN BACKUP command. For production databases, I usually back up the database with the BACKUP INCREMENTAL LEVEL=0 DATABASE PLUS ARCHIVELOG command. That’s generally sufficient. However, you will encounter many situations in which you need to run a backup that uses a specific RMAN feature, or you might troubleshoot an issue requiring that you be aware of the other ways to invoke an RMAN backup. These aspects are discussed in the next several sections.
The term RMAN full backup sometimes causes confusion. A more apt way of phrasing this task would be RMAN backing up all modified blocks within one or more data files. The term full does not mean that all blocks are backed up or that all data files are backed up. It simply means that all blocks that would be required to rebuild a data file (in the event of a failure) are being backed up. You can take a full backup of a single data file, and the contents of that backup piece may be quite a bit smaller than the data file itself.
The term RMAN level 0 incremental backup doesn’t exactly describe itself very well, either. A level 0 incremental backup is backing up the same blocks as a full backup. In other words, the following two commands back up the same blocks in a database:
RMAN> backup as backupset full database;
RMAN> backup as backupset incremental level=0 database;
The only difference between the prior two commands is that an incremental level 0 backup can be used in conjunction with other incremental backups, whereas a full backup cannot participate in an incremental backup strategy. Therefore, I almost always prefer to use the INCREMENTAL LEVEL=0 syntax (as opposed to a full backup); it gives me the flexibility to use the level 0 incremental backup along with subsequent incremental level 1 backups.
The default backup mode of RMAN instructs it to back up only blocks that have been used in a data file; these are known as backup sets. RMAN can also make byte-for-byte copies of the data files; 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;
If you prefer, you can explicitly place the AS BACKUPSET command when creating backups:
RMAN> backup as backupset database;
You can instruct RMAN to create image copies by using the AS COPY command. This command creates image copies of every data file in the database:
RMAN> backup as copy database;
Because image copies are identical copies of the data files, they can be directly accessed by the DBA with OS commands. For example, say you had a media failure, and you didn’t want to use RMAN to restore an image copy. You could use an OS command to copy the image copy of a data file to a location where it could be used by the database. In contrast, a backup set consists of binary files that only the RMAN utility can write to or read from.
I prefer to use backup sets when working with RMAN. The backup sets tend to be smaller than the data files and can have true binary compression applied to them. Also, I don’t find it inconvenient to use RMAN as the mechanism for creating backup files that only RMAN can restore. Using RMAN with backup sets is efficient and very reliable.