Thursday 21 June 2012

Clone Database & Application using Hot Backup Technique


Please Visit http://www.conacent.com/?page_id=218

Clone Database & Application using Hot Backup Technique

1. Take the database to Archivelog Mode on the Source DB.
2. Run adpreclone.pl on both the tier (DBTier & ApplTier).
3. Login to source Database Server
    $su - oracle
    $sqlplus '/as sysdba'
4. Backup the control file using following command
    SQL> alter database backup controlfile to trace;
    [This file .trc will be created on $ORACLE_HOME/admin/SID_HOSTNAME/diag/rdbms/SID/SID/trace with a name SID_ora_number.trc]

5. Put the database on Backup Mode using following command
    SQL> alter database begin backup;

6. Copy all the .dbf from source to target
7. After copying the .dbf to target remove the database from Backup Mode.
    SQL> alter database end backup;

8. On Source DB, Make the archvie logs current
    SQL> alter system archive log current;

9. Copy tech_st directory from source DB to target DB. Alone with the tracefile.
   Remove control file from target DB (cntrl*.dbf)

10. Configuring the target database
    # chown -R oracrp:dba /d02/crpappl
    # chmod -R 777 /d02/crpappl
    # su - oracrp
    $ cd $ORACLE_HOME/appstuil/clone/bin
    $ perl adcfgclone.pl dbTechStack
        [Fill up all the question answer]

11. Setup the environment file of the targeted DB.
12. Edit the trace file name which was copied from source to target DB
    [SID_ora_<Number>.trc]
    a. Remove all the line before Startup nomount
    b. Replace REUSE to SET
    c. Replace source DB SID to target DB SID
    d. Replace NORESTLOGS to RESTLOGS
    e. Replace ARCHIVELOG to NOARCHIVELOG
    f. Remove all the line after CHARACTER SET statement
    g. Replace the source mount point to target server mount point.

13. Login to target server database O/S user
    # su - oracrp
    $ sqlplus '/as sysdba'
    SQL> startup nomount pfile=$ORACLE_HOME/dbs/initCRP.ora;
    SQL> @SID_ora_<number>.trc    [Modified control tracefile]
        {It will create new control file them database will be mounted}
    SQL> recover database using backup controlfile until cancel;
    SQL> alter database open resetlogs;

14. Create temporary tablespace if not created in target
    a. Check if TEMP tablespace had tempfiles or datafiles
        SQL> select file_name, tablespace_name, status, autoextensible
            from DBA_TEMP_FILES
            where tablespace_name like 'TEMP%';

    b. Add Temp files
        SQL> alter tablespace TEMP1 add tempfile '<path of .dbf file temp01.dbf>'
            size 1024M reuse autoextend off;
        SQL> alter tablespace TEMP1 add tempfile '<path of .dbf file temp02.dbf>'
            size 1024M reuse autoextend off;

   c.  Set the temporary tablespace to TEMP1
    SQL>alter database default temporary tablespace TEMP1;


15. Run the library update script against the database
    # su - oracrp
    $ cd $ORACLE_HOME/appsutil/install/SID_hostname
    $ sqlplus '/as sysdba'
    SQL> @adupdlib.sql so;

16. Configure the target database (the database must be open)
    $ cd $ORACLE_HOME/appsutil/clone/bin
    $ perl adcfgclone.pl dbconfig <Path of the context file>

17. Configure the target Application Tier
    a. Copy all the filesystem from source to target server.
    b. Change owner & mode
        # chown -R applcrp:dba <Path where it is kept>
        # chown -R 777 applcrp:dba <Path where it is kept>
    c. Run the post clone of application
        # cd $COMMON_TOP/clone/bin
        # perl adcfgclone.pl appsTier
       


No comments:

Post a Comment