Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • Lesson 6 – Performing Backups with RMAN (A hands-on lesson on backing up an Oracle database with RMAN)
  • Author: Dave Anderson, SkillBuilders
  • www.skillbuilders.com
  • Last Update: October 17, 2007

  • This lesson will cover the administration following topics:
    • Database Backup Concepts
    • Backup Sets & Pieces
    • Control File Autobackup
    • Backup Examples
    • Full, Incremental and Cumulative Backups
    • Duplexing Backups
    • Backing Up the Archivelogs

Other Text:
(Examples or comments displayed on slide, if any).

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • This lesson will teach you – with working examples – how to backup your databases with Recovery Manager.

Other Text:
(Examples or comments displayed on slide, if any).

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • Backups are accomplished with the RMAN BACKUP command. The output of a backup operation is one or more backup sets and backup metadata (stored in the repository). The backup sets are used by RMAN in RESTORE operations.
  • RMAN remembers what backup sets are available and where they are located. It does this by storing this information in the target database control file and, if available, the recovery catalog. (Remember that one of the benefits of the recovery catalog is that it keeps all historical information; the control file history of backup sets eventually gets written over – see the CONTROL_FILE_RECORD_KEEP_TIME parameter.)
  • RMAN can backup directly to tape - if you have acquired and installed an MML on the target database. The Media Management Library is vendor-supplied software that the server sessions performing the backup can communicate with. So the server sessions created on behalf of RMAN can not talk directly to the tape; they require this intervening software. Oracle ships with a freebee from Legato called “Legato Single Server Version”. You can find a complete description of LSSV at www.legato.com/lssv.
  • A list of all Oracle-certified MML software can be found at www.oracle.com.

Other Text:
(Examples or comments displayed on slide, if any).

RMAN> backup tablespace users; <br>Starting backup at 19-NOV-03 <br>allocated channel: ORA_DISK_1<br>

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • RMAN requires that the database be either mounted or open – it cannot be entirely closed. This is because RMAN needs to update the target database control file with the backup information. (Remember, mounted means that the control file is open.) The exception to this is a database running in NOARCHIVELOG mode; in this case the database must be mounted, but cannot be open.
  • What can RMAN backup? Essentially RMAN backs up datafiles, control files and archive logs. But RMAN backup options allow many levels of granularity. For example, we can back up the whole database (all datafiles and the control file), a single tablespace, or even a specific datafile. RMAN also allows backup of the control file, archive logs and backup sets. Backup of backup sets can be useful to move the backup set to tape. (Though RMAN can backup directly to tape, perhaps the write to tape is too slow to do during the backup itself.)

Other Text:
(Examples or comments displayed on slide, if any).

RMAN> backup datafile 9; <br>Starting backup at 19-NOV-03 <br>using channel ORA_DISK_1<br>

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • The BACKUP command creates one or more backup sets. The backup sets contain the data that you have backed up in one or more operating system files (“backupset pieces”) and can be restored with the RESTORE command.
  • By default, one backupset is created for each channel allocated to the backup. The example above allocates two channels, so two sets (actually three, one for the control file autobackup) are created. This can be verified with the LIST command:
  • The Tag is a comment assigned by the BACKUP command and contains the date and time the backup was taken.

Other Text:
(Examples or comments displayed on slide, if any).

RMAN> run { <br>2> allocate channel d1 type disk; <br>3> allocate channel d2 type disk; <br>4> backup full database; <br>5> }<br>

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • The backup set is the unit of restart in the BACKUP operation. If a backup fails, we need to restart at the beginning of the set. By limiting backup set size, we can reduce the amount of time and work necessary in a restart situation. Use the MAXSETSIZE of the CONFIGURE and BACKUP commands to limit set size.
  • If a backup fails, you can restart the backup by using the ‘NOT BACKED UP SINCE TIME’ clause. For example, to restart a backup, skipping all files successfully backed up in the last 1 hour, execute:
  • RMAN> backup database not backed up since time 'sysdate – 1/24';

  • Starting backup at 23-MAY-05
  • ...

Other Text:
(Examples or comments displayed on slide, if any).

