Search:

Home | Marketing | Database Marketing


RMAN - Backing Up Database Files

By: hitechwriter

Consistent and Inconsistent Backups

A consistent backup of the database is one taken when the database is in a consistent state, that is, one taken after the database has been shut down normally (using SHUTDOWN NORMAL, SHUTDOWN IMMEDIATE or SHUTDOWN TRANSACTIONAL). At this point, all changes in the redo log have been applied to the datafiles. If you mount the database and take a backup at this point, then you can restore the database from this backup at a later date and open it without performing media recovery.

Any backup taken when the database has not been shut down normally is an inconsistent backup. When a database is restored from an inconsistent backup, Oracle must perform media recovery before the database can be opened, applying any pending changes from the redo logs.
As long as your database is running in ARCHIVELOG mode, and you back up your archived redo log files as well as your datafiles, inconsistent backups can be the foundation for a sound backup and recovery strategy. Inconsistent backups are an important part of the backup strategy for most databases, because they offer superior availability. For example, backups taken while the database is still open are inconsistent backups.

Making Whole Database Backups with RMAN

You can perform whole database backups with the database mounted or open. To perform a whole database backup, from the RMAN prompt, use the BACKUP DATABASE command. The simplest form of the command requires no parameters, as shown in this example:
RMAN> BACKUP DATABASE;

This example shows the procedure for taking a whole database backup to the default destination:
RMAN> BACKUP DATABASE; # uses automatic channels to make backup
RMAN> SQL 'ALTER SYSTEM ARCHIVE LOG CURRENT'; # switches logs and archives all logs

By archiving the logs immediately after the backup, you ensure that you have a full set of archived logs through the time of the backup. This guarantees that you can perform media recovery after restoring this backup.

Backing Up Individual Tablespaces with RMAN

You can backup one or more individual tablespaces with the BACKUP TABLESPACE command. You can use this command when the database is mounted or open.

To back up a tablespace:
After starting RMAN, run the BACKUP TABLESPACE command at the RMAN prompt. This example backs up the users and tools tablespaces to tape, using the MAXSETSIZE parameter to specify that no backup set should be greater than 10 MB:
BACKUP DEVICE TYPE sbt MAXSETSIZE = 10M TABLESPACE users, tools;

Oracle translates the tablespace name internally into a list of datafiles.

Backing Up Individual Datafiles and Datafile Copies with RMAN

Backing Up Datafiles
With RMAN connected to the target database, use the BACKUP DATAFILE command to back up individual datafiles. You can specify the datafiles by name or number.

This example uses an sbt channel to back up datafiles 1 through4 and a datafile copy stored at /tmp/system01.dbf to tape:
BACKUP DEVICE TYPE sbt
DATAFILE 1,2,3,4
DATAFILECOPY '/tmp/system01.dbf';

If CONFIGURE CONTROLFILE AUTOBACKUP is ON, then RMAN writes the current control file and SPFILE to a separate autobackup piece. Otherwise, these files are automatically included in the backup set that contains datafile 1.

Backing Up Datafile Copies
Use the BACKUP DATAFILECOPY command to back up datafile copies. Datafile copies exist on disk only.

To back up a datafile copy:
While connected to the target database, run the BACKUP DATAFILECOPY command at the RMAN prompt. This example backs up datafile /tmp/system01.dbf to tape:
BACKUP DEVICE TYPE sbt DATAFILECOPY '/tmp/system01.dbf';

Backing Up Control Files with RMAN

You can back up the control file when the database is mounted or open. RMAN uses a snapshot control file to ensure a read-consistent version. If CONFIGURE CONTROLFILE AUTOBACKUP is ON (by default it is OFF), then RMAN automatically backs up the control file and server parameter file after every backup and after database structural changes. The control file autobackup contains metadata about the previous backup, which is crucial for disaster recovery.
If the autobackup feature is not set, then you must manually back up the control file in one of the following ways:
• Run BACKUP CURRENT CONTROLFILE
• Include a backup of the control file within any backup by using the INCLUDE CURRENT CONTROLFILE option of the BACKUP command
• Back up datafile 1, because RMAN automatically includes the control file and SPFILE in backups of datafile 1
A manual backup of the control file is not the same as a control file autobackup. In manual backups, only RMAN repository data for backups within the current RMAN session is in the control file backup, and a manually backed-up control file cannot be automatically restored.
Including the Current Control File in a Backup of Other Files

To include the current control file in a backup, specify the INCLUDE CURRENT CONTROLFILE option after specifying the backup object. In this example, the default configured channel is to an sbt device. This command backs up tablespace users to tape and includes the current control file in the backup:
BACKUP DEVICE TYPE sbt TABLESPACE users INCLUDE CURRENT CONTROLFILE;

If the autobackup feature is enabled, then RMAN also creates an autobackup of the control file after the BACKUP TABLESPACE command completes, so that the control file autobackup contains the record of the backup that was taken.

Backing Up the Current Control File Manually
After starting RMAN, run the BACKUP CURRENT CONTROLFILE command. This example backs up the current control file to the default disk device and assigns a tag:
BACKUP CURRENT CONTROLFILE TAG = mondaypmbackup;

If the control file autobackup feature is enabled, then RMAN makes two control file backups in this example: the explicit control file backup (BACKUP CURRENT CONTROLFILE) and the autobackup of the control file and server parameter file.

Backing Up a Control File Copy
This example creates a control file backup with the BACKUP CONTROLFILECOPY command.

To back up a control file copy:
After starting RMAN, run the BACKUP CONTROLFILECOPY command at the RMAN prompt. This example creates the control file copy '/tmp/control01.ctl' on disk and then backs it up to tape:
BACKUP AS COPY CURRENT CONTROLFILE FORMAT '/tmp/control01.ctl';
BACKUP DEVICE TYPE sbt CONTROLFILECOPY '/tmp/control01.ctl';

For more details on RMAN - Backing Up Database Files you can view on http://oracleDbaSupport.co.uk

Article Source: http://www.articleviral.com

OracleDbaSupport.co.uk is a blog site of Sagar Patil, an independent oracle consultant with a great understanding of how the Oracle database engine & Oracle Applications work together.

Please Rate this Article

 

Not yet Rated

Click the XML Icon Above to Receive Database Marketing Articles Via RSS!

Powered by Article Dashboard