Official Document Backup Recovery guide 8 RMAN backup concepts

Source: Internet
Author: User
Tags disk usage
Content of this Chapter
  • Consistent and inconsistent RMAN backups
  • Online backups and backup mode

  • Backup Sets

  • Image copies

  • Multiple copies of RMAN backups

  • Control File and server parameter file autobackups

  • Incremental backups

  • Backup retention policies

  1. consistent and inconsistent backup of consistent and inconsistent RMAN backupsConsistent backup refers to the backup performed after the database is shut down normally (shutdown normal shutown immediate shutdown transactional. Inconsistent backup refers to the backup performed when the database is enabled. Note: In noarchivelog mode, inconsistent backups cannot be performed. 2. online backups and backup mode online backup and backup modesUser-managed backup: If data files are directly copied, the data blocks are inconsistent. The data blocks contain the updated and unupdated parts, such a block is called a broken block ). Broken blocks cannot be used for recovery and are invalid. Therefore, they cannot be used to copy data files and back up data files in the Open Database. When you perform user Backup management (umb) backup, you must first set the data file to backup mode: Alter datafile (tablespace) xx begin backup; then execute a similar OS command: copy D: \ oracle \ users01.dbf to E: \ backup. When the data file is in backup mode, the database writes the image of the data block to the log file before modifying the block, and then writes the modified content to the log file. Data data will also freeze the data file checkpoint until the backup mode is released. The data header is frozen because when a data file is copied using a third-party tool, you cannot copy the data file header first and then the file block. See: http://blog.csdn.net/cymm_liu/article/details/7899056 RMAN backup does not need to place the data file in backup mode because RMAN knows the format of the data block. RMAN does not copy broken blocks. during replication, RMAN compares the header and tail of the blocks. If it is a broken block, RMAN reads it again. If it is still broken, RMAN recognizes it as a permanent broken block. However, RMAN does not freeze the data file header, because RMAN can know the sequence of data blocks in the database square data file from the check point. 3. Backup sets backup setContent of this section:
  • Backup sets and backup pieces

  • Block compression for backup Sets

  • Binary compression for backup Sets

  • Backup undo

  • Encryption for backup Sets

  • Filenames for backup pieces

  • Number and size of backup pieces

  • Number and size of backup Sets

  • Multiplexed backup Sets

  • Proxy copies

1) backup sets and backup pieces backup sets and backup slice backup sets are the smallest logical unit of backup. You can only back up an SBT to a backup set. The backup set contains one or more binary files called backup slices. When the size of each backup file (that is, the backup file) is specified, a backup may be divided into multiple copies. When multipart backup is enabled, a large file is divided into multiple parts for parallel backup to generate multiple backup parts, each of which contains part of the file. RMAN remembers the metadata about the multipart backup. 2) block compression in the block compression for backup sets backup set:
  • Unused block compression (supports disk backup and Oracle Secure Backup Tape backup) unused blocks for compression (supports disk backup and Oracle Secure Backup Tape backup)

  • Null block compression (supports all backups) Empty block compression