RMAN> backup database maxsetsize 500m;<br>RMAN> configure maxsetsize to 25G; <br> <br>new RMAN configuration parameters: <br>CONFIGURE MAXSETSIZE TO 25 G; <br>new RMAN configuration parameters are successfully stored <br>starting full resync of recovery catalog <br>full resync complete<br>This job only<br>Persistent setting affects all jobs unless overridden <br>

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • Each backup piece is equivalent to a single operating system file. The backup piece (or OS file) contains the blocks from the datafiles that were backed up. It is in an Oracle proprietary format and can only be restored with the RMAN RESTORE command.

Other Text:
(Examples or comments displayed on slide, if any).

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • By default, RMAN will create one (potentially very large) backup piece in each backup set. This can be overridden with the MAXPIECESIZE parameter of the ALLOCATE CHANNEL or CONFIGURE CHANNEL commands. This can be necessary if your operating systems has a maximum file size.



Other Text:
(Examples or comments displayed on slide, if any).

RMAN> configure channel device type disk <br> 2> maxpiecesize 2g;<br>

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • The CONTROL FILE is a critical file – we cannot mount and open the database without it. You should always maintain duplexed copies of the control file by specifying multiple files in the CONTROL_FILES initialization parameter.
  • In addition, you should configure RMAN to take control file AUTOBACKUPS. An AUTOBACKUP is a new Oracle9i feature; it causes RMAN to:
    • Automatically back up the control file and server parameter file anytime a BACKUP or COPY command is executed.
    • Use a specific name for the backup piece, allowing RMAN to find the file if a restore is required – even without a recovery catalog.
    • Backup the information about the current backup with the control file, providing the ability to roll forward to the most recent backup.
  • This means that as long as you have an AUTOBACKUP, you can restore the AUTOBACKUP, mount and recover the database, even if you have lost your control file and Recovery Catalog.

Other Text:
(Examples or comments displayed on slide, if any).

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • Enable AUTOBACKUP with the CONFIGURE command. All configured settings, including AUTOBACKUP, are persistent, i.e. once enabled with the CONFIGURE command, it remains enabled until you explicitly disable it.
  • The default location for the AUTOBACKUP backup piece is different on Windows and Unix machines. The default for Windows is ORACLE_HOME\database, the default for Unix is ORACLE_HOME/dbs. The name of the file is derived from the RMAN variable %F. %F resolves into a string containing the DBID, for example:
  • piece handle=C:\ORACLE\ORA81\DATABASE\C-4167529595-20020511-00
  • Use of a specific name and location is how RMAN locates the file during a RESTORE CONTROLFILE FROM AUTOBACKUP operation. RMAN expects the backup piece to have a certain name and location. Refer to the lesson titled Restore and Recovery for examples of restoring a control file.

Other Text:
(Examples or comments displayed on slide, if any).

RMAN> configure controlfile autobackup on;<br>

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • As shown above, we can use the CONFIGURE command to specify an alternate location (disk or tape) for the control file AUTOBACKUP. YOU MUST ALSO EXECUTE THE “CONFIGURE CONTROLFILE AUTOBACKUP ON” COMMAND. The CONFIGURE CONTROFILE AUTOBACKUP FORMAT is a different command and effects a different persistent setting.
  • You can also use the SET CONTROLFILE AUTOBACKUP FORMAT instead of the CONFIGURE command for one-time operations. The scope of the SET command is session; i.e the SET command affects only the current session.
  • However, note that “%F” must be used as the controlfile autobackup piece name. The variable “%F” is case sensitive and must be specified in upper case.
  • Again, you can find examples of restoring a control file in the lesson titled Restore and Recovery.

Other Text:
(Examples or comments displayed on slide, if any).

RMAN> configure controlfile autobackup <br>2> format for device type disk <br>3> to 'c:\oracle\backups\%F';<br>SET CONTROLFILE AUTOBACKUP FORMAT …<br>RMAN> list backup of controlfile;<br>

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • A full backup copies all ever-used datafile blocks to the backup set. Blocks never used will not be written to the backup set.
  • The database must be at least mounted. If the database is running in ARCHIVELOG mode, the database can be open. There is no need to put the database in hot backup mode. RMAN will automatically detect inconsistent blocks and re-read those blocks.

