Wednesday, 14 October 2015

INCREMENTAL IMAGE COPY BACKUP



Every now and again it is necessary to speed up the recovery phase of a Oracle Database and what’s more to reduce the time of a backup, for example when  it can’t be completed during the night because it’s too big.


To achieve the first request you can execute a RMAN image copy backup and an incrementally updated image copy backup to achieve the second request too.


Let’s see how, shall we ?


  • Execute the RMAN command and connect it to the database as sysdba :

RMAN > connect target /



  • Execute the following command :

RMAN > RUN {

BACKUP device type disk INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG 'test_incr_backup' DATABASE;

RECOVER COPY OF DATABASE WITH TAG 'test_incr_backup';

}



If the level 0 image copy doesn’t exist,RMAN creates it, following you’ll find a short log file:


Starting backup at 08-OCT-15

using channel ORA_DISK_1

no parent backup or copy of datafile 2 found

no parent backup or copy of datafile 100 found

no parent backup or copy of datafile 98 found

input datafile fno=00002 name=/u01/undotbs01.dbf

ecc



Since the first image copy doesn’t exist, RMAN can’t produce a level 1 backup set and what’s more the RECOVER phase doesn’t start too.


NB : The RECOVER phase can only get started  if a level 1 incremental image copy backup is found.



NB : The backup of the first IMAGE COPY can take a very long time especially if your 
       database is really huge, so be careful !!



  •  Execute again the previous command :

RMAN > RUN {

BACKUP device type disk INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG 'test_incr_backup' DATABASE;

 RECOVER COPY OF DATABASE WITH TAG 'test_incr_backup';

}



Since we’ve already got a level 0 image copy, the second execution of the backup command is going to produce our first level 1 incremental image copy.


Following you’ll find a short log file :


Starting backup 08-OCT-15

using channel ORA_DISK_1

channel ORA_DISK_1: starting incremental level 1 datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00100 name=data.dbf

channel ORA_DISK_1: starting piece 1 at 08-OCT-15 channel ORA_DISK_1: finished piece..




Since our first level 1 incremental image copy is now ready, the RECOVER command can now apply that on the first level 0 image copy and forward it up to now.


Following you’ll find a short log file :


Starting recover at 09-OCT-15

using channel ORA_DISK_1

channel ORA_DISK_1: starting incremental datafile backupset restore

channel ORA_DISK_1: specifying datafile copies to recover

recovering datafile copy fno=00002 name=/undotbs1_.dbf



Be careful : Performance issues  come up if the block change tracking isn’t available during the incremental image backup.  So it’s necessary to enable it, executing the following command :


If OMF is enabled :

ALTER DATABASE ENABLE BLOCK CHANGE TRACKING;


Otherwise :

ALTER DATABASE ENABLE BLOCK CHANGE TRACKING USING FILE ‘/PATH/FILE.TRACK.F’;



Those commands end up enabling the block change tracking and what’s more tracking changed block.



You’ll try, won’t you ?


Remember to try it out on a test environment and good luck ! 


Byeeeeeeeee

No comments:

Post a Comment