Creating a RMAN Clone Database and Apps 11i on a New Host

Primary Database SID: PROD
Duplicate Database SID: TEST
RMAN Catalog SID: RMAN


Steps

1. Backup the primary database.

2. Determine how much disk space will be required.

3. Ensuring you have enough space on your target server.

4. Making the backup available for the duplicate process.

5. Creating the init.ora & administration directories for the duplicate database.

6. Prepare RMAN duplicate script.

7. Execute the RMAN script.

1. Backup of the primary database.

Host A (Target)

Prior to creating a duplicate database you must have a backup of the target database. In this example we assume the backup media is disk. Find appropriate disk space on host A and take a full backup including archive logs and current controlfile. If you are planning to duplicate a subset of the database refer to (Figure 1b) this illustrates the RMAN command to backing up certain tablespaces.
[oracle@AIX] export ORACLE_SID=PROD

[oracle@AIX] rman target=/ catalog=rman/rman@RMAN

RMAN> run {
allocate channel d1 type disk;
backup format '/d01/backup/PROD/datafile_t%t_s%s_p%p' database;
sql 'alter system archive log current';
backup format '/d01/backup/PROD/alog_t%t_s%s_p%p' archivelog all;
release channel d1;
}
This above command will perform a full database backup including archivelogs and the current controlfile.

2. Determine how much disk space will be required.

Host A(Target) -

After deciding what you will be duplicating, calculate the entire space this will require on the new host. The full database calculation will calculate the entire space required whereas allows you to enter the tablespace names in order to calculate the space required.

SQL> select DF.TOTAL/1048576 "DataFile Size Mb",
LOG.TOTAL/1048576 "Redo Log Size Mb",
(DF.TOTAL + LOG.TOTAL)/1048576 "Total Size Mb" from dual,
(select sum(a.bytes) TOTAL from dba_data_files a) DF,
(select sum(b.bytes) TOTAL from v$log b) LOG;

Calculate space for list of tablespaces within primary database
DataFile Size Mb Redo Log Size Mb Total Size Mb
---------------- ---------------- -------------
31860 20 31880

3. Ensuring you have enough space on your target server.

Host B (TEST)

Prior to starting the duplicate process you must ensure you have enough disk space within file system to hold the database
appltest@test : /d05> df -sg
Filesystem GB blocks Free* %Used Iused %Iused Mounted on
/dev/hd4 0.25 0.18 27% 5262 11% /
/dev/hd2 2.75 0.35 88% 38731 32% /usr
/dev/hd9var 1.25 0.08 94% 1404 8% /var
/dev/hd3 1.00 0.32 68% 2860 4% /tmp
/dev/fwdump 0.50 0.50 1% 4 1% /var/adm/ras/platform
/dev/hd1 6.25 5.94 5% 4411 1% /home
/proc - - - - - /proc
/dev/hd10opt 0.75 0.25 67% 14037 20% /opt
/dev/locallv 0.25 0.25 1% 71 1% /usr/local
/dev/disk02lv 260.00 33.54 88% 2131066 18% /d05

4. Making the backup available for the duplicate process.

If your backup resides on disk you will need to copy this back up from host A to host B. Ensure you place it in the same directory as where it was created. In the example below the backup piece resides in ‘/backup/PROD’ these files need to be copied into the same directory on host B.

Furthermore also ensure than all archive log backups have also been moved and any archive logs in the archive log directory that may be require for the recovery. The archive logs required will depend on the point in time of the recovery.
RMAN> list backup;
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
22 Full 529M DISK 00:00:51 2007/08/25 12:19:05
BP Key: 22 Status: AVAILABLE Compressed: NO Tag: TAG20070825T111203
Piece Name: /backups/PROD/datafile_t598321425_s23_p1
List of Datafiles in backup set 22
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ------------------- ----
1 Full 1393845 2007/08/25 11:12:03 /oradata/PROD/system01.dbf
2 Full 1393845 2007/08/25 11:12:03 /oradata/PROD/undotbs01.dbf
3 Full 1393845 2007/08/25 11:12:03 /oradata/PROD/sysTEST01.dbf
4 Full 1393845 2007/08/25 11:12:03 /oradata/PROD/users01.dbf
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
24 48M DISK 00:00:06 2007/08/25 12:58:55
BP Key: 24 Status: AVAILABLE Compressed: NO Tag: TAG20070825T111301
Piece Name: /backups/PROD/alog_t598321429_s25_p1
List of Archived Logs in backup set 24
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- ------------------- ---------- ---------
1 78 1344750 2007/08/24 04:55:34 1353208 2007/08/24 10:00:19
1 79 1353208 2007/08/24 10:00:19 1353213 2007/08/24 10:00:20
1 80 1353213 2007/08/24 10:00:20 1372464 2007/08/24 22:00:11
1 81 1372464 2007/08/24 22:00:11 1373291 2007/08/24 22:00:59
1 82 1373291 2007/08/24 22:00:59 1381066 2007/08/25 03:00:08
1 83 1381066 2007/08/25 03:00:08 1390685 2007/08/25 09:03:00
1 84 1390685 2007/08/25 09:03:00 1393870 2007/08/25 11:13:00
1 85 1393870 2007/08/25 11:13:00 1393929 2007/08/25 11:13:00