Other Text:
(Examples or comments displayed on slide, if any).

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • The BACKUP DATABASE command will, by default, do a FULL backup of all datafiles (tempfiles are not backup up). A control file AUTOBACKUP will also occur if, as in this example, the BACKUP command is the last command in the RUN block and CONFIGURE CONTROLFILE AUTOBACKUP is ON. A control file AUTOBACKUP will also be done if the BACKUP command is run from the RMAN prompt.
  • The Oracle8i example shown above requires the manual channel allocation; note that this example still works in Oracle9i. The following Oracle9i example is simpler. Assuming that the default channel is defined with:
      • RMAN> CONFIGURE DEFAULT DEVICE TYPE TO disk;
  • Then the Oracle9i Full backup can be accomplished with:
      • RMAN> backup database plus archivelog;

Other Text:
(Examples or comments displayed on slide, if any).

RMAN> configure controlfile autobackup on; <br>RMAN> run { <br> allocate channel d1 type disk format <br> 'c:\oracle\backups\full.%d.%T.%s.%p'; <br> backup database plus archivelog; }<br>RMAN> backup database plus archivelog;<br>

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • We can ask RMAN to do some archive log file housekeeping for us. For example, adding the PLUS ARCHIVELOG DELETE INPUT causes RMAN to delete all the archive logs it backs up.
  • Supplemental Notes
  • Note that the DELETE INPUT command also works when backing up backup sets (consider this as a way to move backup sets to different location or devices) and image copies. For example, I can move a backupset from an undesirable location to the pre-configured location with this command:
  • RMAN> backup backupset 83 delete input;

  • Starting backup at 23-MAY-05
  • Refer to the Oracle9i Recovery Manager Reference manual for a complete description of this option.

Other Text:
(Examples or comments displayed on slide, if any).

RMAN> backup database plus archivelog delete input; <br>. . . <br>channel ORA_SBT_TAPE_1: starting archive log backupset <br>channel ORA_SBT_TAPE_1: specifying archive log(s) in backup <br>. . . <br>channel ORA_SBT_TAPE_1: deleting archive log(s) <br>archive log filename=/opt/oracle/oradata/test/arch/arch1_8.db<br>

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • Another way to backup – and optionally delete – archive logs is to use the BACKUP ARCHIVELOG command. Use the DELETE INPUT option to delete all logs backed up.
  • In this example I also use the LIST BACKUP command to see all backups of archive logs in the last day. Refer to the Scripting and Reporting lesson for more information and examples of the LIST BACKUP command.

Other Text:
(Examples or comments displayed on slide, if any).

RMAN> backup archivelog all delete input; <br> <br>Starting backup at 14-JUL-04 <br>current log archived <br>allocated channel: ORA_DISK_1 <br>. . . <br>RMAN> list backup of archivelog from time 'sysdate-1'; <br> <br>List of Backup Sets <br>=================== <br> <br>BS Key Size Device Type Elapsed Time Completion Time <br>------- ---------- ----------- ------------ --------------- <br>2 24M DISK 00:02:40 14-JUL-04<br>

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • The complete syntax for the BACKUP command is found in the Oracle9i Recovery Manager Reference manual.
  • Brackets indicate optional parameter in the syntax shown here.
  • BACKUP Command Parameter information:
    • FULL - do a full backup - all datafiles and the current control file. This is the default.
    • INCREMENTAL LEVEL - do an incremental backup of the level specified by integer. See examples later in this lesson.

    • Continued on the next page…

Other Text:
(Examples or comments displayed on slide, if any).

