竟然遇上了ORACLE的BUG

竟然遇上了ORACLE的BUG
2011-01-19

介绍:在创建物理standby的过程中,不想遇上了BUG.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
BUG表现

RMAN> list backupset 173;


List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
173     Full    6.92M      DISK        00:00:01     2011-01-19 19:31:20
        BP Key: 173   Status: AVAILABLE  Compressed: NO  Tag: TAG20110119T193119
        Piece Name: /u02/flash_recovery_area/ORCL/backupset/2011_01_19/o1_mf_ncnnf_TAG20110119T193119_6mflw89s_.bkp
  Standby Control File Included: Ckp SCN: 4813785      Ckp time: 2011-01-19 19:31:19

RMAN> @dup_standby.rman

RMAN> run
2> {
3>   set newname for datafile 1 to '/u03/oradata/orcl02/system01.dbf';
4>   set newname for datafile 2 to '/u03/oradata/orcl02/undotbs01.dbf';
5>   set newname for datafile 3 to '/u03/oradata/orcl02/sysaux01.dbf';
6>   set newname for datafile 4 to '/u03/oradata/orcl02/users01.dbf';
7>   set newname for datafile 5 to '/u03/oradata/orcl02/example01.dbf';
8>   set newname for datafile 6 to '/u03/oradata/orcl02/test_tbsp.dbf';
9>   set newname for datafile 7 to '/u03/oradata/orcl02/test.dbf';
10>   set newname for datafile 8 to '/u03/oradata/orcl02/test02.dbf';
11>
12>   duplicate target database for standby dorecover;
13> }
executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting Duplicate Db at 2011-01-19 19:32:51
using channel ORA_AUX_DISK_1

contents of Memory Script.:
{
   set until scn  4788916;
   restore clone standby controlfile;
   sql clone 'alter database mount standby database';
}
executing Memory Script

executing command: SET until clause

Starting restore at 2011-01-19 19:32:51
using channel ORA_AUX_DISK_1

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 01/19/2011 19:32:51
RMAN-03015: error occurred in stored script. Memory Script
RMAN-06026: some targets not found - aborting restore
RMAN-06024: no backup or copy of the control file found to restore
 
RMAN> **end-of-file**

RMAN>

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
原因分析

《Oracle Data Guard 11g Handbook》中这样解释:The problem is that RMAN sets the SCN to restore to, it sets it
too low and the backup save set with you standby control file in it cannot be used.

即RMAN设置的恢复SCN太低,于是包含standby控制文件的备份集就无法使用。

我们这个例子中,RMAN设置的恢复SCN=4788916,而standby控制文件中的SCN=4813785(backupset 173),确实RMAN的低。

顺便看一下当前系统logfile的SCN:
19:37:45 SQL> select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARCHIV STATUS                           FIRST_CHANGE# FIRST_TIME
---------- ---------- ---------- ---------- ---------- ------ -------------------------------- ------------- -------------------
         1          1         21   52428800          2 NO     CURRENT                                4788916 2011-01-18 22:20:25
         2          1         19   52428800          2 YES    INACTIVE                               4738420 2011-01-17 14:48:04
         3          1         20   52428800          2 YES    INACTIVE                               4784288 2011-01-18 22:00:25

20:05:43 SQL>

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
解决方法

解决方法很简单,只要做一次switch logfile,让RMAN的恢复SCN比standby控制文件中的SCN大,之后重新运行duplicate.

20:08:04 SQL> alter system switch logfile;

系统已更改。

20:08:11 SQL> select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARCHIV STATUS                           FIRST_CHANGE# FIRST_TIME
---------- ---------- ---------- ---------- ---------- ------ -------------------------------- ------------- -------------------
         1          1         21   52428800          2 NO     ACTIVE                                 4788916 2011-01-18 22:20:25
         2          1         22   52428800          2 NO     CURRENT                                4815502 2011-01-19 20:08:11
         3          1         20   52428800          2 YES    INACTIVE                               4784288 2011-01-18 22:00:25

20:08:13 SQL>

+++++++++++++++++++++++++++++++++++++++++++++++++
BUG修复情况

该BUG在10.2.0.4的版本中修复。

我的版本是:
20:08:13 SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE    10.2.0.1.0      Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production

20:10:33 SQL>

请使用浏览器的分享功能分享到微信等