Saturday, June 29, 2013

Hot Cloning in Oracle Apps

   Source db name: TEST1
   Target db name: TEST2                     
On source:-
Step 1: Ensure adpreclone.pl has been run on dbTier and appsTier
Step 2:  we put the tablespace in begin backup mode and copy the datafiles

related that tablespace to target and give the end backup that tablespace. We have to repeat

these steps  for all tablespaces.

SQL> ALTER TABLESPACE <Tablespace Name> BEGIN BACKUP;

-bash-3.2$ copy datafiles related that tablespace from source to target using cp command


SQL> ALTER TABLESPACE <Tablespace Name> END BACKUP;

Step 3:-alter system switch logfile; (we have to give 2 to 3 times on source)

Step 4:- we have to copy the all archives from source to target

Note: (No need to copy the tempfiles,redolog files and controlfiles from source to target.
 Only db Files are enough including undo data files.)

On Target:-
We have to copy the Oracle Home from source to target then
Log on to the target system as the ORACLE user
Configure the <RDBMS ORACLE_HOME>
-bash-3.2$ cd <RDBMS ORACLE_HOME>/appsutil/clone/bin
bash-3.2$ Perl adcfgclone.pl dbTechStack
Once the above command execution has completed. The listener has started automatically
-bash-3.2$ cd /u01/oradb/db/tech_st/11.1.0/dbs
  Step2:  we will export ORACLE_HOME and ORACLE_SID
-bash-3.2$ ORACLE_HOME=/u01/oradb/db/tech_st/11.1.0
-bash-3.2$ export ORACLE_HOME
-bash-3.2$ ORACLE_SID=TEST2
-bash-3.2$ export ORACLE_SID
-bash-3.2$ PATH=/u01/oradb/db/tech_st/11.1.0/bin:$PATH;
-bash-3.2$ export PATH
-bash-3.2$ pwd
/u01/oradb/db/tech_st/11.1.0/dbs
-bash-3.2$ pwd
/u01/oradb/db/tech_st/11.1.0/dbs
-bash-3.2$ sqlplus / as sysdba
SQL*Plus: Release 11.1.0.7.0 - Production on Mon Apr 1 22:32:45 2013
Copyright (c) 1982, 2008, Oracle.  All rights reserved.
Connected to an idle instance.
  Step3: - On the target system issue STARTUP NOMOUNT command