BACKUP [ FULL | INCREMENTAL LEVEL integer ] <br> [ CUMULATIVE ] <br> [ FORMAT '/path/filename' ] <br> [ TAG tag ] <br> {DATABASE | TABLESPACE 'name' , … | <br> DATAFILE 'name' | number <br> BACKUPSET ALL | number | time <br> CURRENT CONTROLFILE} (choose one) <br> [ PLUS ARCHIVELOG [DELETE INPUT] ]<br>

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

    • FORMAT – specify the path and filename of the backup set. Incorporate the RMAN format specifiers such as %s and %p. The format specifiers are CASE sensitive. Some of the supported substitution variables are:
      • %s - Unique backup set number stored in the control file.
      • %p - Backup piece number within the backup set. Starts at one and incremented by 1 for each piece.
      • %d - Database name
      • %T - Year, month, and day in the following format: YYYYMMDD
      • %t - A time stamp, e.g. 470658069
      • %c - Integer representing copy number of backup piece when duplexing. Required when the COPIES option is use to create multiple copies of a backup set. See the section on “Duplexing”.
      • %u – Generated string (Oracle states this is a “compressed representation of the backup set number and time … created”.
      • %U – Shorthand for %u_%p_%c which generates a unique filename. This is the default backup set piece file name.
    • DATABASE | TABLESPACE - DATABASE requests a full database (same as the FULL option); TABLESPACE requests a backup of a specific tablespace.
    • TAG - Supply a unique name to identify the backup. Consider a standard that includes type of backup (FULL, INCREMENTAL), the target of the backup (DATABASE, TABLESPACE, DATAFILE, ARCHIVELOG) and a unique number.

Other Text:
(Examples or comments displayed on slide, if any).

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • Here is the output of the BACKUP … PLUS ARCHIVELOG command.
  • We can see that that there are 4 phases: switch current log and backup, backup database, switch current log and backup (again) and finally AUTOBACKUP of the control file.


  • Continued on the next page…

Other Text:
(Examples or comments displayed on slide, if any).

Starting backup at 11-MAY-02 <br>current log archived <br>channel d1: starting archive log backupset<br>channel d1: starting full datafile backupset<br>current log archived <br>channel d1: starting archive log backupset<br>Starting Control File Autobackup at 11-MAY-02<br>

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • RMAN> run {
  • 2> allocate channel d1 type disk format
  • 3> 'c:\oracle\backups\full.%s.%p';
  • 4> backup database plus archivelog;
  • 5> }

  • released channel: ORA_DISK_1
  • allocated channel: d1
  • channel d1: sid=9 devtype=DISK


  • Starting backup at 11-MAY-02
  • current log archived
  • channel d1: starting archive log backupset
  • channel d1: specifying archive log(s) in backup set
  • input archive log thread=1 sequence=10 recid=1 stamp=461580898
  • input archive log thread=1 sequence=11 recid=2 stamp=461580898
  • channel d1: starting piece 1 at 11-MAY-02
  • channel d1: finished piece 1 at 11-MAY-02
  • piece handle=C:\ORACLE\BACKUPS\FULL.19.1 comment=NONE
  • channel d1: backup set complete, elapsed time: 00:00:05
  • Finished backup at 11-MAY-02

  • Starting backup at 11-MAY-02
  • channel d1: starting full datafile backupset
  • channel d1: specifying datafile(s) in backupset
  • input datafile fno=00001 name=C:\ORACLE\ORADATA\PROD\SYSTEM01.DBF
  • input datafile fno=00002 name=C:\ORACLE\ORADATA\PROD\UNDOTBS01.DBF
  • input datafile fno=00003 name=C:\ORACLE\ORADATA\PROD\DRSYS01.DBF
  • input datafile fno=00008 name=C:\ORACLE\ORADATA\PROD\SKILL_INDEXES.DBF
  • input datafile fno=00004 name=C:\ORACLE\ORADATA\PROD\TEST.DBF
  • input datafile fno=00005 name=C:\ORACLE\ORADATA\PROD\TOOLS01.DBF
  • channel d1: starting piece 1 at 11-MAY-02
  • channel d1: finished piece 1 at 11-MAY-02
  • piece handle=C:\ORACLE\BACKUPS\FULL.20.1 comment=NONE
  • channel d1: backup set complete, elapsed time: 00:07:06
  • Finished backup at 11-MAY-02




  • Continues…

Other Text:
(Examples or comments displayed on slide, if any).

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)


  • Starting backup at 11-MAY-02
  • current log archived
  • channel d1: starting archive log backupset
  • channel d1: specifying archive log(s) in backup set
  • input archive log thread=1 sequence=12 recid=3 stamp=461581332
  • channel d1: starting piece 1 at 11-MAY-02
  • channel d1: finished piece 1 at 11-MAY-02
  • piece handle=C:\ORACLE\BACKUPS\FULL.21.1 comment=NONE
  • channel d1: backup set complete, elapsed time: 00:00:02
  • Finished backup at 11-MAY-02

  • Starting Control File Autobackup at 11-MAY-02
  • piece handle=C:\ORACLE\ORA81\DATABASE\C-4167529595-20020511-00 comment=NONE
  • Finished Control File Autobackup at 11-MAY-02
  • released channel: d1

