Exista situații când baza de date de standby nu este sincronizata cu baza primara iar intervalul lipsa conține suficient de multe arhive pentru ca efortul de sincronizare sa nu se justifice ori una sau mai multe arhive nu mai sunt accesibile. In acest scenariu solutia cea mai eficienta este folosirea unui backup incremental pe care îl vom crea exact pentru intervalul de care avem nevoie.

Pentru a exemplifica avem următoarea situație:

DGMGRL> show database orcl_dg

Database - orcl_dg

Role:               PHYSICAL STANDBY
Intended State:     APPLY-ON
Transport Lag:      1 hour(s) 13 minutes 44 seconds (computed 0 seconds ago)
Apply Lag:          1 hour(s) 14 minutes 15 seconds (computed 0 seconds ago)
Average Apply Rate: 67.00 KByte/s
Real Time Query:    OFF
Instance(s):
orcl_dg

Database Status:
SUCCESS

Iar în alertlog următorul mesaj:

FAL[client]: Failed to request gap sequence
GAP - thread 1 sequence 66-95
DBID 1451188081 branch 923407347
FAL[client]: All defined FAL servers have been attempted.
------------------------------------------------------------
Check that the CONTROL_FILE_RECORD_KEEP_TIME initialization
parameter is defined to a value that's sufficiently large
enough to maintain adequate log switch information to resolve
archivelog gaps.
------------------------------------------------------------

Acum ce putem face pentru soluționarea problemei:

  • pe standby verificam SCN-ul bazei:
SQL> select current_scn from v$database;

CURRENT_SCN
-----------
1718586
  • pe primary pornim un backup folosind SCN-ul de mai sus
RMAN> BACKUP INCREMENTAL FROM SCN 1718586 DATABASE FORMAT '/opt/oracle/fast_recovery_area/tmp/incremental_%U';

Starting backup at 11-NOV-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=137 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=00006 name=/opt/oracle/oradata/ORCL/datafile/o1_mf_users_cyfhwnym_.dbf
input datafile file number=00001 name=/opt/oracle/oradata/ORCL/datafile/o1_mf_system_cyfhvkh5_.dbf
input datafile file number=00003 name=/opt/oracle/oradata/ORCL/datafile/o1_mf_sysaux_cyfhtg80_.dbf
input datafile file number=00004 name=/opt/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_cyfhwpcy_.dbf
channel ORA_DISK_1: starting piece 1 at 11-NOV-16
channel ORA_DISK_1: finished piece 1 at 11-NOV-16
piece handle=/opt/oracle/fast_recovery_area/tmp/incremental_0crkkl9n_1_1 tag=TAG20161111T074559 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
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-NOV-16
channel ORA_DISK_1: finished piece 1 at 11-NOV-16
piece handle=/opt/oracle/fast_recovery_area/tmp/incremental_0drkkl9q_1_1 tag=TAG20161111T074559 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 11-NOV-16
  • tot pe primary salvam controlfile-ul:
SQL> alter database create standby controlfile as '/opt/oracle/fast_recovery_area/tmp/control_stdby.ctl';

Database altered.
  • ne mutam pe standby unde catalogam backup-urile
RMAN> catalog start with '/opt/oracle/fast_recovery_area/tmp/';

Starting implicit crosscheck backup at 11-NOV-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=251 device type=DISK
Finished implicit crosscheck backup at 11-NOV-16

Starting implicit crosscheck copy at 11-NOV-16
using channel ORA_DISK_1
Finished implicit crosscheck copy at 11-NOV-16

searching for all files in the recovery area
cataloging files...
no files cataloged

searching for all files that match the pattern /opt/oracle/fast_recovery_area/tmp/

List of Files Unknown to the Database
=====================================
File Name: /opt/oracle/fast_recovery_area/tmp/incremental_0crkkl9n_1_1
File Name: /opt/oracle/fast_recovery_area/tmp/incremental_0drkkl9q_1_1
File Name: /opt/oracle/fast_recovery_area/tmp/control_stdby.ctl

