Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1030987
  • 博文数量: 159
  • 博客积分: 3063
  • 博客等级: 中校
  • 技术积分: 2703
  • 用 户 组: 普通用户
  • 注册时间: 2012-04-01 01:51
文章分类

全部博文(159)

文章存档

2013年(48)

2012年(111)

分类: Oracle

2013-08-10 14:27:15

Applies to: 
Oracle Server - Enterprise Edition - Version: 10.2.0.1 to 11.1.0.8 
This problem can occur on any platform. 
Symptoms 
RMAN的增量备份可以用来使物理standby数据库于primary数据库保持同步。在primary数据库上从物理standby数据库当前的SCN 号开始使用“RMAN BACKUP INCREMENTAL FROM SCN”命令可以创建一个备份,该备份可以用来前滚物理standby数据库。

然而在一些使用RECOVER DATABASE NOREDO的情况下,命令是不会应用到standby数据库的增量变化,该命令将会在很短的时间内完成。 
RMAN> RECOVER DATABASE NOREDO; 
Starting recover at 11-JUN-09 
using target database control file instead of recovery catalog 
allocated channel: ORA_DISK_1 
channel ORA_DISK_1: sid=152 devtype=DISK 
Finished recover at 11-JUN-09

Cause 
在理想的情况下,数据库的SCN(CURRENT_SCN)和数据文件的SCN 不应该存在很大的差异,大多数的数据文件的SCN应该在一定的范围内,在下面的例子中的那些数据文件拥有不同的SCN使得基于CURRENT_SCN上的增量备份不能进行。

在STANDBY中运行下面的查询: 
SQL> select distinct checkpoint_change# from v$datafile_header order by 1; 
CHECKPOINT_CHANGE# 
------------------ 
10966360849 
10966365192 
10966456071 
10966459094 
10966459249 
10966478310 
10966500361 
10966501649 
10966502244 
10966963118 
10967040320 
10967041014 
10967041052 
10967041082 
10967041102 
10967044662 
10969481568 
10969482498 
10969483695 
出现上面情况的原因可能是因为某些数据文件被离线了太长的时间,存在read-only文件,或者一些在primary数据库中的数据文件发生的改变 根据时间的先后一个一个的被COPY到standby数据库中  造成数据文件的SCN号的不同。 
Solution 
1) 在STANDBY数据库中执行下面的查询来确定最低的SCN 
 SQL> select min (checkpoint_change#) from v$datafile_header order by 1; 
2) 在primary中执行基于第一步查询出来的SCN进行增量备份 
RMAN> BACKUP INCREMENTAL FROM SCN  xxx
DATABASE FORMAT '/tmp/ForStandby_%U' tag 'FORSTANDBY' 
3) 将增量备份转移到standby中,在STANDBY中catalog备份片 
4) 现在尝试在STANDBY中应用增量变化,那些增量变化将会被应用到standby数据库中 
RMAN> RECOVER DATABASE NOREDO;  
========== 

Using RMAN Incremental Backups to Refresh a Standby Database

You can create an incremental backup of the target database containing changes to the database since the creation of the duplicate or the previous syncrhonization. You can apply the incremental backup to the standby database.

Note:

This technique cannot be used to update a duplicate database.

RMAN enables you to synchronize a standby database with a primary database by creating an incremental backup at the source database that contains all changed blocks since the duplicate was created or last refreshed. You then apply the incremental backup to the standby database, which updates it with all changes.

This capability faciliates the temporary conversion of a physcial standby database into a reporting database, as described in .. In particular, this capability makes it possible to reverse the effects of converting the standby into a reporting database. After the standby database has been used for reporting or testing, Flashback Database can reverse any changes resulting from that work, returning the database to its contents when it was still a standby. An incremental backup created with BACKUP INCREMENTAL... FROM SCN can be used to refresh the standby with changes at the primary since the conversion. and then managed recovery can resume. The effect is to return the reporting database to its role as standby.

For more details on this scenario, see .

Using BACKUP INCREMENTAL... FROM SCN

The incremental backup is created at the source database by means of the BACKUP INCREMENTAL FROM SCN=n form of the BACKUP command. For example:

BACKUP DEVICE TYPE SBT INCREMENTAL FROM SCN 750923 DATABASE;
BACKUP INCREMENTAL FROM SCN 750923 DATABASE;
BACKUP DEVICE TYPE DISK INCREMENTAL FROM SCN 750983 DATABASE
     FORMAT '/tmp/incr_standby_%U';

RMAN uses the selected SCN as the basis for this incremental backup. For all files being backed up, RMAN includes all data blocks that were changed at SCNs greater than or equal to the FROM SCN in the incremental backup.

Note:

  • RMAN does not consider the incremental backup as part of a backup strategy at the source database. The backup is not suitable for use in a normal RECOVER DATABASE operation at the source database.
  • The backup sets produced by this command are written to ?/dbs by default, even if the flash recovery area or some other backup destination is defined as the default for disk backups.

  • You must create this incremental backup on disk for it to be useful. When you move the incremental backup to the standby, you must catalog it at the standby as described in . Backups on tape cannot be cataloged.

See Also:

 for more details on BACKUP command syntax


Refreshing a Standby Database With INCREMENTAL FROM SCN Backups: Example

This example shows the steps required to update a standby database using incremental backups. The assumption is that you have already activated the standby, performed your tests or other operations at the standby, , and then used Flashback Database to undo the effects of those changes. The task here is to refresh the standby with the latest changes to the primary , so that it can resume its role as a standby database.

Step 1: Create the Incremental Backup

Create the needed incremental backup at the source database, using BACKUP with the INCREMENTAL FROM SCN clause.

Assume that the incremental backup to be used in updating the duplicate database is to be created on disk, with the filenames for backup pieces determined by the format /tmp/incr_for_standby/bkup_%U.

RMAN> BACKUP DEVICE TYPE DISK INCREMENTAL FROM SCN 750983 DATABASE
     FORMAT '/tmp/incr_for_standby/bkup_%U';

Step 2: Make the Incremental Backup Accessible at the Standby Database

Make the backup pieces containing the incremental backup available in some directory accessible on the system containing the standby database. For this example, assume that the destination directory is called /standbydisk1/incrback/ and ensure that it contains nothing besides the incremental backups from Step 1.

Step 3: Catalog the Incremental Backup Files at the Standby Database

Use the RMAN CATALOG command to register the backup sets in the RMAN repository at the duplicate. With an RMAN client connected to the standby database and the recovery catalog (if you use one at the standby), mount the standby and run the following command:

RMAN> CATALOG START WITH '/standbydisk1/incrback/';

The backups are now available for use in recovery of the standby.

Step 4: Apply the Incremental Backup to the Standby Database

Use the RMAN RECOVER command with the NOREDO option to apply the incremental backup to the standby database. All changed blocks captured in the incremental backup are updated at the standby database, bringing it up to date with the primary database. With an RMAN client connected to the standby database, run the following command:

RMAN> RECOVER DATABASE NOREDO;

You can now resume managed recovery at the standby. Any redo logs required at the standby with changes since those contained in the incremental are automatically requested from the primary and applied

 

阅读(4867) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~