文档课题:scn在无法查询具体时间的前提下,测试dg的增量备份.
场景描述:生产环境中存在一备库长时间未实时应用,导致查出的最小scn在系统中已无法查询具体信息,此次测试该scn是否能作为增量备份的依据.
数据库:oracle 11.2.0.4
1、异常现象
SYS@sh_orcl> select to_char(scn_to_timestamp(9642),'yyyy-mm-dd hh24:mi:ss') from dual;
select to_char(scn_to_timestamp(9642),'yyyy-mm-dd hh24:mi:ss') from dual
*
ERROR at line 1:
ORA-08181: specified number is not a valid system change number
ORA-06512: at "SYS.SCN_TO_TIMESTAMP", line 1
2、备份测试
[oracle@hisdbdg ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Tue Apr 11 09:59:26 2023
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1660526279)
RMAN> backup incremental from SCN 9642 database format '/tmp/ForStandby_%U' tag 'FORSTANDBY';
Starting backup at 11-APR-23
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=135 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/system.259.1132745549
input datafile file number=00003 name=/u01/app/oracle/oradata/undotbs1.261.1132745553
input datafile file number=00002 name=/u01/app/oracle/oradata/sysaux.260.1132745551
input datafile file number=00004 name=/u01/app/oracle/oradata/undotbs2.263.1132745567
input datafile file number=00006 name=/u01/app/oracle/oradata/users.285.1133862437
input datafile file number=00007 name=/u01/app/oracle/oradata/users.284.1133862457
input datafile file number=00008 name=/u01/app/oracle/oradata/users.283.1133862473
input datafile file number=00009 name=/u01/app/oracle/oradata/users.282.1133862489
input datafile file number=00010 name=/u01/app/oracle/oradata/users.281.1133862509
input datafile file number=00011 name=/u01/app/oracle/oradata/users.280.1133862525
input datafile file number=00012 name=/u01/app/oracle/oradata/users.279.1133862553
input datafile file number=00013 name=/u01/app/oracle/oradata/users.278.1133862571
input datafile file number=00014 name=/u01/app/oracle/oradata/users.277.1133862585
input datafile file number=00015 name=/u01/app/oracle/oradata/users.276.1133862603
input datafile file number=00016 name=/u01/app/oracle/oradata/users.275.1133862625
input datafile file number=00017 name=/u01/app/oracle/oradata/users.274.1133862645
input datafile file number=00005 name=/u01/app/oracle/oradata/users.264.1132745567
channel ORA_DISK_1: starting piece 1 at 11-APR-23
channel ORA_DISK_1: finished piece 1 at 11-APR-23
piece handle=/tmp/ForStandby_0c1pao81_1_1 tag=FORSTANDBY comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 11-APR-23
channel ORA_DISK_1: finished piece 1 at 11-APR-23
piece handle=/tmp/ForStandby_0d1pao8g_1_1 tag=FORSTANDBY comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 11-APR-23
RMAN> backup as compressed backupset incremental from SCN 9642 datafile 5 format '/tmp/ForStandby_%U' tag 'FORSTANDBY';
Starting backup at 11-APR-23
using channel ORA_DISK_1
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 11-APR-23
channel ORA_DISK_1: finished piece 1 at 11-APR-23
piece handle=/tmp/ForStandby_0e1paocg_1_1 tag=FORSTANDBY comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00005 name=/u01/app/oracle/oradata/users.264.1132745567
channel ORA_DISK_1: starting piece 1 at 11-APR-23
channel ORA_DISK_1: finished piece 1 at 11-APR-23
piece handle=/tmp/ForStandby_0f1paoci_1_1 tag=FORSTANDBY comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 11-APR-23
3、测试结论
如上所示,即使无法查询scn对应的具体信息,增量备份依然不受影响.