Other Text:
(Examples or comments displayed on slide, if any).

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • The example shown above makes use of the Automatic Channel Allocation feature of Oracle9i. Note that RMAN uses a standard channel name for automatically allocated channels: ORA_DISK_n, where n starts at 1 and goes up by 1 for each additional channel allocated.
  • Note that “TEST” is a reserved word and thus must be enclosed in quotes in the example above. Since it is enclosed in quotes, the name is also case sensitive.
  • Multiple tablespaces can be backed up in a single command:
  • RMAN> backup tablespace 'TEST', skill_indexes;

Other Text:
(Examples or comments displayed on slide, if any).

RMAN> backup tablespace 'TEST'; <br> <br>Starting backup at 11-MAY-02 <br>using channel ORA_DISK_1 <br>channel ORA_DISK_1: starting full datafile backupset <br>channel ORA_DISK_1: specifying datafile(s) in backupset <br>input datafile fno=00004 name=C:\ORACLE\ORADATA\PROD\TEST.DBF <br>channel ORA_DISK_1: starting piece 1 at 11-MAY-02 <br>channel ORA_DISK_1: finished piece 1 at 11-MAY-02 <br>piece handle=C:\ORACLE\ORA81\DATABASE\0IDO69D4_1_1 comment=NONE <br>channel ORA_DISK_1: backup set complete, elapsed time: 00:00:08 <br>Finished backup at 11-MAY-02<br>

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • In addition to tablespaces, you can also backup specific datafiles by name or number (use the REPORT SCHEMA command to see the datafile number).
  • Note that RMAN converts BACKUP TABLESPACE commands into a series of datafile names; BACKUP TABLESPACE is a convenience for the DBA.
  • Note also that the datafile name contains special characters ( \ ), and therefore must be enclosed in quotes. The operating system determines if the filename is case sensitive.

Other Text:
(Examples or comments displayed on slide, if any).

RMAN> backup datafile 'C:\ORACLE\ORADATA\PROD\TEST.DBF'; <br> <br>RMAN> backup datafile 'C:\ORACLE\ORADATA\PROD\TEST.DBF', <br>2> 'C:\ORACLE\ORADATA\PROD\TOOLS01.DBF';<br>

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • This workshop is designed to reinforce your knowledge of backup concepts and to provide practice using the backup command. All steps should be done from the RMAN command prompt while connected to both the catalog and target databases.
    1. Exit and re-enter RMAN. Connect to the catalog and target databases.
    2. Execute the SHOW ALL command. What is the current configuration setting for CONTROLFILE AUTOBACKUP?
    3. Configure the CONTROLFILE AUTOBACKUP to be ON.
    4. Perform a full backup of your database. Include the archived logs. Use the Oracle9i automatic channel allocation feature.
    5. Use the output of the BACKUP command to determine the location and names of the backup pieces.
    6. Execute the LIST BACKUP command. How many backup sets were created by the backup?

Other Text:
(Examples or comments displayed on slide, if any).

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • Incremental backups only write changed blocks to the backup set (note that the entire datafile is read). This can save considerable disk (or tape) space. You might also see a reduction in the time it takes to perform the backup (especially if writing blocks over a network), but since RMAN reads the entire datafile to find the changed blocks, elapsed time is not always reduced.
  • The method RMAN uses to create incremental backups is to incorporate multiple “levels” of backup. A level 0 backup backs up all blocks; a level 1 backs up only changed blocks, I.e. only blocks that have been changed since the last incremental backup.
  • Incremental backups are either differential (the default) or cumulative. A differential backup backs up blocks changed since the last backup at the same or lower level. So for example, a level 1 backs up blocks changed since the last level 1 or level 0.
  • See the section on “Cumulative Incremental” later in this lesson for information and an example of a cumulative incremental backup.

Other Text:
(Examples or comments displayed on slide, if any).

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • RMAN supports 5 levels of incremental backup.
  • Level 0 backs up all blocks – it is similar to a FULL, but a FULL backup cannot be used in the incremental scheme. When using the default incremental backup, levels 1 through 4 backup only blocks that have changed since the last incremental backup at the same or lower level.