Here, "compression" is not the compression of exponential data, but block filtering is more accurate. Unused block compression indicates that when a block does not belong to any segment, RMAN does not back up this block and can only be used on locally managed data files. If this function is not enabled, RMAN backs up each block of the data file. Empty block compression means that when a block has never been used (Not allocated), this block is ignored. every time RMAN is inserted into a block, it determines whether it is an empty block. unused block compression unused blocks are automatically enabled by default. usage: 1. compatible >=10.2 2. the database does not have a restore point for guaranteed. 3. local management of data files 4. backup on disk or Oracle Secure Backup Tape backup null block compression empty block compression Oracle will check whether the block is used each time. If it is not used, it will not be backed up. 3) binary compression for backup sets binary compression command: Configure device type <disk | SBT> Backup Type to compressed backupset for compression backup. I have already talked about it in the previous chapter. it is recommended that you search for it online. The document is vague. 4) backup Undo can enable undo backup optimization. If committed transactions are not backed up, only uncommitted transactions are backed up. undo optimization cannot be configured and is enabled forcibly. for more information, see: http://www.eygle.com/archives/2007/07/oracle11g_rman_undo_bypass.html 5) encryption for backup sets encryption backup the previous chapter also said, no more, completely repeated content. 6) number and size of backup pieces the number and size of backup slices by default, RMAN only generates one backup slice for one backup set. you can use maxpiecesize to limit the size of the backup file. backup slice external example: Each tape only has 10 Gb, but the backup set has a total of 80 GB. In this case, you need to set the backup slice, the first 10 Gb. if the setion size is set, multi-segment backup is enabled. For example, if a GB file is set, the setion size is set to 30 GB, 10 channels (if 10 channels are already set) will be enabled for parallel backup to increase the speed of large file backup. 7) number and size of backup sets the number and size of backup sets depend on the RMAN algorithm (generally, a RMAN channel backs up a file, if there are 15 files, four channels will generate 15/4 = 3 + 3/4 = 4 backup sets. If there are 17 files, five backup sets will be generated ). you can use maxsetsize to set the size of each backup set. if all files are 100 GB in total and maxsetsize is 40 GB, three backup sets are generated. you can also specify FILESPERSETThe number of data files in each backup set of the device. 8) multiplexed backup sets multi-path backup multiplexed backup sets refers to reading multiple files at the same time and then writing a backup set. Some features are not available when you back up an image.
Multiple backups are determined by multiple factors. FILESPERSET   Specifies how many data files a backup set can have. MAXOPENFILESThe number of data files that the parameter RMAN can read at the same time. The algorithm is as follows (maxsetsize maxpiecesize is not set here): 1. the number of data files in each backup set: the number of data files in each backup set = min (filesperset, number of data files to be backed up. The default value of filesperset is 642. The level of multiplexing (level of multiplexing) level of multiplexing determines the number of data files simultaneously read (written to a backup set ). This value is Min (maxopenfiles, the number of data files in each backup set ). the default value is 8. example: Backup 12 files. If filesperset is 4, the data file of each backup set is Min () = 4. level of multi-path backup = min () = 4. then, four multi-path backups are performed simultaneously. If there are 50 data files and filesperset is not set (filesperset is the default value of 64), the number of data files for each backup set is 50, and the number of multi-path backups is Min (50, 8) = 8. at the same time, 8 data files are written into a backup set. Note: Do not use multiple backups on tape. Multi-path backup only backs up multiple data files to one backup set at the same time. It is determined by filesperset and maxsetsize to generate several backup sets. Do not confuse them. In fact, a channel generates at least one backup set. When the data in the channel is greater than filesperset, the number of backup sets is determined by the number of file data/channels. 9) proxy copies proxy backup can be performed through the Media Manager Proxy backup, and the disk cannot be used for proxy backup. it is used only when the media manager has the proxy backup function. the document is not described in detail. 2. Copy and backup an image copies ImageDirectly copy files, unlike backup sets that only back up used blocks, which are exactly the same as OS replication. (PS: I don't think it is exactly the same. If it is the same, simply copy it using OS. Why do I need to place the data files in the backup mode during manual hot backup? Rman must first read the data file header, while OS replication may start from any part .) image backup can be used for non-RMAN restoration and restoration. 1) images created by RMAN-created image copies RMAN are backed up using backup as copy. you can set the default disk backup type to image. during image copying, the system checks whether the data block is incorrect and records the backup information. the default backup file name format is U %. for example:
/d1/oracle/work/orcva/RDBMS/datafile/o1_mf_sysaux_2qylngm3_.dbf
You can set DB_FILE_NAME_CONVERT, And set initialization parameters DB_FILE_NAME_CONVERTThe role is the same. when the image is restored, the image is copied to the location of the data file to be restored by default and then restored. However, you can set the data file switch, directly use the data file in the image instead of restoring the data file. 2) User-managed image copies the manually executed backup file of the image copied by the user can be used by RMAN. use the catalog command to check the backup image file and write the backup information to the RMAN resource library. however, the catalgo command does not perform the following operations:
1. check whether the image is incorrect. 2. make sure that the image is currently in backup mode. After the check is complete, you can use the restore or switch command to use this image, just like the image backed up by RMAN. after the image is deleted, execute change... the uncatalog command deletes the image information from the RMAN resource library. 5 multiple copies of RMAN backups multi-copy (multiple identical backup slices are generated in one backup)1) duplexed backup sets multi-copy backup a single backup can generate up to four identical backup slices in different paths, and can only be used for backup sets, not for images. it can be used on disks or tapes, but it cannot be backed up simultaneously on disks or tapes. when using tape, note that the number of backup sets must not exceed the number of disk drives. usage: Used in confiuger bakcup set.
BACKUP DEVICE TYPE DISK COPIES 3 DATAFILE 7   FORMAT ‘/disk1/%U‘,‘?/oradata/%U‘,‘?/%U‘;
RMAN does not generate three identical backup sets, but generates a backup set that contains three identical backup slices. 2) backups of backups backup sets or images can be used to back up existing backup sets or images. 1. backups of backup sets back up the backup sets again, which is generally used to put the backup sets on different devices (during backup, the backup cannot be backed up to disks and tapes at the same time ). if an existing backup set is backed up to the tape. moreover, when a backup set is unavailable, RMAN searches for the same backup set from another media. copy the data to the disk at the same time (the premise is that configure has a SBT channel ):
BACKUP DEVICE TYPE DISK AS BACKUPSET   DATABASE PLUS ARCHIVELOG; BACKUP   DEVICE TYPE sbt   BACKUPSET ALL; # copies backup sets on disk to tape
Back up the backup one week ago from the disk to the tape and delete the backup on the disk:
BACKUP   DEVICE TYPE sbt   BACKUPSET COMPLETED BEFORE ‘SYSDATE-7‘   DELETE INPUT
2. backups of image copies you can back up an existing image to a backup set or image. 6. Control File and server parameter file autobackups automatic backup of control files and parameter filesBackup control files and parameter files are very important for recovery. If the control files and parameter files are lost during recovery, you can restore the control files and parameter files from the backup. configure controlfile autobackup is on Enables automatic backup of control files. After a backup is performed, the control files are automatically backed up. if the database runs in archivelog mode, when the database structure changes (such as adding data files), The RMAN automatically backs up the control file (human operation is not required ??????) How RMAN performs control file autobackups RMAN how to implement automatic backup of control files? During automatic backup, RMAN uses the first channel to create a backup set dedicated to the backup control file, and also backs up the spfile to this backup set. note: automatic backup of control files only backs up one copy, not multiple copies at the same time. 7. incremental backups Incremental BackupIncremental Backup only backs up the last Incremental backup. 1) Multilevel incremental backups multi-level Incremental Backup includes two levels of 0 and 1. level 0 backup is the basis for level 1 Incremental backup. Both the backup set and the image can be used as level 0 backup. note: Full backup cannot be used as the basis for Incremental backup. the only difference between full backup and Zero backup is that Zero backup can be used as the basis for Incremental backup, full backup is not allowed (it's a very difficult difference !!!!!!! Silly !!!!) Incremental Backup can be divided into two types: 1. differential backup differential Incremental Backup: backs up the last modified block with an increment of 0 and 1. cumulative backup cumulative incremental backup: backs up the blocks that have been modified since the last increment is 0. differential backup is used by default. 1. differential backup differential Incremental Backup the last incremental block that has been modified since level 0 and Level 1 (which can be Level 1 Cumulative backup. backup is performed at level 0 on weekends, and differential backup is performed at level 1 from Monday to week 6. 2. cumulative Incremental Backup backs up the blocks that have been modified since the last increment of 0. backup at level 0 on Sunday and backup at level 1 from Monday to Saturday. 3. block change tracking block modification tracking: records the blocks modified in the data file in the file. during Incremental backup, you need to back up these blocks, the backup speed is improved, but the impact of the system is small. if block tracing is not enabled, all data file blocks are scanned during Backup. A block tracking file is a binary file, which is placed in the database area DB_CREATE_FILE_DESTParameter ). 4. incremental backup algorithm <1> checkpoint SCN each data file has a data file checkpoint SCN (data file checkpoint SCN), view v $ datafile. checkpoint_change # The field can be obtained. All data blocks smaller than this SCN have been written in the file (that is, the dirty blocks before this SCN have been written into the data file ). when the level 0 Incremental backup is executed, the data file and the SCN will be written to the backup. during incremental Level 1 backup, the SCN of the data file in the backup file is pushed forward to the SCN after the Incremental backup. (During the backup, the backup should be stopped after the backup to the checkpoint SCN) <2> incremental start SCN Incremental Backup starts scnthis SCN applies only to level 1 incremental backups. all blocks whose SCN is greater than or equal to the incremental start SCN are stored in the backup. blocks whose SCN is lower than the incremental start SCN are not supported ded in the backup. the incremental start SCN is most often the checkpoint SCN of the parent of the level 1 backup. blocks greater than or equal to the incremental start SCN will be written in this backup. Blocks smaller than the incremental start SCN will not be written into this backup file. for differential backup, the incremental start SCN is the checkpoint SCN (checkpoint SCN) of the last backup level 1 or 0 ), the incremental start SCN of the cumulative backup is the checkpoint SCN (checkpoint SCN) of the zero-level backup ). (To put it simply, after level 0 backup, the data file SCN is 10, and after Level 1 backup, the data file SCN is 15, then the incremental start SCN of the differential backup is 16, backup starts from SCN 16. and the cumulative backup incremental start SCN is 10, and the backup starts from SCN 10 ). <3> Each SCN of the block SCN data block records the SCN (Version Number) corresponding to the latest modification ). when block tracking is enabled, you do not need to scan the entire data file to know the incremental start SCN (the SCN starting from the next backup, that is, the checkpoint SCN at the end of the last backup) back up the changed blocks to the current checkpoint SCN. an important conclusion: Incremental Backup backs up block changes of nologing objects. if the nologing object is created after the 0-level backup and the Incremental Backup has backed up this object, the Incremental backup is the only one that can be restored (it should be a limited restoration, restore to the last Incremental backup of this nologing object) method of this object. if it is a full backup, you need to use the log to restore, and the object is nologing, it cannot be restored. 5. recovery with incremental backups Incremental Backup Recovery in recovery, RMAN preferentially chooses Incremental Backup instead of archiving logs to restore files. because Incremental Backup recovery is much faster than archiving logs. if a data file only exists in Incremental backup, you do not need to restore the basic Incremental backup of this Incremental Backup (the previous Incremental Backup ). 8. Backup retention policies backup retention policyUse CONFIGURE RETENTION POLICYYou can create an automatic retention policy. expired backup: When the backup set is no longer needed for restoration, this backup set is (expired ). you can set a retention policy to determine when the backup expires. note: The latest backup that can be used for recovery will never expire, even if the backup policy is violated. RMAN indicates an expired backup, but does not delete the expired backup. You must manually execute the RMAN command. if FRA is enabled and FRA space is insufficient, Oracle will automatically delete expired backups or copies to tapes in FRA. expired backup: only valid backup is found, that is, RMAN uses the crosscheck command to detect Backup loss. the lost backup is called expired backup. the retention policy is only used for full backup \ 0 backup \ automatic backup of control files. the retention policy for Incremental backup or archive log backup depends on whether full backup or level 0 backup is required. 1) Recovery window reserved window indicates that the last n records can be restored. At any time point in the day, n is the retention period window. RMAN retains full backup, Incremental backup, and archived logs based on this retention policy. It can be recovered to any time point within 7 days:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
To meet this requirement, you must have a backup that was created seven days ago (for example, 7 days are 1st, and 7. If you only have a backup on the next day, it cannot be recovered to days, does not meet the conditions ):
SYSDATE - BACKUP CHECKPOINT TIME >= 7
For example, if a is retained for 7 days and B is backed up for two days:
January 1 January 15 January 29 February 12

C. Current Time: January 1, February 23

The backup of jan1 jan7 expires, and the backup of jan14 jan21 does not expire. Logs earlier than log500 also expire. A backup of jan14 is used to restore between jan16-jan21. Jan21 backup is used to restore data between jan21 and jan23. 2) the Backup Redundancy backup redundancy policy using the retention window may make the disk usage more complex, because various files need to be retained. backup Redundancy is much simpler. only two copies of the backup that may be used for recovery are retained:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
For example, the backup is complete on Monday and Tuesday. After the backup is completed on Wednesday, the backup on Monday is invalid. Two backups are available for recovery and the old backup is automatically expired. this chapter contains a lot of content and is hard to understand. It took me three nights ....

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.