5. Creating the init.ora & administration directories for the duplicate database.
# +----------------------------------------+
# FILE : initTEST.ora
# DATABASE NAME : TEST
# +----------------------------------------+
# Set the below to location of the clone Duplicate database / name of
# clone database.
# Set the below to the location of the duplicate clone control file.
# Set the below for the from and to location for all data files / redo
# logs to be cloned.
db_file_name_convert =("/d05/oradata/PROD/", "/d04/oradata/TEST/")
log_file_name_convert =("/d05/oradata/PROD/", "/d04/oradata/TEST/")
#Set the below to the same as the production target
Following the creation of the initTEST.ora startup nomount the auxiliary instance.
[oracle@AIX]export ORACLE_SID=TEST

[oracle@AIX] sqlplus '/as sysdba'

SQLPLUS> startup nomount;


6. Prepare RMAN duplicate script.

In a working directory on Host B create an RMAN script file clone.rcv. The example below shows the command for a complete duplicate (figure 7b) skips the tablespaces which are not required in the duplicate andprovide the syntax required for a point in time duplicate.

run {
allocate auxiliary channel C1 device type disk;
duplicate target database to TEST;
}

7. Execute the RMAN script.

Start RMAN, connect to the production target, the catalog instance and also the TESTiliary clone. Run the RMAN duplicate script as shown below. Before doing this ensure that the Oracle SID environment variable is set to the duplicate clone database.

[oracle@AIX] export ORACLE_SID=TEST
[oracle@AIX] rman target sys/sys@PROD catalog rman/rman@rman auxiliary /
RMAN> @clone.rcv


or

run
{
allocate auxiliary channel C1 device type disk;
duplicate target database to TEST;
}

This for Apps 11i Database
After Database creation, We need to create XML file.

Step 1: perl admkappsutil.pl

$ cd $AD_TOP/bin
$ pwd
/d05/appsdev2/oracle/prodappl/ad/11.5.0/bin
$ perl admkappsutil.pl
Starting the generation of appsutil.zip
Log file located at /d05/appsdev2/oracle/prodappl/admin/log/MakeAppsUtil_08010323.log
output located at /d05/appsdev2/oracle/prodappl/admin/out/appsutil.zip

root@TEST2 # cd /d05/appsdev2/oracle/prodappl/admin/out
$ ls -lst

root@TEST2 # cp appsutil.zip /d05/oracle/9.2.3
bash-2.03$ unzip -o appsutil.zip

Archive: appsutil.zip
inflating: appsutil/java/oracle/apps/ad/autoconfig/oam/CtxSynchronizer.class

bash-2.03$ perl adbldxml.pl tier=db appsuser=apps appspasswd=apps
appsutil/java/oracle/apps/ad/autoconfig/oam/CtxSynchronizerException.class

Also the Database table GLOBAL_NAME is hosting wrong value for domain.

Enter domain name:testdm

Enter the value for Display Variable: 169.16.3.1:0.0

Context File /d05/oracle/9.2.3/appsutil/DEV_TEST2.xml
already exists.

Overwriting Context File may cause loss of existing settings, hence
backing it up as: /d05/oracle/9.2.3/appsutil/DEV_TEST2.xml.bak

The context file has been created at:
/d05/oracle/9.2.3/appsutil/DEV_TEST2.xml

The log file for this adbldxml session is located at:
/d05/oracle/9.2.3/appsutil/log/DEV_TEST2/08010337.log

bash-2.03$ pwd
/d05/oracle/9.2.3/appsutil/bin

bash-2.03$ perl adconfig.pl contextfile=/d05/oracle/9.2.3/appsutil/DEV_hostname.xml appspass=apps

AutoConfig is configuring the Database environment...
Context Value Management will now update the Context file

Updating Context file...COMPLETED

Attempting upload of Context file and templates to database...COMPLETED

Updating rdbms version in Context file to db920
Updating rdbms type in Context file to 64 bits
Configuring templates from ORACLE_HOME ...

AutoConfig completed successfully.
The log file for this session is located at: /d05/oracle/9.2.3/appsutil/log/DEV_hostname2/08011549/adconfig.log

Apps Tier Colne

bash-2.03$ pwd
cd $ORACLE_HOME/appsutil/scripts/
perl adpreclone.pl dbTier
Running Rapid Clone with command...

Configure the target system application tier server nodes
Log on to the target system as the APPLMGR user and type the following commands:
cd /clone/bin
perl adcfgclone.pl appsTier

1 comment:

Sridevi Koduru said...

Regards
Sridevi Koduru (Senior Oracle Apps Trainer Oracleappstechnical.com)
LinkedIn profile - https://in.linkedin.com/in/sridevi-koduru-9b876a8b
Please Contact for One to One Online Training on Oracle Apps Technical, Financials, SCM, Oracle Manufacturing, OAF, ADF, SQL, PL/SQL, D2K at sridevikoduru@oracleappstechnical.com | +91 - 9581017828.