Backup pieces are operating system files that contain the backed up datafiles, control files, or archived redo logs. The configuration acts as a template. In this way, you can recycle your tapes over time. You must notify RMAN when the copy is no longer available for restore, however, by using the CHANGE UNCATALOG command. For example, if you specify the LIKE parameter, RMAN deletes whichever logs match the string. In other words, a full backup does not affect which blocks are included in subsequent incremental backups. Note: Do not put a tablespace in backup mode with the ALTER TABLESPACE BEGIN BACKUP statement. In the example shown in Figure5-5, the following occurs: An incremental level 0 backup backs up all blocks that have ever been in use in this database.
PARALLELISM command. Oracle9i Database Concepts for more information about NOLOGGING mode. RMAN creates three backup sets and groups the files into the sets so that each set is approximately the same size. You can specify the LOGS option to save archived logs for a possible incomplete recovery of the long-term backup. Assume that you configure a retention policy for redundancy. "Backup Retention Policies" to learn how to configure a policy that determines which backups are obsolete. As Figure5-2 illustrates, RMAN performs compression on its backups, which means that datafile blocks that have never been used are not backed up. The purpose of this feature is to guarantee that the backed up datafiles can be recovered to a consistent state. You can also back up another backup set, as when you want to back up a disk backup to tape, or an image copy. A backup taken when the database is mounted (but not open) and was not crashed or shut down with the ABORT option prior to mounting. Run the RMAN COPY command or an operating system command such as the UNIX cp command to create image copies. RMAN uses file location information obtained from the database server to determine which datafiles are on which disk drives. Note that multiplexing in this sense is completely different from duplexing. Instead, you can use the SWITCH command to point the control file at the copy and update the repository to indicate that the copy has been switched. So, RMAN reads the multiplexed data for the first sixteen files and then starts reading the data for data17.f. For example, if DISKRATIO=4 and the datafiles are located on three disks, then RMAN attempts to distribute the datafiles into three backup sets. When backing up to tape you should allocate one channel for each physical device, but when backing up to disk you can allocate as many channels as necessary for maximum throughput. However, RMAN must do further checking to determine whether to skip the file, because both the retention policy feature and the backup duplexing feature influence the algorithm that determines whether RMAN has "enough" backups on the specified device type. You cannot manually allocate a channel with the ALLOCATE CHANNEL command and then prefix the channel name with ORA_. Because incrementals are not as big as full backups, you can create them on disk more easily. Provided the sum of physical and logical corruptions for a file remains below its MAXCORRUPT setting, the RMAN command completes and Oracle populates V$BACKUP_CORRUPTION and V$COPY_CORRUPTION with corrupt block ranges. The RECOVERY WINDOW option is mutually exclusive with the REDUNDANCY option. Then, you run the following backup: In this case, RMAN can use the failover feature to back up the archived logs as described in the following table. You can back up datafiles, control files, archived redo logs, and the current server parameter file. If the database is open and the datafile is online and read/write, then you must place the tablespace in backup mode, that is, issue the SQL statement ALTER TABLESPACE BEGIN BACKUP before creating the copy. Note that RMAN can include a control file in an incremental backup set, but the control file is always included in its entirety--no blocks are skipped. RMAN automatically restores needed archived logs from tape to disk during recovery. If the number of format values exceeds the number of copies, then the extra formats are not used. In a cumulative level n backup, RMAN backs up all the blocks used since the most recent backup at level n-1 or lower. Also, assume that the copy utility reads the entire block while database writer is in the middle of updating the block. By default, RMAN selects the most recent backups to restore unless qualified by a tag or a SET UNTIL command. Assume that the database contains 50 datafiles spread across 6 disks, and the operating system is able to deliver this disk contention information to the server. A level 0 incremental backup, which is the base for subsequent incremental backups, copies all blocks containing data. For example, you can validate that all database files and archived redo logs can be backed up by issuing a command as follows: You cannot use the MAXCORRUPT or PROXY parameters with the VALIDATE option. For example, if you configure PARALLELISM to 3 for the default sbt device and PARALLELISM to 2 for DISK, then RMAN automatically allocates three sbt channels and two DISK channels during the restore. In this case, configure channels for disk and tape devices, but make the device of sbt the default device: RMAN only allocates sbt channels when you run backup commands. The following statement uses parallelization on the same example: one RMAN BACKUP command backs up three datafiles, with all three channels in use. A full backup includes all used data blocks in the datafiles. If you specify neither parameter, then DISKRATIO defaults to 4. Unless you manually run an ALLOCATE CHANNEL command, RMAN allocates automatic channels according to the settings in these commands: For example, you can issue the following commands at the RMAN prompt: RMAN automatically allocates channels according to values set with the CONFIGURE command in the following cases: You can override automatic channel allocation settings by manually allocating channels within a RUN block. An incremental backup reads the entire file and then backs up only those data blocks that have changed since a previous backup. In determining the characteristics of the RMAN backup sets, the basic algorithm is influenced by the following factors: The most important rules in the algorithm for backup set creation are: RMAN writes backup pieces sequentially; striping a backup piece across multiple output devices is not supported. An image copy differs from a backup set because it is not multiplexed, nor is there any additional header or footer control information stored in the copy. In other words, KEEP FOREVER LOGS means that RMAN not consider logs generated after the long-term backup to be obsolete. If no level 1 is available, RMAN copies all blocks changed since the base level 0 backup. Assume the following example in which RMAN backs up eight files with three channels. You cannot use COPY to make a copy to a device other than DISK. Allocation of one or more RMAN channels is necessary to execute most backup and recovery commands. You can turn the autobackup feature on or off by running the following commands: The purpose of the control file autobackup is to provide a way to restore the backup repository contained in the control file when the control file is lost and the recovery catalog is either lost or was never used. When you recover using SQL*Plus, Oracle applies the blocks and changes during recovery, so it does not matter that the block in the backup was fractured. You decide to restore data17.f, which is datafile 17. At the beginning of every BACKUP ARCHIVELOG command that does not specify an UNTIL clause, RMAN attempts to automatically switch out of and archive the current online redo log. The automatic backup of the control file occurs in addition to any backup of the current control file that has been performed during these commands. RMAN uses this data to resynchronize the recovery catalog. For example, you can run DELETE OBSOLETE in a weekly script. For example, if datafile copies are created each Monday evening and are always tagged mondaypmcopy, then the tag refers to the most recent copy (assuming that no SET UNTIL command is issued before restore or recovery). By default, one backup set contains one backup piece. The behavior of this command is the same as BACKUP KEEP. Run the REPORT OBSOLETE command to determine which backups and copies are currently obsolete according to the retention policy. In this sense, the BACKUP VALIDATE command is similar to the RESTORE VALIDATE command, except for backups rather than restore jobs. If you specify a tag when specifying input files to a RESTORE or SWITCH command, then RMAN considers only backup sets with a matching tag when choosing which backup to use, Oracle9i Recovery Manager Reference for SWITCH syntax, and Oracle9i Recovery Manager Reference for RESTORE syntax. The media manager should never expire a tape until all RMAN backups on that tape have been removed from the media manager's catalog. RMAN can create and restore full backups of the datafiles, control files, and archived redo logs. This functionality is also known as duplexing a backup set. BACKUP COPIES is specified. Assume that you run the following backup at 3 p.m.: In this case, RMAN sets n=3 and so will not back up the logs created before 9 a.m. because three copies already exist on tape. "Configuring the Retention Policy for a Recovery Window". When a tablespace is in backup mode, Oracle writes the before-image of each changed block in the tablespace to the redo log before modifying it. You can then perform recovery on the copy. When determining whether a file has been backed up, RMAN compares the SINCE TIME date with the completion time of the most recent backup of the file. You can specify a different format for a device type with the CONFIGURE CONTROLFILE AUTOBACKUP FORMAT command. The BACKUP BACKUPSET command uses the default disk channel to copy backup sets from disk to disk. You can use the BACKUP CHANNEL command to manually assign a channel to back up specified files. This backup piece contains the intermingled data blocks of the three input files. Oracle9i Recovery Manager Reference for BACKUP MAXCORRUPT syntax, and Oracle9i Recovery Manager Reference for COPY MAXCORRUPT syntax.
The size of the backup file depends solely upon the number of blocks modified and the incremental backup level. RMAN searches for values of n in this order of precedence (that is, values higher on the list override values lower on the list): By default, n=1. RMAN copies the block in case the user wants to try to salvage the contents of the block. You can also use the FILESPERSET parameter to limit the number of datafiles included in a backup set. The retention policy influences backup optimization. Note that the Tuesday backup of users is obsolete beginning on Thursday. This behavior is similar to the behavior of RMAN when backing up archived redo logs that exist in multiple archiving destinations. The FILESPERSET parameter limits the number of files (control files, datafiles, or archived logs) that can go in a backup set. Hence, the advanced algorithm dictates that each of the 10 backup sets must contain datafiles from at least 5 of the 6 disks. For example, in an Oracle Real Application Clusters environment you can enter: In this example, RMAN allocates 2 channels for every backup job, ORA_SBT_TAPE_1 and ORA_SBT_TAPE_2. One danger in making online backups is the possibility of inconsistent data within a block. Oracle Corporation does not recommend hardware multiplexing of RMAN backups. When LOGS is specified, all logs more recent than the backup are kept as long as the backup is kept. Oracle9i Recovery Manager Reference for the default settings for each CONFIGURE command, and "Showing All RMAN Configuration Settings". A generic automatic channel simply creates a configuration that can be used for any channel that is not explicitly configured. By using integrity checks, the Oracle server automatically does the following: You can use the BACKUP VALIDATE command to perform a test run backup without actually producing output files. For example, you can configure disk and tape channels as follows: Because you do not specify channel numbers for these channels, the channel settings are generic to all automatic channels of the specified type. The point of recoverability is the earliest time for a hypothetical point-in-time recovery, that is, the earliest point to which you can recover following a media failure. In this scenario, the current time is January 30 and the point of recoverability is January 23. Incremental backups at levels greater than zero only copy blocks that were modified. For example, if you back up 70 datafiles and FILESPERSET is 64, then RMAN produces 2 backup sets. To restrict the size of each backup piece, specify the MAXPIECESIZE option of the CONFIGURE CHANNEL or ALLOCATE CHANNEL commands. If the SINCE TIME is later than the completion time, then RMAN backs up the file. Cumulative backups require more space and time than differential backups, however, because they duplicate the work done by previous backups at the same level. The following query displays the number of blocks written to a backup set for each datafile with at least 50% of its blocks backed up: Compare the number of blocks in differential or cumulative backups to a base level 0 backup. For datafile copies and proxy copies, if RMAN determines that the copy or proxy copy is not needed, then the copy or proxy copy can be deleted. For example, you may make a database backup on the first day of every year just to keep a record. For example, if you set the recovery window to 7 days with the CONFIGURE command, then you can run the following command to determine which backups and archived redo logs are obsolete: Note that if you configure the retention policy to NONE, then RMAN does not consider any backups or copies as obsolete. The BACKUP BACKUPSET command is a useful way to spread backups among multiple media. The REDUNDANCY parameter specifies that any number of backups or copies beyond a specified number need not be retained. Access these records through the V$BACKUP_CORRUPTION and V$COPY_CORRUPTION views. What size to make the backup sets to keep the parameter restriction. A maintenance channel is useful only for a maintenance task; you cannot use it as an input or output channel for a backup or restore job. Only one RMAN session communicates with the allocated server sessions. If DISKRATIO=n, then each backup set must read data from at least n disk drives. If you do not restrict the backup piece size, then every backup set contains only one backup piece. The CONFIGURE CHANNEL DEVICE TYPE command configures generic settings that are used for all automatic channels of the specified device type. If the database is in ARCHIVELOG mode, then the target can be open or closed: you do not need to close the database cleanly. If you set FILESPERSET but not DISKRATIO, then DISKRATIO defaults to the same value as FILESPERSET. In this way, you do not cause either disk backups to fail because of space restrictions or tape backups to span multiple volumes. You can then periodically or regularly issue the REPORT OBSOLETE command to view obsolete files and DELETE OBSOLETE to delete them. If the backup includes datafile 1, then RMAN automatically includes the current control file and server parameter file in the datafile backup set. In this example, after resilvering the mirror (not including other copies of the broken mirror), then you must use a CHANGE UNCATALOG command to update the recovery catalog and indicate that this copy is no longer available. For example, you can implement a three-level backup scheme so that a full or level 0 backup is taken monthly, a cumulative level 1 backup is taken weekly, and a cumulative level 2 is taken daily. For example, a backup of datafile 1 may receive the tag TAG20020208T133437. The new catalog will be populated with backup information from the restored control file. If you make backups using proxy copy and then downgrade Oracle to a non-proxy version, RMAN will not use proxy copy backups when restoring and will issue a warning when the best available file is a proxy copy. As you produce datafile, control file, and archived log backups over time, RMAN keeps track of which to keep and which are obsolete. For example, in a cumulative level 2 backup, RMAN determines which level 1 backup occurred most recently and copies all blocks changed since that backup. Assume that you run the following command: RMAN performs an automatic failover and includes only the uncorrupted copies in its backup set. If possible, group files that will be restored together into the same backup set. For example, assume that you configure the sbt device and run a backup as follows: Channel names beginning with the ORA_ prefix are reserved by RMAN for its own use. The advanced algorithm also looks at DISKRATIO, which in this case defaults to 4. You can also simply connect to the target instance in NOCATALOG mode and restore the database. A full backup is not the same as a whole database backup: "full" is an indicator that the backup is not incremental. Note that one consequence of this mechanism is that RMAN applies all blocks containing changed data during recovery--even if the change is to an object created with the NOLOGGING option. You implement this retention policy as follows: This command ensures that for each datafile one backup that is older than the point of recoverability must be retained. If you specify channels manually, then the ALLOCATE CHANNEL command (executed only within a RUN command) and ALLOCATE CHANNEL FOR MAINTENANCE command (executed only at the RMAN prompt) specify the type of I/O device that the server session will use to perform the backup, restore, or maintenance operation. Use caution when enabling backup optimization if you use a media manager that has an expiration policy. If you specify UNTIL, then RMAN will not mark the backup as obsolete until after the UNTIL date has passed. Since RMAN needs to read all of the blocks of the datafile, full backups and incremental backups take approximately the same amount of time. The proxy functionality was introduced in Oracle8i Release 1 (8.1.5). You must catalog operating system copies with RMAN before using them with the RESTORE or SWITCH commands. A differential incremental level 2 backup backs up all blocks that have changed since the most recent incremental backup at level n or less; in this case, the most recent incremental backup at level 2 or less is the level 2 Monday backup, so only the blocks changed since Monday will be backed up. A backup of any part of the target database when. Whether you allocate channels manually or automatically, you can use channel control commands and options to do the following: On some platforms, the channel allocation and channel control commands specify the name or type of an I/O device to use. You have two mutually exclusive options for implementing an retention policy: specifying a recovery window, or specifying redundancy (the default type of retention policy). Multiplexing is affected by the factors described in Table5-1. Use the RMAN COPY command to create an image copy to disk. You can use the automatic channel allocation feature to configure a set of persistent, automatic channels for use in all RMAN sessions. RMAN reads the entire file every time whether or not the blocks have been used. RMAN uses a different method to guarantee consistency in online backups. The datafile must be offline-normal, read-only, or closed normally. The fewer the files contained in a backup set, the faster one of them can be restored, because there is less data belonging to other datafiles that must be skipped. "Backups Exempt from the Retention Policy" for a description of retention policies and how files can be exempt or non-exempt. You may want to store a long-term backup, potentially offsite, for much longer than the time dictated by the user's retention policy. Besides RECOVERY WINDOW, the CONFIGURE command has another mechanism for controlling how long backups should be retained: the REDUNDANCY parameter. If the number of format values is less than the number of copies, then RMAN reuses the format values, starting with the first one. The total number and size of backup sets depends on which algorithm RMAN uses: the basic algorithm or the advanced algorithm. If you do not want to use automatic channels, then you can allocate multiple channels manually within a RUN command, thus allowing a single RMAN command to read or write multiple backups or image copies in parallel. Oracle9i Recovery Manager Reference to learn the syntax for the backupSpec clause, and Chapter14, "Tuning Recovery Manager" to learn about RMAN buffer management. By default, n=1. Hence, RMAN backs up three copies of the logs created after 9 a.m.
For example, in a differential level 2 backup, RMAN determines which level 1 or level 2 backup occurred most recently and backs up all blocks modified after that backup. This option limits backup piece size to the specified number of bytes. If you specify the DELETE INPUT option, then RMAN backs up exactly one copy of each specified log sequence number and then deletes the copy from disk after backing it up. If RMAN encounters datafile blocks that have not already been identified as corrupt, then it writes them to the backup with a reformatted header indicating that the block has media corruption (assuming that SET MAXCORRUPT is not equal to 0 for this datafile and the number of corruptions does not exceed the limit). However, you can back up this backup set and give this new copy of the backup set the tag bar. For example, if you set PARALLELISM for DISK to 10, and the default device type is DISK, then RMAN allocates ten disk channels using the settings in the CONFIGURE CHANNEL DEVICE TYPE DISK command. The maximum number of files to include in the backup set. Otherwise, the media manager would be forced to keep the January 3 backup of tablespace tools indefinitely. You can specify the tag rather than the filename when executing the RESTORE or CHANGE command. If FILESPERSET is 6 and MAXOPENFILES is 1, then the channel includes 6 datafiles in a set but does not multiplex the files because RMAN is not reading from more than one file simultaneously. For example, RMAN uses these names for two manually allocated disk channels: Note that if you run the CONFIGURE DEVICE TYPE command to configure a device type and do not run CONFIGURE CHANNEL for this device type, then RMAN allocates all channels without other channel control options. Whether the ALLOCATE CHANNEL command or CONFIGURE CHANNEL causes the media manager to allocate resources is vendor-specific. In this case, you can regularly run the following command: This command backs up backup sets that were created more than a week ago from disk to tape, and then deletes the backup sets from disk. You can either let RMAN determine a unique name for backup pieces or use the FORMAT parameter to specify a name. You can also specify the REDUNDANCY or RECOVERY WINDOW options on the REPORT or DELETE commands. The RMAN BACKUP BACKUPSET command backs up backup sets rather than actual database files. The server sessions divide the work of backing up the specified files. This section contains these topics: Although you cannot archive logs directly to tape, you can use RMAN to back up archived logs from disk to tape. An example of the RMAN LIST output follows: For datafile or datafile copy backups, group multiple datafiles into a single backup set to the extent necessary to keep an output tape device streaming, or to prevent the backup from consuming too much bandwidth from a particular datafile. The date and time refer to when RMAN started the backup. So, the backup set has two identical copies: one tagged foo and the other tagged bar. This situation occurs because restoring the January 28 backup does not enable you to recover to the earliest time in the window, January 23. For example, RMAN names the first DISK channel ORA_DISK_1, the second ORA_DISK_2, and so forth. For the RESTORE command and the various maintenance commands (for example, DELETE), RMAN determines which device types are required, and allocates all necessary channels. In this way, RMAN can include the current redo log in the backup set. COPIES setting, so RMAN sets n=2. A proxy copy is a special type of backup in which RMAN turns over control of the data transfer to a media manager that supports this feature. RMAN queries corruption information at the completion of a backup and stores it in the recovery catalog and control file. The advanced algorithm also factors in DISKRATIO, which here defaults to 5 (the same value as FILESPERSET). Using a media management system that is available and supported on your operating system, you can write backup sets to sequential output media such as magnetic tape. For example, if you implement a recovery window of one week, then this window of time must extend back exactly seven days from the present so that you can restore a backup and recover it to this point. If you run the following command, then RMAN returns the retention policy to the default value: You can also run the following command to disable the retention policy altogether: If the retention policy is configured to NONE, then REPORT OBSOLETE and DELETE OBSOLETE do not consider any backups to be obsolete. If you do not specify a tag name, then by default RMAN creates a tag for backups and copies (except for control file autobackups) in the format TAGYYYYMMDDTHHMMSS, where YYYY is the year, MM is the month, DD is the day, HH is the hour (in 24-hour format), MM is the minutes, and SS is the seconds. One effective strategy is to make incremental backups to disk and then run BACKUP BACKUPSET to copy the backups to a media manager. Rather, RMAN produces one backup set with a unique key, and generates 3 identical copies of each backup piece in the set, as shown in this sample LIST output: When choosing which FORMAT value to use for each backup piece, RMAN uses the first format value for copy number 1, the second format value for copy number 2, and so forth. RMAN cannot implement an automatic retention policy if backups are deleted by non-RMAN methods, for example, through the media manager's tape retention policy.
Consequently, RMAN issues an error when you run REPORT OBSOLETE without any other options. You can limit the speed of a backup by using the RATE option of the ALLOCATE CHANNEL or CONFIGURE CHANNEL commands. The substitution variable %F is defined in the description of the CONFIGURE command. Access this data using the views V$BACKUP_CORRUPTION and V$COPY_CORRUPTION. When you specify DEVICE TYPE DISK with any version of RMAN, RMAN does not allocate operating system resources other than for the creation of the server session and does not call the media manager. If the SCN in the input data block is greater than or equal to the checkpoint SCN of the parent, then RMAN copies the block. For backup sets containing archived logs, group logs from the same time period into a backup set because they will probably need to be restored at the same time.
When parallelizing, RMAN always allocates channels in numerical order, beginning with 1 and ending with the parallelism setting. Note that in this case the long-term backup must be consistent. For example, datafile copies that are suitable for use in a SWITCH can be tagged differently from file copies that should be used only for RESTORE. When a backup retention policy is in effect, RMAN considers backups and copies of datafiles and control files as obsolete, that is, no longer needed for media recovery, according to criteria that you specify in the CONFIGURE command. Backup optimization is enabled when the following conditions are true: For example, assume that you run these commands: If none of these files has changed since the last backup, then RMAN does not back up the files again, nor signal an error if it skips all files specified in the command. AVAILABLE, CROSSCHECK, or DELETE against a file that is only on disk (that is, an ARCHIVELOG, DATAFILECOPY, or CONTROLFILECOPY). If optimization is enabled, and if a retention policy is configured for a recovery window, then RMAN always backs up datafiles whose most recent backup is older than the recovery window. In releases before Oracle9i, the ALLOCATE CHANNEL command does not cause RMAN to contact the media manager; RMAN does not call the media manager unless a BACKUP, RESTORE, or RECOVER command is issued.
PARALLELISM command. Oracle9i Database Concepts for more information about NOLOGGING mode. RMAN creates three backup sets and groups the files into the sets so that each set is approximately the same size. You can specify the LOGS option to save archived logs for a possible incomplete recovery of the long-term backup. Assume that you configure a retention policy for redundancy. "Backup Retention Policies" to learn how to configure a policy that determines which backups are obsolete. As Figure5-2 illustrates, RMAN performs compression on its backups, which means that datafile blocks that have never been used are not backed up. The purpose of this feature is to guarantee that the backed up datafiles can be recovered to a consistent state. You can also back up another backup set, as when you want to back up a disk backup to tape, or an image copy. A backup taken when the database is mounted (but not open) and was not crashed or shut down with the ABORT option prior to mounting. Run the RMAN COPY command or an operating system command such as the UNIX cp command to create image copies. RMAN uses file location information obtained from the database server to determine which datafiles are on which disk drives. Note that multiplexing in this sense is completely different from duplexing. Instead, you can use the SWITCH command to point the control file at the copy and update the repository to indicate that the copy has been switched. So, RMAN reads the multiplexed data for the first sixteen files and then starts reading the data for data17.f. For example, if DISKRATIO=4 and the datafiles are located on three disks, then RMAN attempts to distribute the datafiles into three backup sets. When backing up to tape you should allocate one channel for each physical device, but when backing up to disk you can allocate as many channels as necessary for maximum throughput. However, RMAN must do further checking to determine whether to skip the file, because both the retention policy feature and the backup duplexing feature influence the algorithm that determines whether RMAN has "enough" backups on the specified device type. You cannot manually allocate a channel with the ALLOCATE CHANNEL command and then prefix the channel name with ORA_. Because incrementals are not as big as full backups, you can create them on disk more easily. Provided the sum of physical and logical corruptions for a file remains below its MAXCORRUPT setting, the RMAN command completes and Oracle populates V$BACKUP_CORRUPTION and V$COPY_CORRUPTION with corrupt block ranges. The RECOVERY WINDOW option is mutually exclusive with the REDUNDANCY option. Then, you run the following backup: In this case, RMAN can use the failover feature to back up the archived logs as described in the following table. You can back up datafiles, control files, archived redo logs, and the current server parameter file. If the database is open and the datafile is online and read/write, then you must place the tablespace in backup mode, that is, issue the SQL statement ALTER TABLESPACE BEGIN BACKUP before creating the copy. Note that RMAN can include a control file in an incremental backup set, but the control file is always included in its entirety--no blocks are skipped. RMAN automatically restores needed archived logs from tape to disk during recovery. If the number of format values exceeds the number of copies, then the extra formats are not used. In a cumulative level n backup, RMAN backs up all the blocks used since the most recent backup at level n-1 or lower. Also, assume that the copy utility reads the entire block while database writer is in the middle of updating the block. By default, RMAN selects the most recent backups to restore unless qualified by a tag or a SET UNTIL command. Assume that the database contains 50 datafiles spread across 6 disks, and the operating system is able to deliver this disk contention information to the server. A level 0 incremental backup, which is the base for subsequent incremental backups, copies all blocks containing data. For example, you can validate that all database files and archived redo logs can be backed up by issuing a command as follows: You cannot use the MAXCORRUPT or PROXY parameters with the VALIDATE option. For example, if you configure PARALLELISM to 3 for the default sbt device and PARALLELISM to 2 for DISK, then RMAN automatically allocates three sbt channels and two DISK channels during the restore. In this case, configure channels for disk and tape devices, but make the device of sbt the default device: RMAN only allocates sbt channels when you run backup commands. The following statement uses parallelization on the same example: one RMAN BACKUP command backs up three datafiles, with all three channels in use. A full backup includes all used data blocks in the datafiles. If you specify neither parameter, then DISKRATIO defaults to 4. Unless you manually run an ALLOCATE CHANNEL command, RMAN allocates automatic channels according to the settings in these commands: For example, you can issue the following commands at the RMAN prompt: RMAN automatically allocates channels according to values set with the CONFIGURE command in the following cases: You can override automatic channel allocation settings by manually allocating channels within a RUN block. An incremental backup reads the entire file and then backs up only those data blocks that have changed since a previous backup. In determining the characteristics of the RMAN backup sets, the basic algorithm is influenced by the following factors: The most important rules in the algorithm for backup set creation are: RMAN writes backup pieces sequentially; striping a backup piece across multiple output devices is not supported. An image copy differs from a backup set because it is not multiplexed, nor is there any additional header or footer control information stored in the copy. In other words, KEEP FOREVER LOGS means that RMAN not consider logs generated after the long-term backup to be obsolete. If no level 1 is available, RMAN copies all blocks changed since the base level 0 backup. Assume the following example in which RMAN backs up eight files with three channels. You cannot use COPY to make a copy to a device other than DISK. Allocation of one or more RMAN channels is necessary to execute most backup and recovery commands. You can turn the autobackup feature on or off by running the following commands: The purpose of the control file autobackup is to provide a way to restore the backup repository contained in the control file when the control file is lost and the recovery catalog is either lost or was never used. When you recover using SQL*Plus, Oracle applies the blocks and changes during recovery, so it does not matter that the block in the backup was fractured. You decide to restore data17.f, which is datafile 17. At the beginning of every BACKUP ARCHIVELOG command that does not specify an UNTIL clause, RMAN attempts to automatically switch out of and archive the current online redo log. The automatic backup of the control file occurs in addition to any backup of the current control file that has been performed during these commands. RMAN uses this data to resynchronize the recovery catalog. For example, you can run DELETE OBSOLETE in a weekly script. For example, if datafile copies are created each Monday evening and are always tagged mondaypmcopy, then the tag refers to the most recent copy (assuming that no SET UNTIL command is issued before restore or recovery). By default, one backup set contains one backup piece. The behavior of this command is the same as BACKUP KEEP. Run the REPORT OBSOLETE command to determine which backups and copies are currently obsolete according to the retention policy. In this sense, the BACKUP VALIDATE command is similar to the RESTORE VALIDATE command, except for backups rather than restore jobs. If you specify a tag when specifying input files to a RESTORE or SWITCH command, then RMAN considers only backup sets with a matching tag when choosing which backup to use, Oracle9i Recovery Manager Reference for SWITCH syntax, and Oracle9i Recovery Manager Reference for RESTORE syntax. The media manager should never expire a tape until all RMAN backups on that tape have been removed from the media manager's catalog. RMAN can create and restore full backups of the datafiles, control files, and archived redo logs. This functionality is also known as duplexing a backup set. BACKUP COPIES is specified. Assume that you run the following backup at 3 p.m.: In this case, RMAN sets n=3 and so will not back up the logs created before 9 a.m. because three copies already exist on tape. "Configuring the Retention Policy for a Recovery Window". When a tablespace is in backup mode, Oracle writes the before-image of each changed block in the tablespace to the redo log before modifying it. You can then perform recovery on the copy. When determining whether a file has been backed up, RMAN compares the SINCE TIME date with the completion time of the most recent backup of the file. You can specify a different format for a device type with the CONFIGURE CONTROLFILE AUTOBACKUP FORMAT command. The BACKUP BACKUPSET command uses the default disk channel to copy backup sets from disk to disk. You can use the BACKUP CHANNEL command to manually assign a channel to back up specified files. This backup piece contains the intermingled data blocks of the three input files. Oracle9i Recovery Manager Reference for BACKUP MAXCORRUPT syntax, and Oracle9i Recovery Manager Reference for COPY MAXCORRUPT syntax.
The size of the backup file depends solely upon the number of blocks modified and the incremental backup level. RMAN searches for values of n in this order of precedence (that is, values higher on the list override values lower on the list): By default, n=1. RMAN copies the block in case the user wants to try to salvage the contents of the block. You can also use the FILESPERSET parameter to limit the number of datafiles included in a backup set. The retention policy influences backup optimization. Note that the Tuesday backup of users is obsolete beginning on Thursday. This behavior is similar to the behavior of RMAN when backing up archived redo logs that exist in multiple archiving destinations. The FILESPERSET parameter limits the number of files (control files, datafiles, or archived logs) that can go in a backup set. Hence, the advanced algorithm dictates that each of the 10 backup sets must contain datafiles from at least 5 of the 6 disks. For example, in an Oracle Real Application Clusters environment you can enter: In this example, RMAN allocates 2 channels for every backup job, ORA_SBT_TAPE_1 and ORA_SBT_TAPE_2. One danger in making online backups is the possibility of inconsistent data within a block. Oracle Corporation does not recommend hardware multiplexing of RMAN backups. When LOGS is specified, all logs more recent than the backup are kept as long as the backup is kept. Oracle9i Recovery Manager Reference for the default settings for each CONFIGURE command, and "Showing All RMAN Configuration Settings". A generic automatic channel simply creates a configuration that can be used for any channel that is not explicitly configured. By using integrity checks, the Oracle server automatically does the following: You can use the BACKUP VALIDATE command to perform a test run backup without actually producing output files. For example, you can configure disk and tape channels as follows: Because you do not specify channel numbers for these channels, the channel settings are generic to all automatic channels of the specified type. The point of recoverability is the earliest time for a hypothetical point-in-time recovery, that is, the earliest point to which you can recover following a media failure. In this scenario, the current time is January 30 and the point of recoverability is January 23. Incremental backups at levels greater than zero only copy blocks that were modified. For example, if you back up 70 datafiles and FILESPERSET is 64, then RMAN produces 2 backup sets. To restrict the size of each backup piece, specify the MAXPIECESIZE option of the CONFIGURE CHANNEL or ALLOCATE CHANNEL commands. If the SINCE TIME is later than the completion time, then RMAN backs up the file. Cumulative backups require more space and time than differential backups, however, because they duplicate the work done by previous backups at the same level. The following query displays the number of blocks written to a backup set for each datafile with at least 50% of its blocks backed up: Compare the number of blocks in differential or cumulative backups to a base level 0 backup. For datafile copies and proxy copies, if RMAN determines that the copy or proxy copy is not needed, then the copy or proxy copy can be deleted. For example, you may make a database backup on the first day of every year just to keep a record. For example, if you set the recovery window to 7 days with the CONFIGURE command, then you can run the following command to determine which backups and archived redo logs are obsolete: Note that if you configure the retention policy to NONE, then RMAN does not consider any backups or copies as obsolete. The BACKUP BACKUPSET command is a useful way to spread backups among multiple media. The REDUNDANCY parameter specifies that any number of backups or copies beyond a specified number need not be retained. Access these records through the V$BACKUP_CORRUPTION and V$COPY_CORRUPTION views. What size to make the backup sets to keep the parameter restriction. A maintenance channel is useful only for a maintenance task; you cannot use it as an input or output channel for a backup or restore job. Only one RMAN session communicates with the allocated server sessions. If DISKRATIO=n, then each backup set must read data from at least n disk drives. If you do not restrict the backup piece size, then every backup set contains only one backup piece. The CONFIGURE CHANNEL DEVICE TYPE command configures generic settings that are used for all automatic channels of the specified device type. If the database is in ARCHIVELOG mode, then the target can be open or closed: you do not need to close the database cleanly. If you set FILESPERSET but not DISKRATIO, then DISKRATIO defaults to the same value as FILESPERSET. In this way, you do not cause either disk backups to fail because of space restrictions or tape backups to span multiple volumes. You can then periodically or regularly issue the REPORT OBSOLETE command to view obsolete files and DELETE OBSOLETE to delete them. If the backup includes datafile 1, then RMAN automatically includes the current control file and server parameter file in the datafile backup set. In this example, after resilvering the mirror (not including other copies of the broken mirror), then you must use a CHANGE UNCATALOG command to update the recovery catalog and indicate that this copy is no longer available. For example, you can implement a three-level backup scheme so that a full or level 0 backup is taken monthly, a cumulative level 1 backup is taken weekly, and a cumulative level 2 is taken daily. For example, a backup of datafile 1 may receive the tag TAG20020208T133437. The new catalog will be populated with backup information from the restored control file. If you make backups using proxy copy and then downgrade Oracle to a non-proxy version, RMAN will not use proxy copy backups when restoring and will issue a warning when the best available file is a proxy copy. As you produce datafile, control file, and archived log backups over time, RMAN keeps track of which to keep and which are obsolete. For example, in a cumulative level 2 backup, RMAN determines which level 1 backup occurred most recently and copies all blocks changed since that backup. Assume that you run the following command: RMAN performs an automatic failover and includes only the uncorrupted copies in its backup set. If possible, group files that will be restored together into the same backup set. For example, assume that you configure the sbt device and run a backup as follows: Channel names beginning with the ORA_ prefix are reserved by RMAN for its own use. The advanced algorithm also looks at DISKRATIO, which in this case defaults to 4. You can also simply connect to the target instance in NOCATALOG mode and restore the database. A full backup is not the same as a whole database backup: "full" is an indicator that the backup is not incremental. Note that one consequence of this mechanism is that RMAN applies all blocks containing changed data during recovery--even if the change is to an object created with the NOLOGGING option. You implement this retention policy as follows: This command ensures that for each datafile one backup that is older than the point of recoverability must be retained. If you specify channels manually, then the ALLOCATE CHANNEL command (executed only within a RUN command) and ALLOCATE CHANNEL FOR MAINTENANCE command (executed only at the RMAN prompt) specify the type of I/O device that the server session will use to perform the backup, restore, or maintenance operation. Use caution when enabling backup optimization if you use a media manager that has an expiration policy. If you specify UNTIL, then RMAN will not mark the backup as obsolete until after the UNTIL date has passed. Since RMAN needs to read all of the blocks of the datafile, full backups and incremental backups take approximately the same amount of time. The proxy functionality was introduced in Oracle8i Release 1 (8.1.5). You must catalog operating system copies with RMAN before using them with the RESTORE or SWITCH commands. A differential incremental level 2 backup backs up all blocks that have changed since the most recent incremental backup at level n or less; in this case, the most recent incremental backup at level 2 or less is the level 2 Monday backup, so only the blocks changed since Monday will be backed up. A backup of any part of the target database when. Whether you allocate channels manually or automatically, you can use channel control commands and options to do the following: On some platforms, the channel allocation and channel control commands specify the name or type of an I/O device to use. You have two mutually exclusive options for implementing an retention policy: specifying a recovery window, or specifying redundancy (the default type of retention policy). Multiplexing is affected by the factors described in Table5-1. Use the RMAN COPY command to create an image copy to disk. You can use the automatic channel allocation feature to configure a set of persistent, automatic channels for use in all RMAN sessions. RMAN reads the entire file every time whether or not the blocks have been used. RMAN uses a different method to guarantee consistency in online backups. The datafile must be offline-normal, read-only, or closed normally. The fewer the files contained in a backup set, the faster one of them can be restored, because there is less data belonging to other datafiles that must be skipped. "Backups Exempt from the Retention Policy" for a description of retention policies and how files can be exempt or non-exempt. You may want to store a long-term backup, potentially offsite, for much longer than the time dictated by the user's retention policy. Besides RECOVERY WINDOW, the CONFIGURE command has another mechanism for controlling how long backups should be retained: the REDUNDANCY parameter. If the number of format values is less than the number of copies, then RMAN reuses the format values, starting with the first one. The total number and size of backup sets depends on which algorithm RMAN uses: the basic algorithm or the advanced algorithm. If you do not want to use automatic channels, then you can allocate multiple channels manually within a RUN command, thus allowing a single RMAN command to read or write multiple backups or image copies in parallel. Oracle9i Recovery Manager Reference to learn the syntax for the backupSpec clause, and Chapter14, "Tuning Recovery Manager" to learn about RMAN buffer management. By default, n=1. Hence, RMAN backs up three copies of the logs created after 9 a.m.
For example, in a differential level 2 backup, RMAN determines which level 1 or level 2 backup occurred most recently and backs up all blocks modified after that backup. This option limits backup piece size to the specified number of bytes. If you specify the DELETE INPUT option, then RMAN backs up exactly one copy of each specified log sequence number and then deletes the copy from disk after backing it up. If RMAN encounters datafile blocks that have not already been identified as corrupt, then it writes them to the backup with a reformatted header indicating that the block has media corruption (assuming that SET MAXCORRUPT is not equal to 0 for this datafile and the number of corruptions does not exceed the limit). However, you can back up this backup set and give this new copy of the backup set the tag bar. For example, if you set PARALLELISM for DISK to 10, and the default device type is DISK, then RMAN allocates ten disk channels using the settings in the CONFIGURE CHANNEL DEVICE TYPE DISK command. The maximum number of files to include in the backup set. Otherwise, the media manager would be forced to keep the January 3 backup of tablespace tools indefinitely. You can specify the tag rather than the filename when executing the RESTORE or CHANGE command. If FILESPERSET is 6 and MAXOPENFILES is 1, then the channel includes 6 datafiles in a set but does not multiplex the files because RMAN is not reading from more than one file simultaneously. For example, RMAN uses these names for two manually allocated disk channels: Note that if you run the CONFIGURE DEVICE TYPE command to configure a device type and do not run CONFIGURE CHANNEL for this device type, then RMAN allocates all channels without other channel control options. Whether the ALLOCATE CHANNEL command or CONFIGURE CHANNEL causes the media manager to allocate resources is vendor-specific. In this case, you can regularly run the following command: This command backs up backup sets that were created more than a week ago from disk to tape, and then deletes the backup sets from disk. You can either let RMAN determine a unique name for backup pieces or use the FORMAT parameter to specify a name. You can also specify the REDUNDANCY or RECOVERY WINDOW options on the REPORT or DELETE commands. The RMAN BACKUP BACKUPSET command backs up backup sets rather than actual database files. The server sessions divide the work of backing up the specified files. This section contains these topics: Although you cannot archive logs directly to tape, you can use RMAN to back up archived logs from disk to tape. An example of the RMAN LIST output follows: For datafile or datafile copy backups, group multiple datafiles into a single backup set to the extent necessary to keep an output tape device streaming, or to prevent the backup from consuming too much bandwidth from a particular datafile. The date and time refer to when RMAN started the backup. So, the backup set has two identical copies: one tagged foo and the other tagged bar. This situation occurs because restoring the January 28 backup does not enable you to recover to the earliest time in the window, January 23. For example, RMAN names the first DISK channel ORA_DISK_1, the second ORA_DISK_2, and so forth. For the RESTORE command and the various maintenance commands (for example, DELETE), RMAN determines which device types are required, and allocates all necessary channels. In this way, RMAN can include the current redo log in the backup set. COPIES setting, so RMAN sets n=2. A proxy copy is a special type of backup in which RMAN turns over control of the data transfer to a media manager that supports this feature. RMAN queries corruption information at the completion of a backup and stores it in the recovery catalog and control file. The advanced algorithm also factors in DISKRATIO, which here defaults to 5 (the same value as FILESPERSET). Using a media management system that is available and supported on your operating system, you can write backup sets to sequential output media such as magnetic tape. For example, if you implement a recovery window of one week, then this window of time must extend back exactly seven days from the present so that you can restore a backup and recover it to this point. If you run the following command, then RMAN returns the retention policy to the default value: You can also run the following command to disable the retention policy altogether: If the retention policy is configured to NONE, then REPORT OBSOLETE and DELETE OBSOLETE do not consider any backups to be obsolete. If you do not specify a tag name, then by default RMAN creates a tag for backups and copies (except for control file autobackups) in the format TAGYYYYMMDDTHHMMSS, where YYYY is the year, MM is the month, DD is the day, HH is the hour (in 24-hour format), MM is the minutes, and SS is the seconds. One effective strategy is to make incremental backups to disk and then run BACKUP BACKUPSET to copy the backups to a media manager. Rather, RMAN produces one backup set with a unique key, and generates 3 identical copies of each backup piece in the set, as shown in this sample LIST output: When choosing which FORMAT value to use for each backup piece, RMAN uses the first format value for copy number 1, the second format value for copy number 2, and so forth. RMAN cannot implement an automatic retention policy if backups are deleted by non-RMAN methods, for example, through the media manager's tape retention policy.
Consequently, RMAN issues an error when you run REPORT OBSOLETE without any other options. You can limit the speed of a backup by using the RATE option of the ALLOCATE CHANNEL or CONFIGURE CHANNEL commands. The substitution variable %F is defined in the description of the CONFIGURE command. Access this data using the views V$BACKUP_CORRUPTION and V$COPY_CORRUPTION. When you specify DEVICE TYPE DISK with any version of RMAN, RMAN does not allocate operating system resources other than for the creation of the server session and does not call the media manager. If the SCN in the input data block is greater than or equal to the checkpoint SCN of the parent, then RMAN copies the block. For backup sets containing archived logs, group logs from the same time period into a backup set because they will probably need to be restored at the same time.
When parallelizing, RMAN always allocates channels in numerical order, beginning with 1 and ending with the parallelism setting. Note that in this case the long-term backup must be consistent. For example, datafile copies that are suitable for use in a SWITCH can be tagged differently from file copies that should be used only for RESTORE. When a backup retention policy is in effect, RMAN considers backups and copies of datafiles and control files as obsolete, that is, no longer needed for media recovery, according to criteria that you specify in the CONFIGURE command. Backup optimization is enabled when the following conditions are true: For example, assume that you run these commands: If none of these files has changed since the last backup, then RMAN does not back up the files again, nor signal an error if it skips all files specified in the command. AVAILABLE, CROSSCHECK, or DELETE against a file that is only on disk (that is, an ARCHIVELOG, DATAFILECOPY, or CONTROLFILECOPY). If optimization is enabled, and if a retention policy is configured for a recovery window, then RMAN always backs up datafiles whose most recent backup is older than the recovery window. In releases before Oracle9i, the ALLOCATE CHANNEL command does not cause RMAN to contact the media manager; RMAN does not call the media manager unless a BACKUP, RESTORE, or RECOVER command is issued.