Bcp Sync Using Rman

Embed Size (px)

Citation preview

  • 7/27/2019 Bcp Sync Using Rman

    1/6

    Yahoo! White Paper

    BCP Sync using RMAN IncrementalBackups

    ByYahoo DBA Team

  • 7/27/2019 Bcp Sync Using Rman

    2/6

    Yahoo! White PaperBCP Sync using RMAN Incremental Backups

    1.PurposeThis document explains the steps to sync up a BCP (Standby) with a primary database using

    RMAN incremental backups.

    2.Steps for BCP Sync using RMAN Incremental Backups

    Oracle Recovery Manager (RMAN) is used to synchronize a BCP database with a primary

    database by creating an incremental backup at the primary (source) database that always contain

    the changed values in the blocks from the time it was created or cloned (refreshed). The

    incremental backup is then applied to the BCP for keeping it up to date.

    Incremental Backup using System Change Number (SCN) is the concept used to sync the

    BCP with the primary.

    Step 1: (Standby site)

    From the standby that is lagging query the V$DATABASE view and record the current SCN.

    SQL>column current_scn format 9999999999999

    SQL> select current_scn from v$database;

    Current_scn

    ------------------------------------

    14218177179

    Step 2: (Primary site)

    Prepare command file to take incremental RMAN backup from primary.

    Connect to the primary database as the RMAN target (RMAN target /) and create incremental

    backup from the current SCN of the standby database recorded from the step 1 by means of

    BACKUP INCREMENTAL FROM SCN=n (where n=number).

    In the illustration the RMAN Backup location on source: /n01/rman_bkup

  • 7/27/2019 Bcp Sync Using Rman

    3/6

    Yahoo! White Paperrman_bkp.rcv:

    =============

    run

    {

    CONFIGURE DEVICE TYPE DISK PARALLELISM 16 BACKUP TYPE TO COMPRESSED

    BACKUPSET;

    backup as compressed backupset incremental from scn 14218177179 database filesperset=1

    format ='/n01/rman_bkup/stex_%U';

    }

    The files that are backed up contains data blocks that were changed at SCNs greater than or

    equal to SCN from step 1.

    Step 3: (Primary site)

    Start the backup

    nohup rman target / cmdfile rman_bkp.rcv msglog rman_bkp.log &

    RMAN backup took 80 min. for 11g fi les.

    Step 4: (Primary site)

    Use Netcat copy to copy the RMAN backups to the standby and also backup the control file to

    the standby and note the location of the control files.

    SQL> select name from v$contolfile;

    On the Primary, create a new standby control file.

    SQL> alter database create standby controlfile as '/tmp/standby.ctl';

    Netcat copy took 45 min.

  • 7/27/2019 Bcp Sync Using Rman

    4/6

    Yahoo! White PaperStep 5: (Standby site)

    1. Find out if the standby database is performing managed recovery.SQL> select process, status from v$managed_standby;

    If the MRP process exists, then the standby database is performing managed recovery

    2. Cancel the managed recovery process (MRP), stop redo apply on the standby database:

    SQL> alter database recover managed standby database cancel;

    Step 6: (Standby site)

    Prepare recovery command file.

    Connect to the standby database as RMAN target and apply incremental backups.

    rman_reco.rcv:

    ==============

    run

    {

    recover database noredo parallel 16;

    }

    Step 7: (Standby site)

    Start the recovery

    nohup rman target / cmdfile rman_reco.rcv msglog rman_reco.log &

    Step 8: (Standby site)

    Restore the standby control file.

  • 7/27/2019 Bcp Sync Using Rman

    5/6

    Yahoo! White Papercp -p /n01/oradata/STEXPAC2/standby_control01.ctl

    /n01/oradata/STEXPAC2/standby_control01.ctl.bak

    cp -p /n01/oradata/STEXPAC2/standby_control02.ctl

    /n01/oradata/STEXPAC2/standby_control02.ctl.bak

    cp -p standby.ctl /n01/oradata/STEXPAC2/standby_control01.ctl

    cp -p standby.ctl /n01/oradata/STEXPAC2/standby_control02.ctl

    RMAN apply took 80 mins

    Step 8: (Standby site)

    Start the managed recovery process:

    SQL> alter database recover managed standby database disconnect from session;

    Log apply services apply the archived redo logs to the standby database when the database is

    performing managed recovery.

    Step 9: (Primary and Standby site)

    Check the SCNs in both Primary and BCP.

    [Standby site] SQL> select current_scn from v$database;

    CURRENT_SCN-----------1447474

    [Primary site] SQL> select current_scn from v$database;

    CURRENT_SCN-----------1447478

  • 7/27/2019 Bcp Sync Using Rman

    6/6