Do you really want to catalog the above files (enter YES or NO)? y
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /opt/oracle/fast_recovery_area/tmp/incremental_0crkkl9n_1_1
File Name: /opt/oracle/fast_recovery_area/tmp/incremental_0drkkl9q_1_1
File Name: /opt/oracle/fast_recovery_area/tmp/control_stdby.ctl
  • oprim aplicarea si transportul arhivelor
DGMGRL> edit database orcl_dg SET STATE='APPLY-OFF';
Succeeded.
DGMGRL> edit database orcl SET STATE='TRANSPORT-OFF';
Succeeded.

daca nu folositi broker atunci:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
  • aplicarea backup-ului incremental pe standby
RMAN> shutdown immediate;

database dismounted
Oracle instance shut down

RMAN> startup mount

connected to target database (not started)
Oracle instance started
database mounted

Total System Global Area     838860800 bytes

Fixed Size                     2929936 bytes
Variable Size                641731312 bytes
Database Buffers             188743680 bytes
Redo Buffers                   5455872 bytes

RMAN> recover database noredo;

Starting recover at 11-NOV-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=127 device type=DISK
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: /opt/oracle/oradata/orcl_dg/datafile/o1_mf_system_cyfhvkh5_.dbf
destination for restore of datafile 00003: /opt/oracle/oradata/orcl_dg/datafile/o1_mf_sysaux_cyfhtg80_.dbf
destination for restore of datafile 00004: /opt/oracle/oradata/orcl_dg/datafile/o1_mf_undotbs1_cyfhwpcy_.dbf
destination for restore of datafile 00006: /opt/oracle/oradata/orcl_dg/datafile/o1_mf_users_cyfhwnym_.dbf
channel ORA_DISK_1: reading from backup piece /opt/oracle/fast_recovery_area/tmp/incremental_0crkkl9n_1_1
channel ORA_DISK_1: piece handle=/opt/oracle/fast_recovery_area/tmp/incremental_0crkkl9n_1_1 tag=TAG20161111T074559
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

Finished recover at 11-NOV-16
  • restore controlfile
RMAN> startup force nomount

Oracle instance started

Total System Global Area     838860800 bytes

Fixed Size                     2929936 bytes
Variable Size                641731312 bytes
Database Buffers             188743680 bytes
Redo Buffers                   5455872 bytes

RMAN> restore standby controlfile from '/opt/oracle/fast_recovery_area/tmp/control_stdby.ctl';

Starting restore at 11-NOV-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=6 device type=DISK

channel ORA_DISK_1: copied control file copy
output file name=/opt/oracle/oradata/orcl_dg/control_01.ctl
output file name=/opt/oracle/fast_recovery_area/orcl_dg/control02_.ctl
Finished restore at 11-NOV-16
  • sa verificam daca mai exist diferente intre standby si primary:
DGMGRL> show database orcl_dg;

Database - orcl_dg

Role:               PHYSICAL STANDBY
Intended State:     APPLY-ON
Transport Lag:      0 seconds (computed 1 second ago)
Apply Lag:          0 seconds (computed 1 second ago)
Average Apply Rate: 16.00 KByte/s
Real Time Query:    OFF
Instance(s):
orcl_dg

Database Status:
SUCCESS

iar in alertlog, ultimul mesaj:

Media Recovery Waiting for thread 1 sequence 105 (in transit)
Fri Nov 11 08:06:37 2016
Recovery of Online Redo Log: Thread 1 Group 4 Seq 105 Reading mem 0
Mem# 0: /opt/oracle/oradata/orcl_dg/stdr_4.log¿¿

 

Lasă un răspuns

Completează mai jos detaliile despre tine sau dă clic pe un icon pentru autentificare:

Logo WordPress.com

Comentezi folosind contul tău WordPress.com. Dezautentificare / Schimbă )

Poză Twitter

Comentezi folosind contul tău Twitter. Dezautentificare / Schimbă )

Fotografie Facebook

Comentezi folosind contul tău Facebook. Dezautentificare / Schimbă )

Fotografie Google+

Comentezi folosind contul tău Google+. Dezautentificare / Schimbă )

Conectare la %s