Other Text:
(Examples or comments displayed on slide, if any).

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • Differential incremental backups (the default) read the entire datafile(s), but only write (i.e. backup) blocks that have been changed since the last backup at the same or lower level. So for example, a level 2 backs up blocks changed since the last level 2, 1 or 0.
  • You must start with a level 0 backup – a full backup does not count in the incremental scheme. If you have never taken a level 0 backup and run a higher level, RMAN automatically takes a level 0 for you.

Other Text:
(Examples or comments displayed on slide, if any).

run { allocate channel d1 type disk <br> format 'c:\oracle\backups\%d.%T.%s.%p'; <br> backup incremental level 0 database; }<br> run { allocate channel d1 type disk <br> format 'c:\oracle\backups\incremental.%s.%p'; <br> backup incremental level 2 database; }<br>

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • A cumulative backup backs up blocks changed since the last backup at a lower level. So, for example, a level 2 backs up all blocks since the last level 1 or 0. Contrast that with the differential incremental level 2, which backs up blocks changed since the last level 2, 1 or 0.

  • The cumulative backup requires more time to do back up (because more blocks are written to the backup set), but less time to recover because there are less backup sets to process during recovery.

  • See the next page for a typical strategy for cumulative incremental backups.

Other Text:
(Examples or comments displayed on slide, if any).

run { allocate channel d1 type disk <br> format 'c:\oracle\backups\incremental.%s.%p'; <br> backup incremental level 2 cumulative database; }<br>

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)


  • A typical strategy for cumulative incremental backups would be:

Other Text:
(Examples or comments displayed on slide, if any).

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • This workshop is designed to reinforce your knowledge of and provide practice using incremental backups. All steps should be done from the RMAN command prompt while connected to both the catalog and target databases.
    1. Perform an incremental LEVEL 0 backup against the TOOLS tablespace.
    2. Perform an incremental level 1 backup against the TOOLS tablespace.

Other Text:
(Examples or comments displayed on slide, if any).

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • Duplexing backup copies means that RMAN writes more than one copy of the backup set.
  • Use the BACKUP command “COPIES n” parameter to create up to 4 copies. The FORMAT parameter contains the paths and file names. The file name must make use of “%c”, which numbers the copies, starting at 1.
  • With Oracle9i, you can configure RMAN to always make multiple copies with the CONFIGURE ... BACKUP COPIES command. The COPIES option and the SET command will override the CONFIGURE command.
  • Supplemental Notes
    • Another way to employ duplexing is to use the SET BACKUP COPIES command prior to the BACKUP command.



Other Text:
(Examples or comments displayed on slide, if any).

backup copies 2 tablespace skillbuilders <br>format 'C:\oracle\backups\tspace.%d.%T.%c', 'D:\oracle\backups\tspace.%d.%T.%c';<br>RMAN> configure datafile backup copies <br> for device type disk to 2; <br>RMAN> configure channel 1 device type disk format <br>2>'c:\temp\%d.%T.%s.%p.%c', 'd:\oracle\backup\%d.%T.%s.%p.%c';<br>

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

    1. Perform a full backup on the TOOLS tablespace. Create two copies in a directory specified on the BACKUP command.

Other Text:
(Examples or comments displayed on slide, if any).

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • Archivelogs can easily be backed up with RMAN. Either add the PLUS ARCHIVELOG option to the backup of another object (e.g. DATABASE) or use the BACKUP ARCHIVELOG command.
  • The BACKUP ARCHIVELOG command supports the DELETE INPUT option. This allows you to free disk space by deleting the archivelogs after backing them up. DELETE INPUT deletes just the log that it used to the backup; DELETE ALL INPUT deletes the logs from all enabled archivelog destinations.
  • Another option is to backup archive logs by date created. As shown in the 2nd example above, specify a date range on the BACKUP command. You can also use the TO_DATE function:
  • RMAN> backup archivelog from time "to_date('5-22-2005', 'mm-dd-yyyy')" until time 'sysdate';
  • Other options include ALL, LIKE and SEQUENCE. Refer to the Oracle9i Recovery Manager Reference for a complete list.
  • RMAN will automatically restore these logs if necessary for recovery.

Other Text:
(Examples or comments displayed on slide, if any).

