از اوراکل 10g می توان با استفاده از incremental backup، گپ ایجاد شده بین بانک اصلی و دیتاگارد را برطرف کرد منتهی ابتدا می بایست این بکاپ به صورت دستی از بانک اصلی گرفته شده و سپس از بانک اصلی به کمک سیستم عامل به سرور گارد منتقل و در نهایت ریکاوری شود.
در اوراکل 12c، نقش سیستم عاملی dba حذف شده و با حداقل درگیری dba و تنها با استفاده از چند دستور ساده، گپ ایجاد شده بین بانک اصلی و دیتاگارد برطرف خواهد شد:
–in primary:
SQL> select max(sequence#),thread# from v$archived_log group by thread#;
MAX(SEQUENCE#) THREAD#
————– ———-
98 1
–in stb:
SQL> select max(sequence#),thread#,applied from gv$archived_log group by thread#,applied order by thread#;
MAX(SEQUENCE#) THREAD# APPLIED
————– ———- ———
98 1 YES
SQL> shutdown abort
–in primary:
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> select max(sequence#),thread# from v$archived_log group by thread#;
MAX(SEQUENCE#) THREAD#
————– ———-
101 1
!rm -rf /u01/arch/1_10*
SQL> startup mount force;
ORACLE instance started.
Total System Global Area 3154116608 bytes
Fixed Size 3715784 bytes
Variable Size 956304696 bytes
Database Buffers 2181038080 bytes
Redo Buffers 13058048 bytes
Database mounted.
–in stb:
SQL> startup force;
SQL> alter database recover managed standby database;
ORA-00308: cannot open archived log ‘/u01/arch/1_100_916411681.dbf’
ORA-00308: cannot open archived log ‘/u01/arch/1_101_916411681.dbf’
SQL> startup force mount
rman target sys/sys@stb
RMAN> RECOVER DATABASE FROM SERVICE primdb NOREDO ;
Starting recover at 05-JUL-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=93 device type=DISK
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: using network backup set from service primdb
destination for restore of datafile 00001: /u02/oradata/usef2/datafile/system.257.916411579
channel ORA_DISK_1: restore complete, elapsed time: 00:01:06
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: using network backup set from service primdb
destination for restore of datafile 00003: /u02/oradata/usef2/datafile/sysaux.256.916411533
channel ORA_DISK_1: restore complete, elapsed time: 00:01:05
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: using network backup set from service primdb
destination for restore of datafile 00004: /u02/oradata/usef2/datafile/undotbs1.259.916411625
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: using network backup set from service primdb
destination for restore of datafile 00006: /u02/oradata/usef2/datafile/users.258.916411623
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
Finished recover at 05-JUL-16
STARTUP NOMOUNT force;
RMAN> RESTORE STANDBY CONTROLFILE FROM SERVICE primdb;
Starting restore at 05-JUL-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=362 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: using network backup set from service primdb
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
output file name=/u02/oradata/control01.ctl
Finished restore at 05-JUL-16
SQL> startup force;
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
SQL> select max(sequence#),thread#,applied from gv$archived_log group by thread#,applied order by thread#;
MAX(SEQUENCE#) THREAD# APPLIED
————– ———- ———
108 1 YES