Announcements

Oracle training based on real-time expertise as per industry standards. Upcoming batch details are here.

View batch schedule

Free Oracle mock interview. Register using the link.

Register

#DBAchallenge: submit your questions.

Ask questions
Swipe for more →
Browse by Topic
Latest Posts

    Tuesday, June 2, 2015

    Database Cloning using RMAN

    Database Cloning using RMAN:
    =======================

    rdbms versions should be same

    1. taking the backup of the source database
    2. copy the backup piecess to the target server
    3. start an auxiliary instance on the target
    4. create the control file
    5. restore the database from backup pieces
    6. open the database using reset logs

    cloning is done by Manual or RMAN

    RMAN
    ======
    on primary:
    . oraenv
    primdb
    sqlplus "/ as sysdba"

    check wherther DB is in archive log mode / not

    SQL> archive log list;

    connect to rman and take backup

    $rman
    RMAN> connect target /
    RMAN> backup database plus archivelog;

    I have not mentioned the destination so backup will goes to FRA

    on target server:
    create the archive destination same as shown in rman output

    on primary:
    RMAN> backup current controlfile;

    copy backup pieces and control file backup to insemination server.

    create pfile='/tmp/initclonedb.ora' from spfile;

    copy the initfile to target server
    scp /tmp/initclonedb.ora oracle@server2:/$ORACLE_HOME/dbs/

    on target:
    cd $ORACLE_HOME/dbs
    vi initclonedb.ora

    chaneg primdb to clonedb

    :1,$ s#primdb#clonedb#g

    change the db_file_name_convert='primdb','clonedb'
    change the log_file_name_convert='primdb','clonedb'

    on primary:
    SQL> select name from v$datafile;

    on target:
    create the directory structure as there in initclonedb.ora file

    add entry in /etc/oratab
    vi /etc/oratab

    . oraenv
    clonedb
    sqlplus "/ as sysdba"

    starting the auxiliary instance
    starup nomount

    show parameter service

    tnsping primdb
    cd /$ORACLE_HOME/network/admin
    vi /tnsname.ora
    primtns
    {XXXXX
    XXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXX}

    sqlplus  system/oracle@primtns

    for RMAN cloning we need to connect to source as well as auxiliary instance at same time

    rman
    RMAN> connect auxiliary /
    RMAN> connect target sys/oracle@primtns
    RMAN> run
    {
    allocate auxiliary channel c1 device type disk;
    allocate channel c2 divice type disk;
    duplicate target database to 'clonedb';
    }

    select name, open_mode from v$database;

    Regards,
    Mallik

    No comments:

    Post a Comment

    🌟 Proud to be an Oracle ACE Pro! 🚀

    🌟 Proud to be an Oracle ACE Pro! 🚀 I’m excited to share my official Oracle ACE Profile with the Oracle community. 👨‍💻 Mallikarjun ...