Wednesday, 8 July 2015

Short Oracle RMAN Incremental Backup procedure to Sync Standby Database Quickly.

Oracle RMAN Incremental Backup to Sync Standby Database.

Step 1: ON FSPRDDR (STANDBY DATABASE)

        ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

Step 2: ON FSPRDDR CAPTURE THE SCN Number.
       
        select min(f.fhscn) from x$kcvfh f, v$datafile d
        where f.hxfil =d.file#
        and d.enabled != 'READ ONLY'    


Step 3: ON FSPRD (Primary Database) From the SCN Number obtained from Step 2
       
        Note: Remove the old backups from the /backups/rman/standby/ folder before executing the rman incremental backup command.
       
        BACKUP INCREMENTAL FROM SCN <SCN NUMBER from STEP 2> DATABASE FORMAT '/backups/rman/standby/Standby_Inc_%U' tag 'STANDBY_INC';
               
        cd /backups/rman/standby/
        du -sh
           
       
Step 4:  ON FSPRDDR pull the backups from FSPRD Server.

         Login to oracle on FSPRDDR Server. (STANDBY DATABASE)
       
         Remove the old backups from the /backups/rman/standby/ on DR Standby Server
       
         nohup sshpass -p '<password>'  scp oracle@primaryserver:/backups/rman/standby/* .  > /tmp/nohup_standy_copy 1>&2 &

   
       
Step 5: ON FSPRDDR (STANDBY DATABASE)

        rman target /
       
        CATALOG START WITH '/backups/rman/standby';   

        DR-DB[oracle@pldsjdbdr1 standby] 2015-07-01 21:12:47$ rman target /
        Recovery Manager: Release 11.2.0.4.0 - Production on Wed Jul 1 21:13:46 2015
        Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
        connected to target database: FSPRD (DBID=1101052898, not open)
       
        RMAN> CATALOG START WITH '/backups/rman/standby';
        Do you really want to catalog the above files (enter YES or NO)? yes
        cataloging files...
        cataloging done
       
step 6:

        RECOVER DATABASE NOREDO;
       
Step 7: GET the New Updated SCN on FSPRDDR (STANDBY DATABASE)
        sqlplus / as sysdba
       
        select min(f.fhscn) from x$kcvfh f, v$datafile d
        where f.hxfil =d.file#
        and d.enabled != 'READ ONLY'    
       
           
Step 8: ON FSPRD execute the following SQL Statement to find out the GAP           
       
       
    select to_char(current_scn) from v$database; // FSPRD

    set lines 200
    SELECT SCN_TO_TIMESTAMP(98793218462) "FSPRD", SCN_TO_TIMESTAMP(NEW DR SCN from Step 7) "FSPRDDR" FROM dual;
    FSPRD                                               FSPRDDR
    ------------------------------------   -------------------------------------------
    02-JUL-15 08.11.29.000000000 PM                     02-JUL-15 07.06.14.000000000 PM



No comments:

Post a Comment