BACKUP ARCHIVELOG ALL DELETE INPUT; <br>BACKUP ARCHIVELOG ALL DELETE ALL INPUT;<br>RMAN> backup archivelog from time 'sysdate-1' until time 'sysdate'; <br> <br>Starting backup at 23-MAY-05 <br>. . . <br>

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

    1. Execute the following query from SQL*Plus to determine how many archived logs the database has created:
      • SELECT name FROM v$archived_log;
      • Then use an OS utility (e.g. Windows Explorer) to check for the existence of the OS files.
    1. Backup all archive logs and, in the BACKUP command, instruct RMAN to delete all archive logs.
    2. Re-execute the query against V$ARCHIVED_LOG. Are the archive logs still there? Check the OS file directory. Are the archive log files still there?

Other Text:
(Examples or comments displayed on slide, if any).

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • Backups of datafiles and control files can become “obsolete”, meaning they have exceeded your retention policy and are not needed for recovery. You can use DELETE OBSOLETE command to delete obsolete backups.
  • The retention policy is set with the CONFIGURE RETENTION POLICY command and is one of the following:
    • Recovery Window
    • Redundancy
    • None
  • Let’s take a look at each retention policy option in turn…

Other Text:
(Examples or comments displayed on slide, if any).

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • When the “recovery window” retention policy is used, RMAN will insure that a backup exists for every datafile that is older than the specified recovery window. Oracle recommends that this policy by used. The Oracle9i Recovery Manager User’s Guide documents this formula:
      • “there must always exist one backup of each datafile that satisfies the following condition:
      • SYSDATE - (SELECT CHECKPOINT_TIME FROM V$DATAFILE) >= [ recovery window ]”
  • Note that RMAN also treats archive log backups older than the oldest datafile or control file backup as obsolete.
  • Use the REPORT OBSOLETE to find obsolete backups; use the DELETE OBSOLETE [NOPROMPT] to delete obsolete backups. In Oracle 10g and above, if the flash recovery area is used to store backups, obsolete backups will be automatically deleted when disk space is needed. Refer to Lesson 13, Backup and Recovery Enhancements, for more information.
  • Refer to Lesson 11, RMAN Maintenance, for more information on the REPORT and DELETE OBSOLETE commands.
  • Refer to chapter 5 of the Oracle 10g Backup and Recovery Basics manual or chapter 5 of the Oracle9i Recovery Manager User’s Guide for more information.

Other Text:
(Examples or comments displayed on slide, if any).

<br>RMAN> configure retention policy to recovery window of 3 days; <br>Oracle recommends using this policy<br>

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • When the “redundancy” retention policy is used RMAN maintains at least “n” number of backups of each datafile, where “n” is specified in the configuration.
  • Periodically delete obsolete backups with the DELETE OBSOLETE command. However, in Oracle 10g and above, if the flash recovery area is used to store backups, obsolete backups will be automatically deleted when disk space is needed. Refer to Lesson 11, RMAN Maintenance, for more information.

Other Text:
(Examples or comments displayed on slide, if any).

RMAN> configure retention policy to redundancy 3;<br>

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • If you would like a backup set to be exempt from the retention period (i.e. you’d like it to stick around), you can use the KEEP option on the BACKUP command. KEEP UNTIL TIME and KEEP FOREVER are supported.
  • Use the NOLOGS option or else Oracle will keep all archive log backups taken after this backup so that you can perform forward recovery from this backup. Using the NOLOGS option means that you will not apply logs and thus this must be a consistent backup – i.e. shutdown the database cleanly.

Other Text:
(Examples or comments displayed on slide, if any).

RMAN> startup mount <br> <br>connected to target database (not started) <br>Oracle instance started <br>. . . <br>RMAN> backup database keep until time 'sysdate+365' nologs;<br>

Slides © 2004-2007 SkillBuilders.

Instructor's Notes

(If applicable)

  • In this lesson you learned:
    • How to use the BACKUP command
    • About Backup Sets (Output of BACKUP command is backup set and Contains 1 or more pieces)
    • Backup the Control File - Use CONTROLFILE AUTOBACKUP
    • Backups: Full, Incremental, Cumulative
    • Duplexing Backups - Create multiple, redundant backup sets
    • How to backup archivelogs with the BACKUP ARCHIVELOG command
    • Retention Policies - Recovery Window, Redundancy, None
    • How to override retention policies

Other Text:
(Examples or comments displayed on slide, if any).