SQL> startup nomount pfile='/u01/oradb/db/tech_st/11.1.0/dbs/initTEST2.ora';
ORACLE instance started.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
-bash-3.2$ sqlplus / as sysdba
SQL*Plus: Release 11.1.0.7.0 - Production on Mon Apr 1 22:33:16 2013
Copyright (c) 1982, 2008, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Step4: - Run the prepared script for control file
SQL> @control.sql
Control file created.
SQL> shut immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> create spfile from pfile='/u01/oradb/db/tech_st/11.1.0/dbs/initTEST2.ora';
File created.
SQL> startup mount
Database mounted
Note: after mounted the database we have to set the log_archive_format and log_archive_dest parameters before recovering the database
SQL> alter system set log_archive_format='TEST1_%t_%s_%r.arc' scope=spfile;
System altered.
(Here we have to create the log_archive_format same in target and source)
alter system set log_archive_format='TEST1_%t_%s_%r.arc' ;(Source)
alter system set log_archive_format='TEST1_%t_%s_%r.arc'; (target)
Note:  we have to give the log_archive_format same as Source db name on target db name.
Because while recovering database we do not get any issue on target. Once db opened then we can give Log_archive_format as target db name on target server
SQL> alter system set log_archive_dest_1='location=/u02/oradb/archive' scope=spfile;
System altered.
SQL> shut immediate
ORACLE instance shut down.
SQL> startup mount
Database mounted.
SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u02/oradb/archive
Oldest online log sequence     0
Next log sequence to archive   0
Current log sequence           0
Step5: -Start the db in recover mode
SQL> RECOVER DATABASE UNTIL CANCEL USING BACKUP CONTROLFILE;                                               
(Here we have to give the AUTO Command. once we have given the AUTO Command it will take archives automatically from log_archive_dest parameter of target)
ORA-00279: change 1934005125 generated at 04/01/2013 17:26:47 needed for thread
1
ORA-00289: suggestion : /u02/oradb/archive/TEST1_1_5926_777925422.arc
ORA-00280: change 1934005125 for thread 1 is in sequence #5926
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
AUTO
ORA-00279: change 1934124711 generated at 04/01/2013 17:33:48 needed for thread
1
ORA-00289: suggestion : /u02/oradb/archive/TEST1_1_5927_777925422.arc
ORA-00280: change 1934124711 for thread 1 is in sequence #5927
ORA-00278: log file '/u02/oradb/archive/TEST1_1_5930_777925422.arc' no
longer needed for this recovery
ORA-00308: cannot open archived log
'/u02/oradb/archive/TEST1_1_5931_777925422.arc'
ORA-27037: unable to obtain file status
SVR4 Error: 2: No such file or directory
Additional information: 3
Step6: - Open the database with resetlogs:
SQL>
ALTER DATABASE OPEN RESETLOGS;
Database altered.
SQL> CREATE TEMPORARY TABLESPACE TEMP01 TEMPFILE '/u01/oradb/db/apps_st/data/temp01_01.dbf' SIZE 4g TABLESPACE GROUP tmpgrp;
Tablespace created.
SQL> CREATE TEMPORARY TABLESPACE TEMP02 TEMPFILE '/u01/oradb/db/apps_st/data/temp02_01.dbf' SIZE 4g TABLESPACE GROUP tmpgrp;
Tablespace created.
SQL> ALTER DATABASE DEFAULT TEMPORARY TABLESPACE tmpgrp;
Database altered.
SQL> EXIT
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
-bash-3.2$ pwd
/u01/oradb/db/tech_st/11.1.0/appsutil/install/TEST2_<hostname>
-bash-3.2$ sqlplus / as sysdba
SQL*Plus: Release 11.1.0.7.0 - Production on Mon Apr 1 22:46:39 2013
Copyright (c) 1982, 2008, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Step7: - Run the library update script against the database
SQL> @adupdlib.sql so
PL/SQL procedure successfully completed.
Where <libext> is "sl" for HP-UX, "so" for any other UNIX platform and not required
for Windows. 
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
--bash-3.00$ cd /u02/oradb/db/tech_st/11.1.0/appsutil/clone/bin/
-bash-3.00$ pwd
/u02/oradb/db/tech_st/11.1.0/appsutil/clone/bin
-bash-3.00$ ls
CloneContext_0526102023.log  adcfgclone.pl                adchkutl.sh                  adclone.pl                   adclonectx.pl
Step8: - Configure the target database (the database must be open)
-bash-3.00perl adcfgclone.pl dbconfig /u01/oradb/db/tech_st/11.1.0/appsutil/TEST2_<hostname>.xml
-bash-3.2$ sqlplus / as sysdba
SQL*Plus: Release 11.1.0.7.0 - Production on Mon Apr 1 22:51:56 2013
Copyright (c) 1982, 2008, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> conn apps/apps
Connected.
SQL> EXEC FND_CONC_CLONE.SETUP_CLEAN;
PL/SQL procedure successfully completed.
SQL> commit;
Commit complete.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
-bash-3.2$ cd /u01/oradb/db/tech_st/11.1.0/appsutil/scripts/TEST2_<hostname>/
-bash-3.2$ pwd
/u01/oradb/db/tech_st/11.1.0/appsutil/scripts/TEST2_<hostname>
-bash-3.2$ ls
adautocfg.sh   addbctl.sh     adexecsql.pl   adpreclone.pl adstrtdb.sql
adchknls.pl    addlnctl.sh    adlsnodes.sh   adstopdb.sql
-Bash-3.2$ sh adautocfg.sh
Enter the APPS user password:
AutoConfig completed successfully.
Step9:-
-bash-3.2$ perl adcfgclone.pl appsTier
 Once The above script has completed successfully. Then it asks the
Do you want to startup the Application Services for TEST2? (y/n) [y] : Y
The application services are started automatically.


******************Hot Cloning activity has completed successfully******************

No comments:

Post a Comment