ORACLE EBS R12 cloning|Using RMAN duplicate database restore scripts
1. Execute the pre-clone processes on SOURCE.
a. Execute Database pre-clone process:.
• Login as ora<sid> of source instance (eg. Oraprd)
• UNIX> cd cd /prddb11/prddb/11.2.0.3/appsutil/scripts/PRD_efxfinprd
• UNIX> perl adpreclone.pl dbTier
DBTier:
- $ORACLE_HOME/appsutil/scripts/CRPM_aorpprkd007)
- Perl adpreclone.pl dbTier
b. Execute Application pre-clone process:
• Login as appl<sid> user of SOURCE instance (eg. applprd):
• UNIX> cd $COMMON_TOP/admin/scripts/<CONTEXT_NAME>
• UNIX> perl adpreclone.pl appsTier
AppsTier :
- $ADMIN_SCRIPTS_HOME
- Perl adpreclone appsTier
2. Stop Target Application, Database and listener
3. Make copy of Important Files on Target DB node :
1.) Mkdir $HOME/CLONE_SAVE
2.) cd ~/CLONE_SAVE
3.) cp $ORACLE_HOME/*.env .
4.) cp $ORACLE_HOME/appsutil/*.xml .
5.) cp $ORACLE_HOME/dbs/*.ora .
6.) cp $TNS_ADMIN/*.ora .
7.) cp $ORACLE_HOME/sysman/lib/env_emagent.mk .
8.) cp $ORACLE_HOME/appsutil/install/adlnkoh.sh .
9.) ls -l ~/CLONE_SAVE
4. Make copy of Important Files on Target Apps Tier :
1.)mkdir ~/CLONE_SAVE
2.)cd ~/CLONE_SAVE
3.)cp $APPL_TOP/*.env
4.)cp $CONTEXT_FILE .
5.)cp $APPL_TOP/admin/adovars.env .
For UAT Clone (On Target Node)
Save certificate files
mkdir –p ~/CLONE_SAVE/Apache_Certs ~/CLONE_SAVE/opmn_Certs
cd ~/CLONE_SAVE
- cp $INST/certs/Apache/* Apache_Certs/
- cp INST_TOP/certs/opmn/* opmn_Certs/
5. Copy RMAN backup pieces, archive file and control file from db server to Target db server:
6. Run dbTechStack on dbTier
7. Perform Database Recovery based on RMAN backup:.
a. Login as ora<sid> user of the Target. Example: oradev
b. UNIX> cd $ORACLE_HOME/dbs.
Edit the init.ora files of the SOURCE database (eg. initPRD.ora). Change the following variables to point to target directories, instead of source directory
UNIX> vi initPRD.ora change the following
control_files = /devdata02/devdata/cntrl01.dbf,/devdata02/devdata/cntrl02.dbf,/devdata02/devdata/cntrl03.dbf
diagnostic_dest =/devdb11/devdb
archive_dest=’local_server’
diagnostics_dest=<>
utl_file_dir=<>
#local_lstener=<>
#ifile=<>
c. Move the .profile on target instance and set below environment.
export ORACLE_HOME= /devdb11/devdb/11.2.0.3
export ORACLE_SID=PRD
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/lib:$LD_LIBRARY_PATH
d. startup database in nomount state
e. create a restore script as below,
echo " Recovery_start_time";
echo "date '+%Y/%m/%d @ %H:%M:%S'";
export ORACLE_SID=${ORACLE_SID};
rman log ="/bu/PRD_BKP/${ORACLE_SID}_Recovery_$(date '+%y%m%d@%H%M%S').log" <<EOF
CONNECT AUXILIARY /
run {
allocate auxiliary channel ch1 device type disk;
allocate auxiliary channel ch2 device type disk;
allocate auxiliary channel ch3 device type disk;
allocate auxiliary channel ch4 device type disk;
allocate auxiliary channel ch5 device type disk;
allocate auxiliary channel ch6 device type disk;
allocate auxiliary channel ch7 device type disk;
SET NEWNAME FOR DATAFILE 1 TO '/tdxdbd1/PROJ4/data/system01.dbf';
SET NEWNAME FOR DATAFILE 2 TO '/tdxdbd1/PROJ4/data/system02.dbf';
SET NEWNAME FOR DATAFILE 3 TO '/tdxdbd1/PROJ4/data/system03.dbf';
SET NEWNAME FOR DATAFILE 4 TO '/tdxdbd1/PROJ4/data/system04.dbf';
SET NEWNAME FOR DATAFILE 5 TO '/tdxdbd1/PROJ4/data/system05.dbf';
SET NEWNAME FOR DATAFILE 6 TO '/tdxdbd1/PROJ4/data/system06.dbf';
SET NEWNAME FOR DATAFILE 7 TO '/tdxdbd1/PROJ4/data/system07.dbf';
SET NEWNAME FOR DATAFILE 8 TO '/tdxdbd1/PROJ4/data/system08.dbf';
SET NEWNAME FOR DATAFILE 9 TO '/tdxdbd1/PROJ4/data/system09.dbf';
SET NEWNAME FOR DATAFILE 10 TO '/tdxdbd1/PROJ4/data/system10.dbf';
SET NEWNAME FOR DATAFILE 11 TO '/tdxdbd1/PROJ4/data/system11.dbf';
SET NEWNAME FOR DATAFILE 12 TO '/tdxdbd1/PROJ4/data/sysaux_01.dbf';
SET NEWNAME FOR DATAFILE 13 TO '/tdxdbd1/PROJ4/data/sysaux_02.dbf';
SET NEWNAME FOR DATAFILE 14 TO '/tdxdbd1/PROJ4/data/undo01.dbf';
SET NEWNAME FOR DATAFILE 15 TO '/tdxdbd1/PROJ4/data/undo02.dbf';
....
....
....
....
SET NEWNAME FOR DATAFILE 113 TO '/tdxdbd1/PROJ4/data/a_txn_data14.dbf';
SET NEWNAME FOR DATAFILE 114 TO '/tdxdbd1/PROJ4/data/a_txn_data13.dbf';
SET NEWNAME FOR DATAFILE 115 TO '/tdxdbd1/PROJ4/data/a_txn_data12.dbf';
SET NEWNAME FOR DATAFILE 116 TO '/tdxdbd1/PROJ4/data/a_txn_data11.dbf';
SET NEWNAME FOR DATAFILE 117 TO '/tdxdbd1/PROJ4/data/a_txn_data10.dbf';
SET NEWNAME FOR DATAFILE 118 TO '/tdxdbd1/PROJ4/data/a_txn_data09.dbf';
SET NEWNAME FOR DATAFILE 119 TO '/tdxdbd1/PROJ4/data/a_txn_data08.dbf';
SET NEWNAME FOR DATAFILE 120 TO '/tdxdbd1/PROJ4/data/a_txn_data07.dbf';
SET NEWNAME FOR DATAFILE 121 TO '/tdxdbd1/PROJ4/data/a_txn_data06.dbf';
SET NEWNAME FOR DATAFILE 122 TO '/tdxdbd1/PROJ4/data/a_txn_data05.dbf';
SET NEWNAME FOR DATAFILE 123 TO '/tdxdbd1/PROJ4/data/a_txn_data04.dbf';
SET NEWNAME FOR DATAFILE 124 TO '/tdxdbd1/PROJ4/data/a_txn_data03.dbf';
SET NEWNAME FOR DATAFILE 125 TO '/tdxdbd1/PROJ4/data/a_txn_data02.dbf';
SET NEWNAME FOR DATAFILE 126 TO '/tdxdbd1/PROJ4/data/a_txn_data01.dbf';
SET NEWNAME FOR DATAFILE 127 TO '/tdxdbd1/PROJ4/data/a_txn_ind23.dbf';
SET NEWNAME FOR DATAFILE 128 TO '/tdxdbd1/PROJ4/data/a_txn_ind22.dbf';
SET NEWNAME FOR DATAFILE 130 TO '/tdxdbd1/PROJ4/data/a_txn_ind20.dbf';
SET NEWNAME FOR DATAFILE 131 TO '/tdxdbd1/PROJ4/data/a_txn_ind19.dbf';
SET NEWNAME FOR DATAFILE 132 TO '/tdxdbd1/PROJ4/data/a_txn_ind18.dbf';
SET NEWNAME FOR DATAFILE 133 TO '/tdxdbd1/PROJ4/data/a_txn_ind17.dbf';
SET NEWNAME FOR DATAFILE 134 TO '/tdxdbd1/PROJ4/data/a_txn_ind16.dbf';
SET NEWNAME FOR DATAFILE 135 TO '/tdxdbd1/PROJ4/data/a_txn_ind15.dbf';
SET NEWNAME FOR DATAFILE 136 TO '/tdxdbd1/PROJ4/data/a_txn_ind13.dbf';
SET NEWNAME FOR DATAFILE 137 TO '/tdxdbd1/PROJ4/data/a_txn_ind12.dbf';
SET NEWNAME FOR DATAFILE 138 TO '/tdxdbd1/PROJ4/data/a_txn_ind11.dbf';
SET NEWNAME FOR DATAFILE 139 TO '/tdxdbd1/PROJ4/data/a_txn_ind10.dbf';
SET NEWNAME FOR DATAFILE 140 TO '/tdxdbd1/PROJ4/data/a_txn_ind09.dbf';
....
....
....
SET NEWNAME FOR TEMPFILE '/prddbd/PRD/data/temp01.dbf' TO '/bu/PROJ4/data/temp01.dbf';
SET NEWNAME FOR TEMPFILE '/prddbd/PRD/data/temp02.dbf' TO '/bu/PROJ4/data/temp02.dbf';
SET NEWNAME FOR TEMPFILE '/prddbd/PRD/data/temp03.dbf' TO '/bu/PROJ4/data/temp03.dbf';
DUPLICATE DATABASE TO PROJ4 BACKUP LOCATION '/bu/PRD_BKP'
LOGFILE
GROUP 1 (
'/sanddata/PROJ4/data/log1a.dbf',
'/sanddata/PROJ4/data/log1b.dbf'
) SIZE 125M,
GROUP 2 (
'/sanddata/PROJ4/data/log2a.dbf',
'/sanddata/PROJ4/data/log2b.dbf'
) SIZE 125M,
GROUP 3 (
'/sanddata/PROJ4/data/log3a.dbf',
'/sanddata/PROJ4/data/log3b.dbf'
) SIZE 125M,
GROUP 4 (
'/sanddata/PROJ4/data/log4a.dbf',
'/sanddata/PROJ4/data/log4b.dbf'
) SIZE 125M,
GROUP 5 (
'/sanddata/PROJ4/data/log5a.dbf',
'/sanddata/PROJ4/data/log5b.dbf'
) SIZE 125M
;
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
release channel ch5;
release channel ch6;
release channel ch7;
}
host "echo Recovery_endttime";
host "date '+%Y/%m/%d @ %H:%M:%S'";
EOF
8. Check the status of the database with the below commands,
SQL> select distinct status from v$datafile;
STATUS
-------
ONLINE
SYSTEM
SQL> select distinct status from dba_data_files;
STATUS
---------
AVAILABLE
SQL> select * from V$RECOVER_FILE;
no rows selected
9. Drop and recreate the TEMP tablespace,
SQL> DROP TABLESPACE TEMP2 including contents and datafiles;
Tablespace dropped.
SQL> DROP TABLESPACE PRD_IAS_TEMP including contents and datafiles;
Tablespace dropped.
CREATE TEMPORARY TABLESPACE TEMP1 TEMPFILE '/sanddata/PROJ4/data/temp1_01.dbf' SIZE 2048M,'/sanddata/PROJ4/data/temp1_02.dbf' SIZE 2048M,'/sanddata/PROJ4/data/temp1_03.dbf' SIZE 2048M autoextend off;
10. Disable Archive for Non-Prod instances
SQL> startup mount;
ORACLE instance started.
Total System Global Area 8551575552 bytes
Fixed Size 2245480 bytes
Variable Size 620760216 bytes
Database Buffers 7902068736 bytes
Redo Buffers 26501120 bytes
Database mounted.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /tdxdbd1/PROJ4/data/archive
Oldest online log sequence 1
Next log sequence to archive 1
Current log sequence 1
SQL> alter database noarchivelog;
Database altered.
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /tdxdbd1/PROJ4/data/archive
Oldest online log sequence 1
Current log sequence 1
SQL> alter database open;
Database altered.
11. Clean up FND_CONC_CLONE
SQL> conn apps
Enter password:
Connected.
SQL> exec fnd_conc_clone.setup_clean;
PL/SQL procedure successfully completed.
SQL> commit;
Commit complete.
12. Check oraInventory and point to the exact location
-bash-3.2$ grep PROJ4 /etc/oraInst.loc | grep -v '#'
inventory_loc=/tdxdbb1/PROJ4/oraInventory
13. Update library files
SQL> @$ORACLE_HOME/appsutil/install/$CONTEXT_NAME/adupdlib.sql so;
PL/SQL procedure successfully completed.
SQL> commit;
Commit complete.
14. Run Autoconfig on DB node
-bash-3.2$ sh adautocfg.sh
Enter the APPS user password:
The log file for this session is located at: /tdxdbb1/PROJ4/db_1/appsutil/log/PROJ4_aord1rkd001/02130547/adconfig.log
AutoConfig is configuring the Database environment...
AutoConfig will consider the custom templates if present.
Using ORACLE_HOME location : /tdxdbb1/PROJ4/db_1
Classpath : :/tdxdbb1/PROJ4/db_1/jdbc/lib/ojdbc5.jar:/tdxdbb1/PROJ4/db_1/appsutil/java/xmlparserv2.jar:/tdxdbb1/PROJ4/db_1/appsutil/java:/tdxdbb1/PROJ4/db_1/jlib/netcfg.jar:/tdxdbb1/PROJ4/db_1/jlib/ldapjclnt11.jar
Using Context file : /tdxdbb1/PROJ4/db_1/appsutil/PROJ4_aord1rkd001.xml
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 db112
Updating rdbms type in Context file to 64 bits
Configuring templates from ORACLE_HOME ...
AutoConfig completed successfully.
Database clone completed succesfully
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Application Clone
15. Backup/Remove the old app binaries and untar the backup tar file.
-bash-3.2$ pwd
/r12uat1app/PROJ4
-bash-3.2$ ls -ltr
total 63748
drwxr-xr-x 4 applsit dba 4096 Jul 8 2015 apps_bkp
-rw------- 1 applsit dba 65004216 Nov 25 11:00 nohup.out
drwxr-xr-x 4 applsit dba 4096 Nov 30 20:12 inst_bkp
-bash-3.2$ nohup tar -xvzf /bu/PRD_APPS_BKP/prdapps021217.tar.gz &
[1] 21538
-bash-3.2$ nohup: appending output to `nohup.out'
[1]+ Done nohup tar -xvzf /bu/PRD_APPS_BKP/prdapps021217.tar.gz
You have new mail in /var/spool/mail/applsit
16. Configure Target application
/r12uat1app/PROJ4/apps/apps_st/comn/clone/bin
-bash-3.2$ ls -ltr
total 148
-rwxr-xr-x 1 applsit dba 55747 Feb 14 2015 adclone.pl
-rwxr-xr-x 1 applsit dba 27277 Feb 14 2015 adclonectx.pl
-rwxr-xr-x 1 applsit dba 5108 Feb 14 2015 adchkutl.sh
-rwxr-xr-x 1 applsit dba 33401 Feb 14 2015 adcfgclone.pl
-rwxr-xr-x 1 applsit dba 7413 Feb 14 2015 adaddnode.pl
-bash-3.2$ perl adcfgclone.pl appsTier /opt/home/applsit/CLONE_SAVE/PROJ4/PROJ4_acod1rka001.xml
Do you want to startup the Application Services for DEVM? (y/n) [y] : N
Soon after you run rapidclone at application tier. Bring down the APPS services.
17. Post Directory Creation Steps
• Create directory /share_R12_dev/<TARGET_INSTANCE_NAME>/appl and APPLPTMP directory
E.g.
mkdir –p /share_R12_dev/ATLASDEV/appl
mkdir –p /share_R12_dev/ATLASDEV/ATLASDEV_TEMP
chmod 777 /share_R12_dev/ATLASDEV/ATLASDEV_TEMP
• Copy all the custom top folders from target application $APPL_TOP/xx* to /share_R12_dev/ATLASDEV/appl
• Create custom top data directory structure on target server
On PRD/Source Instance
cd $APPL_TOP
find xx*/12.0.0/data -type d -print | while read line; do echo "mkdir -p '${line}'"; done
On Target Application server : From the above output, create a script and run in /share_R12_dev/<TARGET_INSTANCE_NAME>/appl
cd /share_R12_dev/<TARGET_INSTANCE_NAME>/appl
Execute above mkdir commands that gets generated on Target server
• Provide 777 permission on /share_R12_dev/<TARGET_INSTANCE_NAME>/appl/xx*/12.0.0/data
18. Apply 19127427 patch for coredump issue from 1932120.1 in target instance
19. POST CLONE AUTOMATION SCRIPT
Script to Change FND_USER password with default password after Cloning
function Change_fnd_user_password
{
cat /dev/null > password_failure.txt
sqlplus -s apps/appsdeve << EOF
set lines 300 pages 0 feedback off
spool fnd_user.lst
select 'FNDCPASS apps/appsdeve 0 Y system/systemdeve USER "'||USER_NAME||'" ChangeMe@123 || echo "Err while changing password for user - ' || user_name || '" >> password_failure.txt' from fnd_user where user_name not in ('APPSMGR','ASADMIN','INDUSTRY DATA','GUEST','SYSADMIN') and (user_name not like 'ORACLE%') and user_name not like 'APP%';
spool off;
EOF
#sed -e 1,+1d fnd_user.lst > fnd_user_2.lst
sh fnd_user.lst
if [ `wc -l password_failure.txt | awk '{print $1}'` -gt 0 ]
then
echo 'Following errors occured while changing Application User Passwords'
cat password_failure.txt
rm L*.log
else
echo "All the passwords of Application users got changed successfully to 'ChangeMe@123' "
rm L*.log
rm password_failure.txt
fi
}
Change_fnd_user_password
20. Post Clone validation steps
SQL> select name from v$database;
NAME
---------
SOLCONV
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
utl_file_dir string /share_R12_SOLCONV/SOLCONV/SOLCONV
_TEMP, /tdxdbb4/SOLCONV/db_1/a
ppsutil/outbound/SOLCONV_bpuqq
rkd007, /usr/tmp
[oratdx4@bpuqqrkd007 SOLCONV_bpuqqrkd007]$ diff sqlnet.ora sqlnet.ora_bkp
13c13
< SQLNET.EXPIRE_TIME= 1
---
> SQLNET.EXPIRE_TIME= 10
20c20
< IFILE=/tdxdbb4/SOLCONV/db_1/network/admin/SOLCONV_bpuqqrkd007/sqlnet_ifile.ora
---
> IFILE=/tdxdbb4/SOLCONV/db_1/network/admin/SOLCONV_bpuqqrkd007/sqlnet_ifile.ora
\ No newline at end of file
[appltdx4@bpuqqrkd007 SOLCONV_TEMP]$ echo $APPLPTMP
/share_R12_SOLCONV/SOLCONV/SOLCONV_TEMP
[appltdx4@bpuqqrkd007 SOLCONV_TEMP]$ echo $APPLTMP
/share_R12_SOLCONV/SOLCONV/SOLCONV_TEMP
[appltdx4@bpuqqrkd007 SOLCONV_TEMP]$ cd $XXAP_TOP
[appltdx4@bpuqqrkd007 12.0.0]$ ls -tr
sql log patches ldt oldsql admin mesg out forms ddl wf INVUPL_VERCUITY032514.dat reports data bin
[appltdx4@bpuqqrkd007 12.0.0]$ cd data/
[appltdx4@bpuqqrkd007 data]$ ls -ltr
total 36
drwxrwxrwx 2 appltdx4 appid 4096 Feb 1 05:52 error
drwxrwxrwx 11 appltdx4 appid 4096 Feb 1 05:52 inbound
drwxrwxrwx 2 appltdx4 appid 4096 Feb 1 05:52 ESS_DATAFILES
drwxrwxrwx 2 appltdx4 appid 4096 Feb 1 05:52 processed
drwxrwxrwx 3 appltdx4 appid 4096 Feb 1 05:52 invoices
drwxrwxrwx 4 appltdx4 appid 4096 Feb 1 05:52 outbound
drwxrwxrwx 2 appltdx4 appid 4096 Feb 1 05:52 suppliers
drwxrwxrwx 2 appltdx4 appid 4096 Feb 1 05:52 archive_outbound
drwxrwxrwx 2 appltdx4 appid 4096 Feb 1 05:52 archive_processed
Active user concurrent request no. : 30076875
1. Execute the pre-clone processes on SOURCE.
a. Execute Database pre-clone process:.
• Login as ora<sid> of source instance (eg. Oraprd)
• UNIX> cd cd /prddb11/prddb/11.2.0.3/appsutil/scripts/PRD_efxfinprd
• UNIX> perl adpreclone.pl dbTier
DBTier:
- $ORACLE_HOME/appsutil/scripts/CRPM_aorpprkd007)
- Perl adpreclone.pl dbTier
b. Execute Application pre-clone process:
• Login as appl<sid> user of SOURCE instance (eg. applprd):
• UNIX> cd $COMMON_TOP/admin/scripts/<CONTEXT_NAME>
• UNIX> perl adpreclone.pl appsTier
AppsTier :
- $ADMIN_SCRIPTS_HOME
- Perl adpreclone appsTier
2. Stop Target Application, Database and listener
3. Make copy of Important Files on Target DB node :
1.) Mkdir $HOME/CLONE_SAVE
2.) cd ~/CLONE_SAVE
3.) cp $ORACLE_HOME/*.env .
4.) cp $ORACLE_HOME/appsutil/*.xml .
5.) cp $ORACLE_HOME/dbs/*.ora .
6.) cp $TNS_ADMIN/*.ora .
7.) cp $ORACLE_HOME/sysman/lib/env_emagent.mk .
8.) cp $ORACLE_HOME/appsutil/install/adlnkoh.sh .
9.) ls -l ~/CLONE_SAVE
4. Make copy of Important Files on Target Apps Tier :
1.)mkdir ~/CLONE_SAVE
2.)cd ~/CLONE_SAVE
3.)cp $APPL_TOP/*.env
4.)cp $CONTEXT_FILE .
5.)cp $APPL_TOP/admin/adovars.env .
For UAT Clone (On Target Node)
Save certificate files
mkdir –p ~/CLONE_SAVE/Apache_Certs ~/CLONE_SAVE/opmn_Certs
cd ~/CLONE_SAVE
- cp $INST/certs/Apache/* Apache_Certs/
- cp INST_TOP/certs/opmn/* opmn_Certs/
5. Copy RMAN backup pieces, archive file and control file from db server to Target db server:
6. Run dbTechStack on dbTier
7. Perform Database Recovery based on RMAN backup:.
a. Login as ora<sid> user of the Target. Example: oradev
b. UNIX> cd $ORACLE_HOME/dbs.
Edit the init.ora files of the SOURCE database (eg. initPRD.ora). Change the following variables to point to target directories, instead of source directory
UNIX> vi initPRD.ora change the following
control_files = /devdata02/devdata/cntrl01.dbf,/devdata02/devdata/cntrl02.dbf,/devdata02/devdata/cntrl03.dbf
diagnostic_dest =/devdb11/devdb
archive_dest=’local_server’
diagnostics_dest=<>
utl_file_dir=<>
#local_lstener=<>
#ifile=<>
c. Move the .profile on target instance and set below environment.
export ORACLE_HOME= /devdb11/devdb/11.2.0.3
export ORACLE_SID=PRD
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/lib:$LD_LIBRARY_PATH
d. startup database in nomount state
e. create a restore script as below,
echo " Recovery_start_time";
echo "date '+%Y/%m/%d @ %H:%M:%S'";
export ORACLE_SID=${ORACLE_SID};
rman log ="/bu/PRD_BKP/${ORACLE_SID}_Recovery_$(date '+%y%m%d@%H%M%S').log" <<EOF
CONNECT AUXILIARY /
run {
allocate auxiliary channel ch1 device type disk;
allocate auxiliary channel ch2 device type disk;
allocate auxiliary channel ch3 device type disk;
allocate auxiliary channel ch4 device type disk;
allocate auxiliary channel ch5 device type disk;
allocate auxiliary channel ch6 device type disk;
allocate auxiliary channel ch7 device type disk;
SET NEWNAME FOR DATAFILE 1 TO '/tdxdbd1/PROJ4/data/system01.dbf';
SET NEWNAME FOR DATAFILE 2 TO '/tdxdbd1/PROJ4/data/system02.dbf';
SET NEWNAME FOR DATAFILE 3 TO '/tdxdbd1/PROJ4/data/system03.dbf';
SET NEWNAME FOR DATAFILE 4 TO '/tdxdbd1/PROJ4/data/system04.dbf';
SET NEWNAME FOR DATAFILE 5 TO '/tdxdbd1/PROJ4/data/system05.dbf';
SET NEWNAME FOR DATAFILE 6 TO '/tdxdbd1/PROJ4/data/system06.dbf';
SET NEWNAME FOR DATAFILE 7 TO '/tdxdbd1/PROJ4/data/system07.dbf';
SET NEWNAME FOR DATAFILE 8 TO '/tdxdbd1/PROJ4/data/system08.dbf';
SET NEWNAME FOR DATAFILE 9 TO '/tdxdbd1/PROJ4/data/system09.dbf';
SET NEWNAME FOR DATAFILE 10 TO '/tdxdbd1/PROJ4/data/system10.dbf';
SET NEWNAME FOR DATAFILE 11 TO '/tdxdbd1/PROJ4/data/system11.dbf';
SET NEWNAME FOR DATAFILE 12 TO '/tdxdbd1/PROJ4/data/sysaux_01.dbf';
SET NEWNAME FOR DATAFILE 13 TO '/tdxdbd1/PROJ4/data/sysaux_02.dbf';
SET NEWNAME FOR DATAFILE 14 TO '/tdxdbd1/PROJ4/data/undo01.dbf';
SET NEWNAME FOR DATAFILE 15 TO '/tdxdbd1/PROJ4/data/undo02.dbf';
....
....
....
....
SET NEWNAME FOR DATAFILE 113 TO '/tdxdbd1/PROJ4/data/a_txn_data14.dbf';
SET NEWNAME FOR DATAFILE 114 TO '/tdxdbd1/PROJ4/data/a_txn_data13.dbf';
SET NEWNAME FOR DATAFILE 115 TO '/tdxdbd1/PROJ4/data/a_txn_data12.dbf';
SET NEWNAME FOR DATAFILE 116 TO '/tdxdbd1/PROJ4/data/a_txn_data11.dbf';
SET NEWNAME FOR DATAFILE 117 TO '/tdxdbd1/PROJ4/data/a_txn_data10.dbf';
SET NEWNAME FOR DATAFILE 118 TO '/tdxdbd1/PROJ4/data/a_txn_data09.dbf';
SET NEWNAME FOR DATAFILE 119 TO '/tdxdbd1/PROJ4/data/a_txn_data08.dbf';
SET NEWNAME FOR DATAFILE 120 TO '/tdxdbd1/PROJ4/data/a_txn_data07.dbf';
SET NEWNAME FOR DATAFILE 121 TO '/tdxdbd1/PROJ4/data/a_txn_data06.dbf';
SET NEWNAME FOR DATAFILE 122 TO '/tdxdbd1/PROJ4/data/a_txn_data05.dbf';
SET NEWNAME FOR DATAFILE 123 TO '/tdxdbd1/PROJ4/data/a_txn_data04.dbf';
SET NEWNAME FOR DATAFILE 124 TO '/tdxdbd1/PROJ4/data/a_txn_data03.dbf';
SET NEWNAME FOR DATAFILE 125 TO '/tdxdbd1/PROJ4/data/a_txn_data02.dbf';
SET NEWNAME FOR DATAFILE 126 TO '/tdxdbd1/PROJ4/data/a_txn_data01.dbf';
SET NEWNAME FOR DATAFILE 127 TO '/tdxdbd1/PROJ4/data/a_txn_ind23.dbf';
SET NEWNAME FOR DATAFILE 128 TO '/tdxdbd1/PROJ4/data/a_txn_ind22.dbf';
SET NEWNAME FOR DATAFILE 130 TO '/tdxdbd1/PROJ4/data/a_txn_ind20.dbf';
SET NEWNAME FOR DATAFILE 131 TO '/tdxdbd1/PROJ4/data/a_txn_ind19.dbf';
SET NEWNAME FOR DATAFILE 132 TO '/tdxdbd1/PROJ4/data/a_txn_ind18.dbf';
SET NEWNAME FOR DATAFILE 133 TO '/tdxdbd1/PROJ4/data/a_txn_ind17.dbf';
SET NEWNAME FOR DATAFILE 134 TO '/tdxdbd1/PROJ4/data/a_txn_ind16.dbf';
SET NEWNAME FOR DATAFILE 135 TO '/tdxdbd1/PROJ4/data/a_txn_ind15.dbf';
SET NEWNAME FOR DATAFILE 136 TO '/tdxdbd1/PROJ4/data/a_txn_ind13.dbf';
SET NEWNAME FOR DATAFILE 137 TO '/tdxdbd1/PROJ4/data/a_txn_ind12.dbf';
SET NEWNAME FOR DATAFILE 138 TO '/tdxdbd1/PROJ4/data/a_txn_ind11.dbf';
SET NEWNAME FOR DATAFILE 139 TO '/tdxdbd1/PROJ4/data/a_txn_ind10.dbf';
SET NEWNAME FOR DATAFILE 140 TO '/tdxdbd1/PROJ4/data/a_txn_ind09.dbf';
....
....
....
SET NEWNAME FOR TEMPFILE '/prddbd/PRD/data/temp01.dbf' TO '/bu/PROJ4/data/temp01.dbf';
SET NEWNAME FOR TEMPFILE '/prddbd/PRD/data/temp02.dbf' TO '/bu/PROJ4/data/temp02.dbf';
SET NEWNAME FOR TEMPFILE '/prddbd/PRD/data/temp03.dbf' TO '/bu/PROJ4/data/temp03.dbf';
DUPLICATE DATABASE TO PROJ4 BACKUP LOCATION '/bu/PRD_BKP'
LOGFILE
GROUP 1 (
'/sanddata/PROJ4/data/log1a.dbf',
'/sanddata/PROJ4/data/log1b.dbf'
) SIZE 125M,
GROUP 2 (
'/sanddata/PROJ4/data/log2a.dbf',
'/sanddata/PROJ4/data/log2b.dbf'
) SIZE 125M,
GROUP 3 (
'/sanddata/PROJ4/data/log3a.dbf',
'/sanddata/PROJ4/data/log3b.dbf'
) SIZE 125M,
GROUP 4 (
'/sanddata/PROJ4/data/log4a.dbf',
'/sanddata/PROJ4/data/log4b.dbf'
) SIZE 125M,
GROUP 5 (
'/sanddata/PROJ4/data/log5a.dbf',
'/sanddata/PROJ4/data/log5b.dbf'
) SIZE 125M
;
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
release channel ch5;
release channel ch6;
release channel ch7;
}
host "echo Recovery_endttime";
host "date '+%Y/%m/%d @ %H:%M:%S'";
EOF
8. Check the status of the database with the below commands,
SQL> select distinct status from v$datafile;
STATUS
-------
ONLINE
SYSTEM
SQL> select distinct status from dba_data_files;
STATUS
---------
AVAILABLE
SQL> select * from V$RECOVER_FILE;
no rows selected
9. Drop and recreate the TEMP tablespace,
SQL> DROP TABLESPACE TEMP2 including contents and datafiles;
Tablespace dropped.
SQL> DROP TABLESPACE PRD_IAS_TEMP including contents and datafiles;
Tablespace dropped.
CREATE TEMPORARY TABLESPACE TEMP1 TEMPFILE '/sanddata/PROJ4/data/temp1_01.dbf' SIZE 2048M,'/sanddata/PROJ4/data/temp1_02.dbf' SIZE 2048M,'/sanddata/PROJ4/data/temp1_03.dbf' SIZE 2048M autoextend off;
10. Disable Archive for Non-Prod instances
SQL> startup mount;
ORACLE instance started.
Total System Global Area 8551575552 bytes
Fixed Size 2245480 bytes
Variable Size 620760216 bytes
Database Buffers 7902068736 bytes
Redo Buffers 26501120 bytes
Database mounted.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /tdxdbd1/PROJ4/data/archive
Oldest online log sequence 1
Next log sequence to archive 1
Current log sequence 1
SQL> alter database noarchivelog;
Database altered.
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /tdxdbd1/PROJ4/data/archive
Oldest online log sequence 1
Current log sequence 1
SQL> alter database open;
Database altered.
11. Clean up FND_CONC_CLONE
SQL> conn apps
Enter password:
Connected.
SQL> exec fnd_conc_clone.setup_clean;
PL/SQL procedure successfully completed.
SQL> commit;
Commit complete.
12. Check oraInventory and point to the exact location
-bash-3.2$ grep PROJ4 /etc/oraInst.loc | grep -v '#'
inventory_loc=/tdxdbb1/PROJ4/oraInventory
13. Update library files
SQL> @$ORACLE_HOME/appsutil/install/$CONTEXT_NAME/adupdlib.sql so;
PL/SQL procedure successfully completed.
SQL> commit;
Commit complete.
14. Run Autoconfig on DB node
-bash-3.2$ sh adautocfg.sh
Enter the APPS user password:
The log file for this session is located at: /tdxdbb1/PROJ4/db_1/appsutil/log/PROJ4_aord1rkd001/02130547/adconfig.log
AutoConfig is configuring the Database environment...
AutoConfig will consider the custom templates if present.
Using ORACLE_HOME location : /tdxdbb1/PROJ4/db_1
Classpath : :/tdxdbb1/PROJ4/db_1/jdbc/lib/ojdbc5.jar:/tdxdbb1/PROJ4/db_1/appsutil/java/xmlparserv2.jar:/tdxdbb1/PROJ4/db_1/appsutil/java:/tdxdbb1/PROJ4/db_1/jlib/netcfg.jar:/tdxdbb1/PROJ4/db_1/jlib/ldapjclnt11.jar
Using Context file : /tdxdbb1/PROJ4/db_1/appsutil/PROJ4_aord1rkd001.xml
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 db112
Updating rdbms type in Context file to 64 bits
Configuring templates from ORACLE_HOME ...
AutoConfig completed successfully.
Database clone completed succesfully
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Application Clone
15. Backup/Remove the old app binaries and untar the backup tar file.
-bash-3.2$ pwd
/r12uat1app/PROJ4
-bash-3.2$ ls -ltr
total 63748
drwxr-xr-x 4 applsit dba 4096 Jul 8 2015 apps_bkp
-rw------- 1 applsit dba 65004216 Nov 25 11:00 nohup.out
drwxr-xr-x 4 applsit dba 4096 Nov 30 20:12 inst_bkp
-bash-3.2$ nohup tar -xvzf /bu/PRD_APPS_BKP/prdapps021217.tar.gz &
[1] 21538
-bash-3.2$ nohup: appending output to `nohup.out'
[1]+ Done nohup tar -xvzf /bu/PRD_APPS_BKP/prdapps021217.tar.gz
You have new mail in /var/spool/mail/applsit
16. Configure Target application
/r12uat1app/PROJ4/apps/apps_st/comn/clone/bin
-bash-3.2$ ls -ltr
total 148
-rwxr-xr-x 1 applsit dba 55747 Feb 14 2015 adclone.pl
-rwxr-xr-x 1 applsit dba 27277 Feb 14 2015 adclonectx.pl
-rwxr-xr-x 1 applsit dba 5108 Feb 14 2015 adchkutl.sh
-rwxr-xr-x 1 applsit dba 33401 Feb 14 2015 adcfgclone.pl
-rwxr-xr-x 1 applsit dba 7413 Feb 14 2015 adaddnode.pl
-bash-3.2$ perl adcfgclone.pl appsTier /opt/home/applsit/CLONE_SAVE/PROJ4/PROJ4_acod1rka001.xml
Do you want to startup the Application Services for DEVM? (y/n) [y] : N
Soon after you run rapidclone at application tier. Bring down the APPS services.
17. Post Directory Creation Steps
• Create directory /share_R12_dev/<TARGET_INSTANCE_NAME>/appl and APPLPTMP directory
E.g.
mkdir –p /share_R12_dev/ATLASDEV/appl
mkdir –p /share_R12_dev/ATLASDEV/ATLASDEV_TEMP
chmod 777 /share_R12_dev/ATLASDEV/ATLASDEV_TEMP
• Copy all the custom top folders from target application $APPL_TOP/xx* to /share_R12_dev/ATLASDEV/appl
• Create custom top data directory structure on target server
On PRD/Source Instance
cd $APPL_TOP
find xx*/12.0.0/data -type d -print | while read line; do echo "mkdir -p '${line}'"; done
On Target Application server : From the above output, create a script and run in /share_R12_dev/<TARGET_INSTANCE_NAME>/appl
cd /share_R12_dev/<TARGET_INSTANCE_NAME>/appl
Execute above mkdir commands that gets generated on Target server
• Provide 777 permission on /share_R12_dev/<TARGET_INSTANCE_NAME>/appl/xx*/12.0.0/data
18. Apply 19127427 patch for coredump issue from 1932120.1 in target instance
19. POST CLONE AUTOMATION SCRIPT
Script to Change FND_USER password with default password after Cloning
function Change_fnd_user_password
{
cat /dev/null > password_failure.txt
sqlplus -s apps/appsdeve << EOF
set lines 300 pages 0 feedback off
spool fnd_user.lst
select 'FNDCPASS apps/appsdeve 0 Y system/systemdeve USER "'||USER_NAME||'" ChangeMe@123 || echo "Err while changing password for user - ' || user_name || '" >> password_failure.txt' from fnd_user where user_name not in ('APPSMGR','ASADMIN','INDUSTRY DATA','GUEST','SYSADMIN') and (user_name not like 'ORACLE%') and user_name not like 'APP%';
spool off;
EOF
#sed -e 1,+1d fnd_user.lst > fnd_user_2.lst
sh fnd_user.lst
if [ `wc -l password_failure.txt | awk '{print $1}'` -gt 0 ]
then
echo 'Following errors occured while changing Application User Passwords'
cat password_failure.txt
rm L*.log
else
echo "All the passwords of Application users got changed successfully to 'ChangeMe@123' "
rm L*.log
rm password_failure.txt
fi
}
Change_fnd_user_password
20. Post Clone validation steps
SQL> select name from v$database;
NAME
---------
SOLCONV
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
utl_file_dir string /share_R12_SOLCONV/SOLCONV/SOLCONV
_TEMP, /tdxdbb4/SOLCONV/db_1/a
ppsutil/outbound/SOLCONV_bpuqq
rkd007, /usr/tmp
[oratdx4@bpuqqrkd007 SOLCONV_bpuqqrkd007]$ diff sqlnet.ora sqlnet.ora_bkp
13c13
< SQLNET.EXPIRE_TIME= 1
---
> SQLNET.EXPIRE_TIME= 10
20c20
< IFILE=/tdxdbb4/SOLCONV/db_1/network/admin/SOLCONV_bpuqqrkd007/sqlnet_ifile.ora
---
> IFILE=/tdxdbb4/SOLCONV/db_1/network/admin/SOLCONV_bpuqqrkd007/sqlnet_ifile.ora
\ No newline at end of file
[appltdx4@bpuqqrkd007 SOLCONV_TEMP]$ echo $APPLPTMP
/share_R12_SOLCONV/SOLCONV/SOLCONV_TEMP
[appltdx4@bpuqqrkd007 SOLCONV_TEMP]$ echo $APPLTMP
/share_R12_SOLCONV/SOLCONV/SOLCONV_TEMP
[appltdx4@bpuqqrkd007 SOLCONV_TEMP]$ cd $XXAP_TOP
[appltdx4@bpuqqrkd007 12.0.0]$ ls -tr
sql log patches ldt oldsql admin mesg out forms ddl wf INVUPL_VERCUITY032514.dat reports data bin
[appltdx4@bpuqqrkd007 12.0.0]$ cd data/
[appltdx4@bpuqqrkd007 data]$ ls -ltr
total 36
drwxrwxrwx 2 appltdx4 appid 4096 Feb 1 05:52 error
drwxrwxrwx 11 appltdx4 appid 4096 Feb 1 05:52 inbound
drwxrwxrwx 2 appltdx4 appid 4096 Feb 1 05:52 ESS_DATAFILES
drwxrwxrwx 2 appltdx4 appid 4096 Feb 1 05:52 processed
drwxrwxrwx 3 appltdx4 appid 4096 Feb 1 05:52 invoices
drwxrwxrwx 4 appltdx4 appid 4096 Feb 1 05:52 outbound
drwxrwxrwx 2 appltdx4 appid 4096 Feb 1 05:52 suppliers
drwxrwxrwx 2 appltdx4 appid 4096 Feb 1 05:52 archive_outbound
drwxrwxrwx 2 appltdx4 appid 4096 Feb 1 05:52 archive_processed
Active user concurrent request no. : 30076875
No comments:
Post a Comment