Backup Enhancements
Expanded Image Copying Features. A standard RMAN backup set contains one or more backup pieces, and each of these pieces consists of the data blocks for a particular datafile stored in a special compressed format. When a datafile needs to be restored, therefore, the entire datafile essentially needs to be recreated from the blocks present in the backup piece.
An image copy of a datafile, on the other hand, is much faster to restore because the physical structure of the datafile already exists. Oracle 10g now permits image copies to be created at the database, tablespace, or datafile level through the new RMAN directive BACKUP AS COPY. For example, here is a command script to create image copies for all datafiles in the entire database:
RUN {
# Set the default channel configuration. Note the use of the
# %U directive to insure unique file names for the image copies
ALLOCATE CHANNEL dbkp1 DEVICE TYPE DISK FORMAT 'c:\oracle\rmanbkup\U%';
# Create an image copy of all datafiles in the database
BACKUP AS COPY DATABASE;
}
Incrementally Updated Backups. As I explained in the previous section, it is now much simpler to create image copy backups of the database. Another new Oracle 10g feature, incrementally updated backups, allows me to apply incremental database changes to the corresponding image copy backup - also known as rolling forward the datafile image copy -- of any datafile in the database. Since image copy backups are much faster to restore in a media recovery situation, this new feature gives me the option to have updated image copies ready for restoration without having to recreate the image copies on a regular basis.
To utilize this feature, I will need to use the new BACKUP ... FOR RECOVER OF COPY command to create the incremental level 1 backups to roll forward the changes to the image copy of the datafiles, and use the new RMAN RECOVER COPY OF DATABASE command to apply the incremental backup to the image copies of the datafiles. Note that the TAG directive becomes extremely important to this implementation, as it is used to identify to which image copies the changes are to be rolled forward.
Here is a script that illustrates a daily cycle of creation and application of the incrementally updated backups. This would be appropriate for a database that has sufficient disk space for storage of image copies, and has a relatively high need for quick restoration of media:
RUN {
# Roll forward any available changes to image copy files
# from the previous set of incremental Level 1 backups
RECOVER
COPY OF DATABASE
WITH TAG 'img_cpy_upd';
# Create incremental level 1 backup of all datafiles in the database
# for roll-forward application against image copies
BACKUP
INCREMENTAL LEVEL 1
FOR RECOVER OF COPY WITH TAG 'img_cpy_upd'
DATABASE;
}
Though this appears a bit counter-intuitive at first, here is an explanation of what happens during the initial run of this script:
The RECOVER command actually has no effect, because it cannot find any incremental backups with a tag of img_cpy_upd.However, the BACKUP command will create a new Incremental Level 0 backup that is labeled with a tag of img_cpy_upd because no backups have been created yet with this tag.
And during the second run of this script:
The RECOVER command still will have no effect, because it cannot find any Level 1 incremental backups with a tag of img_cpy_upd.The BACKUP command will create its first Incremental Level 1 backup that is labeled with a tag of img_cpy_upd.
But during the third and subsequent runs of this script:
The RECOVER command finds the incremental level 1 image copy backups from the previous night's run tagged as img_cpy_upd, and applies them to the existing datafile image copies.The BACKUP command will create the next Incremental Level 1 backup that is labeled with a tag of img_cpy_upd.
After the third run of this script, RMAN would then choose the following files during a media recovery scenario: the image copy of the database for tag img_cpy_upd from the previous night, the most recent incremental level 1 backup, and all archived redo logs since the image copy was taken. This strategy offers a potentially quick and flexible recovery, since the datafile image copies will be relatively quick to restore, and the incremental level 1 backup plus all archived redo logs can be used to perform either a point-in-time or a complete recovery.
Improved Incremental Backup Performance With Change Tracking.
Another new Oracle 10g optional feature, change tracking, promises to improve the performance of incremental backup creation significantly. When an incremental backup was being taken prior to 10g, all the blocks in each datafile being backed up needed to be scanned to determine if the block had changed since the last incremental backup to determine if it needed to be included in the new incremental backup.
With the new change tracking feature enabled, however, now only the first Level 0 incremental backup needs to be completely scanned, and the IDs of any changed blocks are written instead to a change tracking file. All subsequent incremental backups will query the change tracking file to determine if there are any changed blocks that need to be backed up. Oracle automatically stores enough incremental backup metadata to insure that any of the eight most recent incremental backups can be used as the "parent" of a new incremental backup.
Each Oracle database has only one change tracking file, and if the database has been configured for Oracle Managed Files (OMF) it will be automatically created based on the specification for DB_CREATE_FILE_DEST. However, if OMF is not enabled for the database, the location of the change tracking file can be specified manually. The initial size of the change tracking file is 10MB, and it grows in 10MB increments, but Oracle notes that the 10MB initial extent should be sufficient to store change tracking information for any database up to one terabyte in size.
If the location needs to be moved, change tracking can be disabled, and a new change tracking file can be created, but this causes the database to lose all change tracking information. Moreover, unfortunately the change tracking file cannot be moved without shutting down the database, moving it with the appropriate ALTER DATABASE RENAME FILE <filename> command, and then restarting the database.
Oracle does recommend that this feature be activated for any database whose disaster recovery plan utilizes incremental backups of differing levels. Oracle also notes that theirs is a small performance hit during normal operations, but that hit should be discounted against the need to avoid scans of datafiles during restoration and recovery operations.
Improved Backup Resource Management.
Oracle 9i added new features to help DBAs to automatically manage backup file retention with the RETENTION POLICY directives of the CONFIGURE command set. Oracle 10g has improved RMAN resource management even further with the DURATION directive of the BACKUP command: It is now possible to tell RMAN exactly how much system resources should be allocated to accomplish a backup task so that it completes within a specified time frame.
For example, my client's primary production database is scheduled to begin at 00:15 every day, and needs to complete before batch processing commences at 03:00 every day. In my daily backup RMAN script, I can specify that the backups must complete in 2.5 hours, and RMAN will begin backing up the specified database files:
BACKUP DURATION 2:30 DATABASE;
If the backup cannot complete within this time frame, the RMAN script being executed will return an error and terminate the backup - not necessarily a desirable outcome! However, if I specify the PARTIAL directive, RMAN will not return an error, but will back up as many files as it can in that time frame, starting with the least recently used backed-up files (a feature of using DURATION):
BACKUP DURATION PARTIAL 2:30 DATABASE FILESPERSET 1;
In this case, any files that could not be backed up will be logged as errors from the RMAN script, but all other backup files will be retained. Oracle does recommend setting FILESPERSET to 1 when using DURATION PARTIAL to insure that any files for which backups succeeded are retained. I can also tune backup performance so RMAN will try to complete the backups as quickly as possible by specifying the MINIMIZE TIME directive:
BACKUP DURATION PARTIAL 2:00 MINIMIZE TIME DATABASE FILESPERSET 1;
If I specify the MINIMIZE LOAD directive, on the other hand, RMAN will instead "stretch out" backup operations so that fewer resources are utilized during that time:
BACKUP DURATION PARTIAL 3:30 MINIMIZE LOAD DATABASE FILESPERSET 1;
Server Parameter File (SPFILE) AutoBackups. Oracle 9i added the ability to configure automatic control file backups to occur whenever specific RMAN operations happened, or when the DBA performed a significant modification of the database's logical or physical structure that affected the control file (e.g. adding a new tablespace, or renaming a datafile).
Oracle 10g expands this feature to include the auto-backup of the database's server parameter file - the binary copy of the initialization parameter file -- as well. Though I have to admit that I am still a fan of the initialization parameter file - old habits do die hard, dang it! - it is obvious that Oracle views the SPFILE as the future basis for controlling database parameter configuration.
Enhanced BEGIN BACKUP.
Finally, here is a neat enhancement for user-managed backups: The BEGIN BACKUP command that is used to set tablespaces begin backup status one at a time has been enhanced so that all of the database's tablespaces can be set at once:
-- Set all datafiles begin backup before starting user-managed backup
ALTER DATABASE BEGIN BACKUP;
-- Bring all datafiles back online after completing user-managed backup
ALTER DATABASE END BACKUP;
Though our shop uses RMAN for all production database backups, this command certainly has value for smaller but no less mission-critical databases like OEM or RMAN recovery catalog repositories.
Automatic Channel Failover.
In Oracle 10g, the behavior of RMAN changes with regard to the failure of a channel during an RMAN backup. If a channel fails, the backup process on that channel fails and will not be restarted. However, backups on other remaining channels will continue to run. Once the backup process is complete, RMAN will report errors that occurred during the backup process. This feature ensures that as many datafiles get backed up as possible, in spite of the error condition.
This feature also enable while RMAN backups directly on tape via a Media Management Layer (MML).
Restoration and Recovery Enhancements
RESTORE Failover. Oracle 10g has also significantly improved the restoration process during initial restoration and recovery efforts:
- If RMAN should detect a damaged or missing backup file, it will automatically attempt to locate another usable copy of the image copy or backup piece, either at the default location or at an alternate multiplexed location.
- If it cannot find a usable current copy, it then looks at prior backup pieces or image copies and attempts to restore from those files.
- If RMAN cannot locate any appropriate backup or image copy, only then will it issue an error and terminate the RMAN session.
RESTORE ... PREVIEW.
If you have ever wondered exactly what backup files or image copies RMAN will use to perform restoration, Oracle 10g now offers the RESTORE ... PREVIEW command set to show exactly what backup pieces or image copies RMAN plans to utilize.
For example, if I wanted to explore exactly what RMAN will choose if I want to restore the database's SYSTEM tablespace, from within an RMAN session, I can issue the
RESTORE DATAFILE 1 PREVIEW;
command and RMAN will return the following output:
Automatic Creation of Missing Datafiles.
Consider this scenario: Your junior DBA has just added a new tablespace to the production database, but she neglected to take a full backup of the database immediately after adding the tablespace. Then, as luck would have it, a media failure occurs on the same disk where the new tablespace's datafile resides.
Here's the good news: With Oracle 9i, it's definitely possible to recreate the datafile for the new tablespace - as long as all the archived redo logs and online redo logs that were generated since the creation of the new tablespace are available, that is. Once the datafile has been taken offline, the ALTER DATABASE CREATE DATAFILE <datafile name>; command is issued to recreate the datafile. Then the RECOVER DATAFILE <datafile name>; command is issued to recover the datafile, and the datafile's tablespace can be brought back online.
In 10g, RMAN now allows you to perform recovery of a datafile without it having been backed up. If the datafile is not available in a backup set, RMAN uses the control file to create an empty copy of that datafile. RMAN can then use archived redo logs to recover the datafile. This implies that all archived redo must be available since the datafile was created to successfully complete the recovery. RMAN performs this type of recovery automatically if required.
Note: The restore database and restore tablespace commands do not support this functionality. You can only restore missing datafiles with the restore datafile command.
Compressing RMAN Backups
Prior to Oracle 10g, RMAN reduced the size of backup images by not backing up blocks that had never been used. This was only useful if you had a database that was oversized. It was of little use for larger databases or databases that had little free space available in the tablespaces.
Oracle 10g offers compression of RMAN backup sets through the use of the compressed parameter when issuing the backup command. Here is an example:
RMAN> Backup as compressed backupset database;
Note that only backup sets can be compressed (e.g., database, tablespace, and datafile backups). Specifically, image copies cannot be compressed. Compression is disabled by default. You can use the configure command to define the default disk device to use compression, as shown in this example:
RMAN> configure device type disk backup type to compressed backupset;
Testing has shown about an 80 percent compression ratio when comparing a regular backup set to a compressed backup set of an empty database.
Other Enhancements
Improved Access To RMAN Metadata. Oracle 10g provides some new dynamic views that offer a DBA the ability to see what's really happening during and after a set of RMAN tasks have been completed, thus saving the effort of having to constantly monitor a command window or log file to determine their status.
V$RMAN_OUTPUT will show the status of an ongoing RMAN job.
SELECT output FROM v$rman_output;
-- What are results from prior RMAN commands and sessions?
TTITLE 'Results of most recent Recovery Manager sessions'
COL command_id FORMAT A20 HEADING 'TimeStamp'
COL row_type FORMAT A8 HEADING 'Command/|Session'
COL operation FORMAT A8 HEADING 'Action'
COL status FORMAT A24 HEADING 'Status'
In addition, V$RMAN_STATUS lists the historical status of all RMAN jobs.
SELECT command_id ,row_type ,operation ,status
FROM v$rman_status
ORDER BY command_id DESC
Conclusion
Oracle 10g's new Recovery Manager features greatly expand the flexibility and reliability of any Oracle DBA's tool kit for disaster recovery planning, backup strategies and failure recovery scenarios. And I've just scratched the surface! As promised, the next article in this series will focus on one of the most intriguing new availability features: Flash Backup and Recovery.
参考至:http://www.databasejournal.com/features/oracle/article.php/10893_3439441_2/Oracle-10g-Availability-Enhancements-Part-1-Backup-and-Recovery-Improvements.htm
http://www.toadworld.com/platforms/oracle/w/wiki/1098.rman-additional-10g-enhancements.aspx
本文原创,转载请注明出处、作者
如有错误,欢迎指正
邮箱:czmcj@163.com
相关推荐
Oracle-使用RMAN-将-DB-从10g-直接-Restore-到11g-示例
本指南将为初学者详细解析如何在Oracle 10g中使用RMAN进行备份,确保数据库的安全运行。 一、RMAN简介 RMAN是Oracle数据库的内置组件,可以直接与数据库实例和控制文件通信。它提供了命令行接口和图形用户界面,...
oracle rman深入学习研究的文章,很不错的
Oracle 10g的RMAN(Recovery Manager)是Oracle数据库管理系统中用于数据备份和恢复的强大工具。在本文中,我们将深入探讨RMAN的工作原理、关键特性以及如何使用它进行有效的备份与恢复操作。 首先,RMAN是Oracle...
利用rman还原的方法进行9i到10g的异机迁移方法,其中有数据文件路径调整在里面
本话题主要探讨如何在Oracle 10g环境中使用RMAN对Oracle 9i的完整备份进行恢复操作。 在Oracle 9i中执行RMAN全备时,通常会包括数据库的所有数据文件、控制文件、重做日志文件以及相关的参数文件。RMAN全备份的基本...
### Oracle 10g RMAN备份与恢复 在Oracle数据库管理中,RMAN(Recovery Manager)是一个重要的工具,用于数据库备份、恢复以及灾难恢复。本文将基于提供的标题、描述和部分上下文内容来深入探讨Oracle 10g环境下...
Getting Started with RMAN in Oracle Database 11g 1 Oracle Database 11g Backup and Recovery Architecture Tour . . . . . . . . . . . . . . 3 2 Introduction to the RMAN Architecture . . . . . . . . . . ....
### Oracle 11g RMAN 异机还原再升级到 12c PDB #### 背景介绍 在企业级应用环境中,数据库的迁移与升级是一项常见但又复杂的工作。本文档详细记录了从Oracle 11.2.0.4版本数据库通过RMAN工具进行异地备份恢复,并...
10. **数据泵导出导入**:RMAN可以与Oracle Data Pump协同工作,用于数据库的迁移和克隆,以及进行数据的导入和导出。 理解并熟练掌握RMAN是每个Oracle DBA必备的技能。通过阅读《Oracle Database 11g RMAN备份与...
Oracle 11g R2 的 RMAN (Recovery Manager) 是 Oracle 数据库管理系统中的一个关键工具,主要用于数据库的备份和恢复。RMAN 提供了一种高效且灵活的方式来管理和保护数据库,确保在数据丢失或系统故障时能够快速恢复...
- Oracle服务器有2个节点,oracle的asm(自动存储管理)存储空间为5.5T,剩余1.9T,每天占用约10G左右空间。 - **建议:**不要将备份存储放在asm中,以免asm出现故障导致数据丢失。建议申请额外的磁盘空间并挂载到...
《RMAN食谱:Oracle数据库11g》一书提供了针对Oracle 11g数据库的RMAN(Recovery Manager)的全面指南,采用问题解决法,为忙碌的数据库管理员(DBA)提供实用的备份与恢复策略。RMAN是Oracle数据库系统中的一个强大...
在Oracle 10G版本中,RMAN提供了多种功能,包括表空间级别的恢复,这在数据丢失或系统故障时尤为重要。下面将详细介绍如何在Oracle 10G中使用RMAN进行表空间恢复。 首先,了解RMAN的基本结构。RMAN是通过PL/SQL接口...
Oracle RMAN 11g Backup And Recovery (中文名:Oracle RMAN 11g 备份和恢复) 英文原版图书,Oracle官方出版,学习Oracle Rman备份和恢复的最佳学习资料,与大家一起分享。
以上步骤是Oracle 10g RAC数据库通过RMAN恢复到异地单机的基本流程。在实际操作中,还应根据具体环境和需求调整某些步骤,如处理redo log、控制文件、Undo表空间等。在整个过程中,确保数据的安全性,遵循最佳实践,...
《Oracle Database 11g RMAN备份与恢复》PDF版本下载