duplicate using rman

Upload: thota-mahesh-dba

Post on 02-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/27/2019 Duplicate Using RMAN

    1/7

    Duplicate using RMAN

    Recently I had a request from one of our clients to duplicate a single instance database into a two node RAC database. Both source and destination databases were

    11g Rel 2 on Linux.

    I could use old approach using rman backups or using 11g new feature DUPLICATE FROM ACTIVE database which doesnt need any backup from target database and

    I preferred to use second approach.

    Duplicate from ACTIVE database

    Duplicate from active database doesnt need any rman backup to be tak en from source database and actually it reads all database structure from the source

    database which needs to be mounted or opened during duplication. Although it seems good as we dont need to backup source database anymore for duplication

    but if you have a latest backup of your source database available and it can be accessed by auxiliary instance , still the best method for duplication is backup-based

    approach as it doesnt have an performance issue on source database.

    Two bold disadvantages of ACTIVE database duplication method are:

    1. Negative performance impact that it causes on source database and this impact applies to whole duplication time.2. High network traffic on connection between source and target database.

    If either of these negative impacts are not acceptable in your environment , you will need to switch to old backup -based approach.

    Duplicate from active database is an easy task only IF you follow all steps accurately otherwise it can be a complicated task and can waste lots of your time for

    troubleshooting.

    Following part is a simplified step-by-step instructions for DUPLICATE from ACTIVE database:

    Step by Step instructionIn this guide assume we are migrating a single instance database HRDEV to a two node RAC database HRPRD with following specif ications:

    Source database:

    Database name: HRDEV

    Single instance

    Version: 11.2.0.3

    Hostname: dev-db-01

    Filesystem: ASM

    Target database:

    Database name: HRPRD

    RAC 2 nodes

    Version: 11.2.0.3

    ORACLE_HOME: /apps/oracle/product/11.2.0/db_1

    GI_HOME: /apps/grid/11.2.0/Hostname: prd-db-01/prd-db-02

    Filesystem: ASM

    Diskgroup: +HR

    On target database HRPRD we assume that database has been already created with two instances and s pfile already exists. We will use only HRPRD1 i nstance which

    runs on prd-db-01

    The diskgroup that will be used for this database is +HR

    1- Prepare auxiliary instance HRPRD1 on prd-db-01 ,

    set following parameters on instance:

  • 7/27/2019 Duplicate Using RMAN

    2/7

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    . oraenv HRPRD1

    sqlplus / as sysdba

    alter system set db_name=HRPRD scope=spfile;

    alter system set cluster_database=false scope=spfile;

    alter system set db_create_file_dest='+HR';

    alter system set db_create_online_log_dest_1='+HR';

    shutdown immediate

    startup nomount

    2- Enable statis registration for HRPRD1 to running listener LISTENER.

    Add following entries into listener.ora file in GI_HOME.

    Edit /apps/grid/11.2.0/network/admin/listener.ora and add following lines:

    1

    2

    SID_LIST_LISTENER =

  • 7/27/2019 Duplicate Using RMAN

    3/7

    3

    4

    5

    6

    7

    8

    9

    (SID_LIST =

    )

    (SID_DESC =

    (SID_NAME = HRPRD1)

    (ORACLE_HOME = /apps/oracle/product/11.2.0/db_1)

    (GLOBAL_DBNAME = HRPRD)

    )

    )

    Make sure that ORACLE_HOME in this entry points to correct home which is the home that HRPRD database runs from

    3- Add following tns entries to BOTH auxiliary and target tnsnames.ora file :

    1

    2

    3

    4

    HRDEV =

    (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = dev-db-01)(PORT= 1521))

  • 7/27/2019 Duplicate Using RMAN

    4/7

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    17

    (CONNECT_DATA =

    (SERVER = DEDICATED)

    (SERVICE_NAME = HRDEV)

    )

    )

    HRPRD1 =

    (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = prd-db-01)(PORT= 1521))

    (CONNECT_DATA =

    (SERVER = DEDICATED)

    (SERVICE_NAME = HRPRD)

    )

  • 7/27/2019 Duplicate Using RMAN

    5/7

    )

    4- Ceate a password file for auxiliary instance HRPRD1 on prd-db-01:

    Connections to both instances will be through listener an d using TNS , so we need to use passwords for both auxiliary and target connections.

    For HRPRD as a new and empty database we may need to create a password file for it as follow:

    1

    2

    3

    4

    . oraenv

    HRPRD1

    cd $ORACLE_HOME/dbs

    orapwd password=sys file=orapwHRPRD1

    I have assumed that SYS password on source database HRDEV is sys

    5- Test connectivity to auxiliary and target instance from BOTH hosts using

    TNSMake sure your connectivity to source database and also to your auxiliary instance works fine , otherwise duplicate from acti ve database wont work.

    1

    2

    sqlplus sys/sys@HRPRD1 as sysdba

    sqlplus sys/sys@HRDEV as sysdba

    Try above commands on both target and auxiliary hosts prd-db-01 and dev-db-01

    6- On auxiliary host start RMAN and run the DUPLICATE command:

    From host prd-db-01 which runs auxiliary instance hrprd1 start rman. Make sure auxiliary connection is established through listener not through OS authentication.

  • 7/27/2019 Duplicate Using RMAN

    6/7

    1

    2

    3

    4

    5

    6

    7

    . oraenv

    HRPRD1

    rman target sys/sys@HRDEV auxiliary sys/sys@hrprd1

    RMAN>run{

    DUPLICATE TARGET DATABASE TO HRPRD

    FROM ACTIVE DATABASE;

    }

    7- When step 6 finished successfully , start HRPRD database using srvctl

    Change the HRPRD database to be cluster database again and start both instances:

    1

    2

    3

    4

    5

    . oraenv HRPRD1

    sqlplus / as sysdba

    alter system set cluster_database=true scope=spfile;

    shutdown immediate

  • 7/27/2019 Duplicate Using RMAN

    7/7

    6

    7 srvctl start db -d HRPRD