Table of Contents
Cloning E-Business Suite
Topology
db_host
|
!-> RDBMS ORACLE_HOME
apps_host
|
!-> Tools ORACLE_HOME
|
!-> Web ORACLE_HOME
|
!-> inst
Cloning EBS 12.1.3 - Rough notes until I get it done right
- Apply the latest AD patch - 23569686:R12.AD.B.delta.8
- Apply the latest AutoConfig template patch - Doc ID 387859.1 –> Latest TXK Release Update Pack –> Patch 27135427
- Apply the latest Rapid Clone patches - 27102203:R12.OAM.B
Check disk space for clone is sufficient
If we are refreshing an existing clone, the chances are that there is already enough space.
du -gs <source datafile filesystem> A
du -gs <destination datafile filesystem> B df -g <destination datafile filesystem> (find space remaining) C
Space remaining after clone on destination is : (B+C)-A
If this is positive, there will be enough space.
Outline of the procedure
Section 1 - Pre-requisites (on source servers)
Store a copy of the context file
Apply patches
Run AutoConfig on Apps Tier
cd $ADMIN_SCRIPTS_HOME
./adautocfg.sh
cd $AD_TOP/bin
./admkappsutil.pl
Copy appsutil.zip to $ORACLE_HOME on Database Tier
Run AutoConfig on Database Tier
cd $ORACLE_HOME
unzip -o appsutil.zip
cd appsutil/scripts/$CONTEXT_NAME
./adautocfg.sh
Preclone the Database Tier
cd $ORACLE_HOME/appsutil/scripts/$CONTEXT_NAME
perl adpreclone.pl dbTier
Creates directory $ORACLE_HOME/appsutil/clone
Gathers database information
Creates adcrdbclone.sql
Preclone the Apps Tier
cd $INST_TOP/admin/scripts (aka $ADMIN_SCRIPTS_HOME)
perl adpreclone.pl appsTier
Creates directory $COMMON_TOP/clone
Section 2 - Copy files
Database Tier
Store a copy of the context file
Copy $ORACLE_HOME from Source
RMAN restore the database
Apps Tier
Store a copy of the context file
Copy $APPL_TOP from Source
Copy $COMMON_TOP from Source
Copy Tools $ORACLE_HOME from Source
Copy Web $ORACLE_HOME from Source
Section3 - Configure Destination
Database Tier
Restore the context file
cd $ORACLE_HOME/appsutil/clone/bin
perl adcfgclone.pl dbTier $CONTEXT_FILE
Creates a context file if not supplied
Registers the Oracle Home
Relinks the Oracle Home
Configures the Oracle Home
Recreates the controlfile (use dbConfig instead of dbTier to skip this step)
Configures the database
Starts the listener
Apps Tier
Restore the context file
cd $COMMON_TOP/clone/bin
perl adcfgclone.pl appsTier $CONTEXT_FILE
Creates a context file if not supplied
Registers the Oracle Homes
Relinks the Oracle Homes
Configures the Oracle Homes
Creates $INST_TOP
Configures $APPL_TOP
Starts the Apps processes
Is patch already applied?
This will work in 12.1 onwards
select decode(ad_patch.is_patch_applied('&&ebs_release',&&appltop_id,&patch_num),'EXPLICIT','APPLIED','NOT_APPLIED','NOT APPLIED') from dual;
Enter value for ebs_release: R12
Enter value for appltop_id: -1
Enter value for patch_num: 23569686
old 1: select decode(ad_patch.is_patch_applied('&&ebs_release',&&appltop_id,&patch_num),'EXPLICIT','APPLIED','NOT_APPLIED','NOT APPLIED') from dual
new 1: select decode(ad_patch.is_patch_applied('R12',-1,23569686),'EXPLICIT','APPLIED','NOT_APPLIED','NOT APPLIED') from dual
DECODE(AD_P
-----------
APPLIED
can also try (lower than 12.2)
col patch_name for a20
select applied_patch_id
, rapid_installed_flag
, patch_name
, patch_type
, source_code
, creation_date
, last_update_date
, imported_flag
, data_model_done_flag
from ad_applied_patches
where patch_name in ('23569686','27135427','27102203') order by 1
/
Apply latest patches to source environment (if not already applied)
Unzip the following 3 patches into their own directories
- p23569686_R12.AD.B_DELTA.8_LINUX.zip
- p27135427_R12.TXK.B_R12_GENERIC.zip
- p27102203_R12.OAM.B_R12_GENERIC.zip
Run admsi.pl to get tailored instructions
Not very useful really. Just as easy to read the README
cd /appli/Patches/23569686/23569686 admsi.pl
Compare and run adgrants.sql
diff admin/adgrants.sql $APPL_TOP/admin/
Make sure the higher version is in $APPL_TOP/admin
Copy that version to the dataabse server…
scp $APPL_TOP/admin/adgrants.sql oraebsd@hn481:/cln/prg/ora_ebs/db12cR1/tech_st/12.1.0.2/appsutil/admin/
…and run it there
sqlplus / as sysdba @?/cln/prg/ora_ebs/db12cR1/tech_st/12.1.0.2/appsutil/admin/adgrants APPS
Shutdown the Apps
cd $ADMIN_SCRIPTS_HOME
read -p "Enter apps password [apps]: " appspwd
appspwd="${appspwd:-apps}"
./adstpall apps/"${appspwd}"
Start Maintenance Mode
read -p "Enter apps password [apps]: " appspwd
appspwd="${appspwd:-apps}"
sqlplus -s apps/"${appspwd}" @${AD_TOP}/patch/115/sql/adsetmmd.sql ENABLE
Apply the patches
adpatch
Run AutoConfig on the Apps Tier
$ADMIN_SCRIPTS_HOME/adautocfg.sh cd . ./setEBSD
Create the file appsutil.zip on the Apps Tier and copy it to the DB Tier
perl $AD_TOP/bin/admkappsutil.pl
scp /appli/EBSD/inst/apps/EBSD_hn5675/admin/out/appsutil.zip applebsd@hn5675:/cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2/ # ${ORACLE_HOME}
Unzip it on the DB Tier and run AutoConfig
cd . ./setEBSD cd $ORACLE_HOME unzip -o appsutil.zip
Rebuild templates
cd appsutil/bin perl ./adbldxml.pl appsuser=apps appspasswd=apps jtop=$ORACLE_HOME/jdk
./adconfig.sh contextfile="$CONTEXT_FILE"
make sure the soft link below is present on the destination system
ln -s /usr/lib/libgdbm.a /opt/freeware/libdb.a
Maintain Snapshot Information on the Apps Tier (seems to be optional)
adadmin
“Maintain Applications Files menu”, “Maintain snapshot information”, “Update current view snapshot”, “Update Complete APPL_TOP”
Now that the pre-requisites are done, we can proceed to “Section 2: Cloning Tasks” in this document:
Preclone DB Tier
cd
. setEBST
cd ${ORACLE_HOME}/appsutil/scripts
cd EBST_hn5114
perl ./adpreclone.pl dbTier
Preclone Apps
cd
. setEBST
cd ${ADMIN_SCRIPTS_HOME}
perl ./adpreclone.pl appsTier
Restore the destination database
Restore to the destination machine using RMAN (if cloning over an existing clone) or shutdown the source and copy the datafiles.
cd
cat <<EORMAN>dup_EBST_EBSTT1.rman
connect catalog rman/&RMAN_PWD@rman12d
connect target sys/&SYS_PWD@EBST
connect auxiliary /
run {
allocate auxiliary channel a0 type 'sbt_tape' parms 'SBT_LIBRARY=/opt/commvault/Base/libobk.a(shr.o),ENV=(cvsrcclientname=CI00031899-hn481)';
allocate auxiliary channel a1 type 'sbt_tape'
allocate auxiliary channel a2 type 'sbt_tape'
allocate auxiliary channel a3 type 'sbt_tape'
allocate auxiliary channel a4 type 'sbt_tape'
allocate auxiliary channel a5 type 'sbt_tape'
allocate auxiliary channel a6 type 'sbt_tape'
allocate auxiliary channel a7 type 'sbt_tape'
allocate auxiliary channel a8 type 'sbt_tape'
allocate auxiliary channel a9 type 'sbt_tape'
set until time '2022-08-05 09:54:33';
duplicate target database to EBSTT1;
}
EORMAN
nohup rman cmdfile=dup_EBST_EBSTT1.rman log=$HOME/dup_EBST_EBSTT1_$(date '+%Y%m%d%H%M').log &
Copy DB Tier ORACLE_HOME
Can tar up the ORACLE_HOME and scp it or like this. Both work.
ssh oraebst@hn481 "cd /cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2 && tar -cf - . | gzip " | ( cd /cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2 && gunzip -c | tar -xvf - . ) | tee $HOME/cpDB_apps.log
Copy Apps Tier APPL_TOP and COMN_TOP
ssh applebst@hn5623 "cd /appli/EBST/apps && tar -cf - . | gzip " | ( cd /appli/EBSTT1/apps && gunzip -c | tar -xvf - . ) > $HOME/cpMiddle_apps.log
Configure the DB Tier
cd $ORACLE_HOME/appsutil/clone/bin export ORACLE_HOME=/cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2 export PATH=$ORACLE_HOME/perl/bin:$ORACLE_HOME/bin:$PATH export ORACLE_SID=EBSTT1 export PERL5LIB=$ORACLE_HOME/perl/lib/5.14.4:$ORACLE_HOME/perl/site_perl/5.14.4:$ORACLE_HOME/appsutil/perl perl adcfgclone.pl dbTier # or dbConfig to skip rebuild of controlfile (if db restored from RMAN)
Copyright (c) 2002 Oracle Corporation
Redwood Shores, California, USA
Oracle Applications Rapid Clone
Version 12.0.0
adcfgclone Version 120.31.12010000.15
Enter the APPS password :
Running:
/cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone/bin/../jre/bin/java -Xmx600M -cp /cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone/jlib/java:/cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone/jlib/xmlparserv2.jar:/cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone/jlib/ojdbc6.jar oracle.apps.ad.context.CloneContext -e /cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone/bin/../context/db/CTXORIG.xml -validate -pairsfile /tmp/adpairsfile_2359840.lst -stage /cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone 2> /tmp/adcfgclone_2359840.err; echo $? > /tmp/adcfgclone_2359840.res
Log file located at /cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone/bin/CloneContext_0809113217.log
Provide the values required for creation of the new Database Context file.
Target System Hostname (virtual or normal) [hn5122] :
Target Instance is RAC (y/n) [n] :
Target System Database SID : EBSTT1
Target System Base Directory : /cln/tst/ora_ebstt1
Target System utl_file_dir Directory List : /tmp
Number of DATA_TOP's on the Target System [1] :
Target System DATA_TOP Directory 1 [/cln/tst/ora_ebst/db/apps_st/data] : /cln/tst/ora_ebstt1/db/apps_st/data
Target System RDBMS ORACLE_HOME Directory [/cln/tst/ora_ebstt1/db/tech_st/12.1.0] : /cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/
Do you want to preserve the Display [localhost:10.0] (y/n) : y
Do you want the the target system to have the same port values as the source system (y/n) [y] ? : n
Target System Port Pool [0-99] : 1
Checking the port pool 1
done: Port Pool 1 is free
Report file located at /cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/temp/portpool.lst
Complete port information available at /cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/temp/portpool.lst
Creating the new Database Context file from :
/cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/template/adxdbctx.tmp
The new database context file has been created :
/cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/EBSTT1_hn5122.xml
Log file located at /cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone/bin/CloneContext_0809113217.log
Check Clone Context logfile /cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone/bin/CloneContext_0809113217.log for details.
Running Rapid Clone with command:
perl /cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone/bin/adclone.pl java=/cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone/bin/../jre mode=apply stage=/cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone component=dbTier method=CUSTOM dbctxtg=/cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/EBSTT1_hn5122.xml showProgress contextValidated=true noprompt
Running:
perl /cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone/bin/adclone.pl java=/cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone/bin/../jre mode=apply stage=/cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone component=dbTier method=CUSTOM dbctxtg=/cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/EBSTT1_hn5122.xml showProgress contextValidated=true noprompt
APPS Password :
Setting LIBPATH to /cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone/oui/lib/aix
Beginning database tier Apply - Tue Aug 9 11:35:56 2022
/cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone/bin/../jre/bin/java -Xmx600M -DCONTEXT_VALIDATED=true -Doracle.installer.oui_loc=/cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/oui -classpath /cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone/jlib/xmlparserv2.jar:/cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone/jlib/ojdbc6.jar:/cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone/jlib/java:/cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone/jlib/oui/OraInstaller.jar:/cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone/jlib/oui/ewt3.jar:/cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone/jlib/oui/share.jar:/cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone/jlib/oui/srvm.jar:/cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone/jlib/ojmisc.jar oracle.apps.ad.clone.ApplyDBTier -e /cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/EBSTT1_hn5122.xml -stage /cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/clone -showProgress
APPS Password : Log file located at /cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/log/EBSTT1_hn5122/ApplyDBTier_08091135.log
Errors during DB Tier adcfgclone
Running Rapid Clone with command: perl /cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2/appsutil/clone/bin/adclone.pl java=/cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2/appsutil/clone/bin/../jre mode=apply stage=/cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2/appsutil/clone component=dbTier method=CUSTOM dbctxtg=/cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2/appsutil/clone/context/db/EBST_hn481.xml showProgress contextValidated=true Running: perl /cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2/appsutil/clone/bin/adclone.pl java=/cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2/appsutil/clone/bin/../jre mode=apply stage=/cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2/appsutil/clone component=dbTier method=CUSTOM dbctxtg=/cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2/appsutil/clone/context/db/EBST_hn481.xml showProgress contextValidated=true APPS Password : Setting LIBPATH to /cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2/appsutil/clone/oui/lib/aix Beginning database tier Apply - Thu Dec 29 14:15:14 2022 /cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2/appsutil/clone/bin/../jre/bin/java -Xmx600M -DCONTEXT_VALIDATED=true -Doracle.installer.oui_loc=/cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2/oui -classpath /cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2/appsutil/clone/jlib/xmlparserv2.jar:/cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2/appsutil/clone/jlib/ojdbc6.jar:/cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2/appsutil/clone/jlib/java:/cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2/appsutil/clone/jlib/oui/OraInstaller.jar:/cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2/appsutil/clone/jlib/oui/ewt3.jar:/cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2/appsutil/clone/jlib/oui/share.jar:/cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2/appsutil/clone/jlib/oui/srvm.jar:/cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2/appsutil/clone/jlib/ojmisc.jar oracle.apps.ad.clone.ApplyDBTier -e /cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2/appsutil/clone/context/db/EBST_hn481.xml -stage /cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2/appsutil/clone -showProgress APPS Password : Log file located at /cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2/appsutil/log/EBST_hn481/ApplyDBTier_12291415.log / 50% completed RC-50004: Fatal: Error occurred in ApplyDatabase: Control file creation failed ERROR while running Apply... Thu Dec 29 14:22:50 2022 ERROR: Failed to execute /cln/tst/ora_ebst/db12cR1/tech_st/12.1.0.2/appsutil/clone/bin/adclone.pl Please check logfile.
Ensure PATH and PERL5LIB variables are set correctly. Especially that PERL5LIB directories, if already mentioned in the variable, actually exist! They may mention a different version!
This can be fixed by editing the template to reflect the versions of the Perl libraries that are actually on the servers.
Configure the Apps Tier
cd $COMMON_TOP/clone/bin perl adcfgclone.pl appsTier
Copyright (c) 2002 Oracle Corporation
Redwood Shores, California, USA
Oracle Applications Rapid Clone
Version 12.0.0
adcfgclone Version 120.31.12010000.15
Enter the APPS password :
Running:
/appli/EBSTT1/apps/apps_st/comn/clone/bin/../jre/bin/java -Xmx600M -cp /appli/EBSTT1/apps/apps_st/comn/clone/jlib/java:/appli/EBSTT1/apps/apps_st/comn/clone/jlib/xmlparserv2.jar:/appli/EBSTT1/apps/apps_st/comn/clone/jlib/ojdbc14.jar oracle.apps.ad.context.CloneContext -e /appli/EBSTT1/apps/apps_st/comn/clone/bin/../context/apps/CTXORIG.xml -validate -pairsfile /tmp/adpairsfile_12883.lst -stage /appli/EBSTT1/apps/apps_st/comn/clone 2> /tmp/adcfgclone_12883.err; echo $? > /tmp/adcfgclone_12883.res
Log file located at /appli/EBSTT1/apps/apps_st/comn/clone/bin/CloneContext_0809115350.log
Provide the values required for creation of the new APPL_TOP Context file.
Target System Hostname (virtual or normal) [hn5838] :
Target System Database SID : EBSTT1
Target System Database Server Node [hn5838] : hn5122
Target System Database Domain Name [cln.be] :
Target System Base Directory : /appli/EBSTT1
Target System Tools ORACLE_HOME Directory [/appli/EBSTT1/apps/tech_st/10.1.2] :
Target System Web ORACLE_HOME Directory [/appli/EBSTT1/apps/tech_st/10.1.3] :
Target System APPL_TOP Directory [/appli/EBSTT1/apps/apps_st/appl] :
Target System COMMON_TOP Directory [/appli/EBSTT1/apps/apps_st/comn] :
Target System Instance Home Directory [/appli/EBSTT1/inst] :
Target System Root Service [enabled] :
Target System Web Entry Point Services [enabled] :
Target System Web Application Services [enabled] :
Target System Batch Processing Services [enabled] :
Target System Other Services [disabled] :
Do you want to preserve the Display [hn5623:0.0] (y/n) : y
Do you want the the target system to have the same port values as the source system (y/n) [y] ? : n
Target System Port Pool [0-99] : 1
Checking the port pool 1
done: Port Pool 1 is free
Report file located at /appli/EBSTT1/inst/apps/EBSTT1_hn5838/admin/out/portpool.lst
Complete port information available at /appli/EBSTT1/inst/apps/EBSTT1_hn5838/admin/out/portpool.lst
UTL_FILE_DIR on database tier consists of the following directories.
1. /usr/tmp
2. /tmp
3. /cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/appsutil/outbound/EBSTT1_hn5122
4. /usr/tmp
Choose a value which will be set as APPLPTMP value on the target node [1] : 1
Creating the new APPL_TOP Context file from :
/appli/EBSTT1/apps/apps_st/appl/ad/12.0.0/admin/template/adxmlctx.tmp
The new APPL_TOP context file has been created :
/appli/EBSTT1/inst/apps/EBSTT1_hn5838/appl/admin/EBSTT1_hn5838.xml
Log file located at /appli/EBSTT1/apps/apps_st/comn/clone/bin/CloneContext_0809115350.log
Check Clone Context logfile /appli/EBSTT1/apps/apps_st/comn/clone/bin/CloneContext_0809115350.log for details.
Running Rapid Clone with command:
perl /appli/EBSTT1/apps/apps_st/comn/clone/bin/adclone.pl java=/appli/EBSTT1/apps/apps_st/comn/clone/bin/../jre mode=apply stage=/appli/EBSTT1/apps/apps_st/comn/clone component=appsTier method=CUSTOM appctxtg=/appli/EBSTT1/inst/apps/EBSTT1_hn5838/appl/admin/EBSTT1_hn5838.xml showProgress contextValidated=true noprompt
Running:
perl /appli/EBSTT1/apps/apps_st/comn/clone/bin/adclone.pl java=/appli/EBSTT1/apps/apps_st/comn/clone/bin/../jre mode=apply stage=/appli/EBSTT1/apps/apps_st/comn/clone component=appsTier method=CUSTOM appctxtg=/appli/EBSTT1/inst/apps/EBSTT1_hn5838/appl/admin/EBSTT1_hn5838.xml showProgress contextValidated=true noprompt
APPS Password :
Beginning application tier Apply - Tue Aug 9 11:56:45 2022
/appli/EBSTT1/apps/apps_st/comn/clone/bin/../jre/bin/java -Xmx600M -DCONTEXT_VALIDATED=true -Doracle.installer.oui_loc=/oui -classpath /appli/EBSTT1/apps/apps_st/comn/clone/jlib/xmlparserv2.jar:/appli/EBSTT1/apps/apps_st/comn/clone/jlib/ojdbc14.jar:/appli/EBSTT1/apps/apps_st/comn/clone/jlib/java:/appli/EBSTT1/apps/apps_st/comn/clone/jlib/oui/OraInstaller.jar:/appli/EBSTT1/apps/apps_st/comn/clone/jlib/oui/ewt3.jar:/appli/EBSTT1/apps/apps_st/comn/clone/jlib/oui/share.jar:/appli/EBSTT1/apps/apps_st/comn/clone/jlib/oui/srvm.jar:/appli/EBSTT1/apps/apps_st/comn/clone/jlib/ojmisc.jar oracle.apps.ad.clone.ApplyAppsTier -e /appli/EBSTT1/inst/apps/EBSTT1_hn5838/appl/admin/EBSTT1_hn5838.xml -stage /appli/EBSTT1/apps/apps_st/comn/clone -showProgress
APPS Password : Log file located at /appli/EBSTT1/inst/apps/EBSTT1_hn5838/admin/log/ApplyAppsTier_08091156.log
/ 78% completed
Completed Apply...
Tue Aug 9 12:00:21 2022
Do you want to startup the Application Services for EBSTT1? (y/n) [y] :
Starting application Services for EBSTT1:
Errors starting the Apps Tier
Status 204 when starting core and forms processes
/appli/EBST/inst/apps/EBST_hn5623/admin/scripts/adopmnctl.sh start script returned: **************************************************** You are running adopmnctl.sh version 120.6.12010000.5 Starting Oracle Process Manager (OPMN) ... opmnctl: opmn started. adopmnctl.sh: exiting with status 0 adopmnctl.sh: check the logfile /appli/EBST/inst/apps/EBST_hn5623/logs/appl/admin/log/adopmnctl.txt for more information ... .end std out. .end err out. **************************************************** Executing service control script: /appli/EBST/inst/apps/EBST_hn5623/admin/scripts/adalnctl.sh start script returned: **************************************************** adalnctl.sh version 120.3 Checking for FNDFS executable. Starting listener process APPS_EBST. adalnctl.sh: exiting with status 0 adalnctl.sh: check the logfile /appli/EBST/inst/apps/EBST_hn5623/logs/appl/admin/log/adalnctl.txt for more information ... .end std out. .end err out. **************************************************** Executing service control script: /appli/EBST/inst/apps/EBST_hn5623/admin/scripts/adapcctl.sh start script returned: **************************************************** You are running adapcctl.sh version 120.7.12010000.2 Starting OPMN managed Oracle HTTP Server (OHS) instance ... opmnctl: opmn is already running. opmnctl: starting opmn managed processes... adapcctl.sh: exiting with status 0 adapcctl.sh: check the logfile /appli/EBST/inst/apps/EBST_hn5623/logs/appl/admin/log/adapcctl.txt for more information ... .end std out. .end err out. **************************************************** Executing service control script: /appli/EBST/inst/apps/EBST_hn5623/admin/scripts/adoacorectl.sh start script returned: **************************************************** You are running adoacorectl.sh version 120.13 Starting OPMN managed OACORE OC4J instance ... adoacorectl.sh: exiting with status 204 adoacorectl.sh: check the logfile /appli/EBST/inst/apps/EBST_hn5623/logs/appl/admin/log/adoacorectl.txt for more information ... .end std out. .end err out. **************************************************** Executing service control script: /appli/EBST/inst/apps/EBST_hn5623/admin/scripts/adformsctl.sh start script returned: **************************************************** You are running adformsctl.sh version 120.16.12010000.3 Starting OPMN managed FORMS OC4J instance ... Calling txkChkFormsDeployment.pl to check whether latest FORMSAPP.EAR is deployed... Program : /appli/EBST/apps/apps_st/appl/fnd/12.0.0/patch/115/bin/txkChkFormsDeployment.pl started @ Wed Jan 11 11:38:27 2023 *** Log File = /appli/EBST/inst/apps/EBST_hn5623/logs/appl/rgf/TXK/txkChkFormsDeployment_Wed_Jan_11_11_38_27_2023/txkChkFormsDeployment_Wed_Jan_11_11_38_27_2023.log File "/appli/EBST/apps/tech_st/10.1.3/j2ee/forms/applications/forms/formsweb/WEB-INF/lib/frmsrv.jar" exists. Proceeding to check the size... ============================================= *** Latest formsapp.ear has been deployed *** ============================================= Program : /appli/EBST/apps/apps_st/appl/fnd/12.0.0/patch/115/bin/txkChkFormsDeployment.pl completed @ Wed Jan 11 11:38:27 2023 Perl script txkChkFormsDeployment.pl got executed successfully adformsctl.sh: exiting with status 204 adformsctl.sh: check the logfile /appli/EBST/inst/apps/EBST_hn5623/logs/appl/admin/log/adformsctl.txt for more information ... .end std out. *** ALL THE FOLLOWING FILES ARE REQUIRED FOR RESOLVING RUNTIME ERRORS *** Log File = /appli/EBST/inst/apps/EBST_hn5623/logs/appl/rgf/TXK/txkChkFormsDeployment_Wed_Jan_11_11_38_27_2023/txkChkFormsDeployment_Wed_Jan_11_11_38_27_2023.log .end err out. **************************************************** Executing service control script: /appli/EBST/inst/apps/EBST_hn5623/admin/scripts/adoafmctl.sh start script returned: **************************************************** You are running adoafmctl.sh version 120.8 Starting OPMN managed OAFM OC4J instance ... adoafmctl.sh: exiting with status 204 adoafmctl.sh: check the logfile /appli/EBST/inst/apps/EBST_hn5623/logs/appl/admin/log/adoafmctl.txt for more information ... .end std out. .end err out. **************************************************** Executing service control script: /appli/EBST/inst/apps/EBST_hn5623/admin/scripts/adcmctl.sh start script returned: **************************************************** You are running adcmctl.sh version 120.17.12010000.5 Starting concurrent manager for EBST ... Starting EBST_0111@EBST Internal Concurrent Manager Default printer is noprint adcmctl.sh: exiting with status 0 adcmctl.sh: check the logfile /appli/EBST/inst/apps/EBST_hn5623/logs/appl/admin/log/adcmctl.txt for more information ... .end std out. .end err out. **************************************************** Executing service control script: /appli/EBST/inst/apps/EBST_hn5623/admin/scripts/jtffmctl.sh start script returned: **************************************************** You are running jtffmctl.sh version 120.3 Validating Fulfillment patch level via /appli/EBST/apps/apps_st/comn/java/classes Fulfillment patch level validated. Starting Fulfillment Server for EBST on port 9303 ... jtffmctl.sh: exiting with status 0 .end std out. .end err out. **************************************************** adstrtal.sh: Exiting with status 3 adstrtal.sh: check the logfile /appli/EBST/inst/apps/EBST_hn5623/logs/appl/admin/log/adstrtal.log for more information ...
Opening an SR with Oracle, the automation asks you to run the Clone Analyser
Please provide the following file(s): 1. EBS Cloning Analyzer: Please upload the EBS Cloning Analyzer output zip file (CLONEHA_<DATE>_<TIME>.zip) by using the LATEST version of the analyzer available in note E-Business Suite Cloning Analyzer ( Doc ID 2379649.1 ). This zip file will contain all the outputs, logs and files collected. Detailed instructions to run from the command-line are found in the Doc ID 2379649.1. 2. EBS Cloning DB Analyzer: Please upload the EBS Cloning Database Analyzer output zip-file by using the LATEST version of the analyzer available in note EBS Cloning Analyzer ( Doc ID 2379649.1 ). Detailed instructions to run from the command-line are found in the Doc ID 2379649.1.
Then they ask for this info:
1/ What Cloning document you followed ?
2/ Please run Clone Log Parser utility -- EBS Clone Log Parser Utility (Rapid Clone 11i,12.0, 12.1)[VIDEO] ( Doc ID 1447553.1 )
3/ Please return results for -- SQL> select instance_name, release_name, host_name, version from fnd_product_groups, v$instance;
SQL> select name, server_type from fnd_app_servers, fnd_nodes where fnd_app_servers.node_id = fnd_nodes.node_id and server_type in ('APPS','DB');
SQL> select abbreviation, codelevel from ad_trackable_entities where abbreviation in ('txk','ad');
Then they ask for the following files to check how the clone went:
A> From the SOURCE: adpreclone logs database tier: $ORACLE_HOME/appsutil/log/<SID_hostname>/StageDBTier_<timestamp>.log adpreclone logs Applications tier: $INST_TOP/admin/log/clone/StageAppsTier_<timestamp>.log B> From the DESTINATION: adcfgclone from destination database tier: $ORACLE_HOME/appsutil/clone/bin/CloneContext_*.log $ORACLE_HOME/appsutil/log/$CONTEXT_NAME/ApplyDBTier_*.log
Solution to status 204
Is seems the errors were due to the pre-upgrade steps having already been completed on the destination server followed by the request for a clone (from a still virgin Production server).
A context file from before the pre-upgrade was used and autoconfig run. Applications started successfully.
Java part of Application does not start up
Starting the Application works fine and all web forms are fine. Only when opening a java form (eg: View Requests), is an error shown: a dialog box suggesting a problem with “FNDSCSGN”.
To fix this, Edit the $CONTEXT_FILE, replace FND_TOP with the full path to ${FND_TOP} and run autoconfig. All good.
Find out the login page for the application
export CONTEXT_FILE=/appli/EBSTT1/inst/apps/EBSTT1_hn5838/appl/admin/EBSTT1_hn5838.xml
grep -i "login_page" $CONTEXT_FILE | awk -F ">" '{print $2}'| awk -F"<" '{print $1}'`
Perform a regular clone (over the top of an existing clone)
If no patches have been applied since the previous clone, a shortcut method will work…
USERNAME=oraebst1
HOSTNAME=hn5122
LISTENER_PORT=1522
PORT_POOL=1
SRC_CDB_SID="CDBEBSP"
CDB_SID="CDBEBST1"
PDB_SID="EBST1"
ORACLE_BASE="/cln/tst/ora_ebst1/dbtech"
ORACLE_HOME="${ORACLE_BASE}/product/oraDB19c/dbhome_1"
CONTEXT_FILE="${ORACLE_HOME}/appsutil/${PDB_SID}_${HOSTNAME}.xml"
DATA_HOME1="/cln/tst/ora_ebst1/db/apps_st/data"
DATA_HOME2="/cln/acc/ora_ebsa2/dbtech/oradata/CDBEBSA2"
SYSTEM_PWD="password"
RMAN_PWD="password"
PIT="2024-04-20 07:48:00"
FILE_SUFFIX="20240408"
SRC_APPS_PWD="password"
APPS_PWD="password"
# ----------------------
# login to the db server
# ----------------------
ssh "${USERNAME}"@"${HOSTNAME}"
alias ll='ls -bal'
# ------------------------------
# unlock the sys/system accounts
# ------------------------------
. "${ORACLE_HOME}/${CDB_SID}_${HOSTNAME}.env"
printf "%s\n%s\n" "alter user sys account unlock container=all;" "alter user system identified by ${SYSTEM_PWD} account unlock container=all;"|sqlplus -s "/ as sysdba"
# --------------------------------
# make a directory for the exports
# --------------------------------
mkdir -p "${HOME}/keep/exports"
echo "create or replace directory data_pump_dir as '${HOME}/keep/exports';"|sqlplus -s system/${SYSTEM_PWD}
echo "create or replace directory data_pump_dir_pdb as '${HOME}/keep/exports';"|sqlplus -s system/${SYSTEM_PWD}@${PDB_SID}
# check it worked
export DATA_PUMP_DIR=`sqlplus -s system/${SYSTEM_PWD}<<-'EOSQL'
whenever sqlerror exit failure
set lines 1000 headi off newpa none feedb off
select directory_path
from dba_directories
where directory_name = 'DATA_PUMP_DIR'
/
EOSQL
`
export DATA_PUMP_DIR_PDB=`sqlplus -s system/${SYSTEM_PWD}@${PDB_SID}<<-'EOSQL'
whenever sqlerror exit failure
set lines 1000 headi off newpa none feedb off
select directory_path
from dba_directories
where directory_name = 'DATA_PUMP_DIR_PDB'
/
EOSQL
`
echo "DATA_PUMP_DIR : ${DATA_PUMP_DIR}"
echo "DATA_PUMP_DIR_PDB : ${DATA_PUMP_DIR_PDB}"
# --------------------------
# export the CDB directories
# --------------------------
cd "${DATA_PUMP_DIR}"
FILENAME="dba_directories_dml_${CDB_SID}_${FILE_SUFFIX}"
sqlplus -s system/${SYSTEM_PWD}<<'EOSQL' >"${FILENAME}.sql"
whenever sqlerror exit failure
set headi off newpa none lines 1000 trims on feedb off
col stmt for a1000 head "-- Directory List"
select 'create or replace directory '||directory_name||' as '''||directory_path||''';' stmt from dba_directories;
EOSQL
# --------------------------
# export the PDB directories
# --------------------------
cd "${DATA_PUMP_DIR_PDB}"
FILENAME="dba_directories_dml_${PDB_SID}_${FILE_SUFFIX}"
sqlplus -s system/${SYSTEM_PWD}@${PDB_SID}<<'EOSQL' >"${FILENAME}.sql"
whenever sqlerror exit failure
set headi off newpa none lines 1000 trims on feedb off
col stmt for a1000 head "-- Directory List"
select 'create or replace directory '||directory_name||' as '''||directory_path||''';' stmt from dba_directories;
EOSQL
# -----------------------
# export the PDB db_links
# -----------------------
cd "${DATA_PUMP_DIR_PDB}"
FILENAME="dba_db_links_${PDB_SID}_${FILE_SUFFIX}"
cat<<EOCAT>expdp_dba_db_links.par
userid='system/${SYSTEM_PWD}@${PDB_SID}'
full=y
directory=DATA_PUMP_DIR_PDB
dumpfile=${FILENAME}.dmp
logfile=expdp_${FILENAME}.log
include=DB_LINK:"in(select db_link from dba_db_links)"
reuse_dumpfiles=y
EOCAT
expdp parfile=expdp_dba_db_links.par
# ----------------
# export PDB users # dont think this is necessary for EBS
# ----------------
cd "${DATA_PUMP_DIR_PDB}"
FILENAME="dba_users_${PDB_SID}_${FILE_SUFFIX}"
sqlplus -s system/${SYSTEM_PWD}@${PDB_SID}<<-'EOSQL' >"${FILENAME}.sql"
whenever sqlerror exit failure
set long 100000 longc 100000 pages 0 lines 1000 feed off verif off trims on head off
column ddl format a1000
begin
dbms_metadata.set_transform_param (dbms_metadata.session_transform, 'SQLTERMINATOR', true);
dbms_metadata.set_transform_param (dbms_metadata.session_transform, 'PRETTY', true);
end;
/
select regexp_replace(dbms_metadata.get_ddl (object_type => 'USER', name => u.username),'CREATE','ALTER', 1, 0, 'i') ddl
from dba_users u
where username not in ('PUBLIC', 'ANONYMOUS', 'XS$NULL')
and username not like 'OPS$%'
/
EOSQL
# ------------------------------
# Stop the database and listener
# ------------------------------
echo "shu abort"|sqlplus -s '/ as sysdba'
lsnrctl stop "${CDB_SID}"
# ----------------------------------
# Remove EBS home from the Inventory
# ----------------------------------
${ORACLE_HOME}/oui/bin/detachHome.sh
or
vi $(grep inventory_loc /etc/oraInst.loc|cut -d'=' -f2|perl -pe 's!$!/ContentsXML/inventory.xml!')
# --------------------------------
# copy the ORACLE_HOME from source
# --------------------------------
date > "$HOME/cp_dbtier.log"
ssh oraebsp@hn511 "cd /cln/exp/ora_ebsp/dbtech/product/oraDB19c/dbhome_1 && tar -cf - . | gzip " | ( cd "${ORACLE_HOME}" && gunzip -c | tar -xvf - . ) >>"$HOME/cp_dbtier.log"
date >> "$HOME/cp_dbtier.log"
# ------------------
# create a pairsfile
# ------------------
cat<<EOCAT>"${ORACLE_HOME}/appsutil/clone/pairsfile.txta"
s_base=${ORACLE_BASE}
s_cdb_name=${CDB_SID}
s_cmandomain=${DOMAIN}
s_dbCluster=false
s_dbSid=${PDB_SID}
s_db_oh=${ORACLE_HOME}
s_dbgroup=dba
s_dbhome1=${DATA_HOME1}
s_dbhome2=${DATA_HOME2}
s_dbhome3=${DATA_HOME1}
s_dbhome4=${DATA_HOME1}
s_dbhost=${HOSTNAME}
s_dbport=${LISTENER_PORT}
s_dbuser=${USERNAME}
s_display=localhost:12.0
s_isDBCluster=n
s_pdb_name=${PDB_SID}
s_port_pool=${PORT_POOL}
s_undo_tablespace=APPS_UNDOTS1
EOCAT
cd "${ORACLE_HOME}/appsutil/clone"
# --------------------------------------------------------
# create a contextfile based on the one from source system
# --------------------------------------------------------
# if not available, can build one with ${ORACLE_HOME}/appsutil/clone/bin/adbldxml.pl
# from doyensys: [oracle@ebs bin]$ perl adbldxml.pl appsuser=apps SRC_APPS_PWD=**** template=/u01/StageR122/PROD/12.1.0/appsutil/template/adxdbctx.tmp out=/u01/StageR122/PROD/12.1.0/appsutil/SID_host.xml
cd "${ORACLE_HOME}/perl/lib/"
for i in $(ls|grep '\.'); do
PERLVER="$i"
done
export PERL5LIB="${ORACLE_HOME}/perl/lib/${PERLVER}:${ORACLE_HOME}/perl/lib/site_perl/${PERLVER}:${ORACLE_HOME}/perl/lib:${ORACLE_HOME}/appsutil/perl"
which perl|grep '\/usr\/bin\/perl' >/dev/null
[[ "$?" -eq 0 ]] && export PATH="${ORACLE_HOME}/perl/bin:${PATH}"
which java|grep 'jdk\/jre\/bin' >/dev/null
[[ "$?" -ne 0 ]] && export PATH="${ORACLE_HOME}/jdk/jre/bin:${PATH}"
cd "${ORACLE_HOME}/appsutil/"
cp "${PDB_SID}_${HOSTNAME}.xml" "${HOME}/${PDB_SID}_${HOSTNAME}.xml.$(date +'%Y%m%d')"
echo "PERL5LIB: ${PERL5LIB}"
echo "PATH: ${PATH}"
echo "perl: $(which perl)"
cd "${ORACLE_HOME}/appsutil/clone/bin/"
echo "${SRC_APPS_PWD};"|perl ./adclonectx.pl contextfile="${ORACLE_HOME}/appsutil/EBSP_hn5118.xml" template="${ORACLE_HOME}/appsutil/template/adxdbctx.tmp" pairsfile="${ORACLE_HOME}/appsutil/clone/pairsfile.txt" noprompt # [noprompt] [retrieve]
========================================================================================
Copyright (c) 2002 Oracle Corporation
Redwood Shores, California, USA
Oracle E-Business Suite Rapid Clone
Version 12.0.0
adclonectx Version 120.23.12010000.4
Running:
./clone/bin/../jre/bin/java -Xmx600M -classpath ./clone/bin/../jlib/ojdbc8.jar:./clone/bin/../jlib/xmlparserv2.jar:./clone/bin/../jlib/java oracle.apps.ad.context.CloneContext -e /cln/tst/ora_ebst2/dbtech/product/oraDB19c/dbhome_1/appsutil/EBSP_hn5118.xml -tmpl /cln/tst/ora_ebst2/dbtech/product/oraDB19c/dbhome_1/appsutil/template/adxdbctx.tmp -pairsfile /cln/tst/ora_ebst2/dbtech/product/oraDB19c/dbhome_1/appsutil/clone/pairsfile.txt
Enter the APPS password : pnBHjUy#77768252h
Log file located at /cln/tst/ora_ebst2/dbtech/product/oraDB19c/dbhome_1/appsutil/CloneContext_0411200248.log
Provide the values required for creation of the new Database Context file.
Target System Hostname (virtual or normal) [hn5229] :
It is recommended that your inputs are validated by the program.
However you might choose not to validate them under following circumstances:
-If cloning a context on source system for a remote system.
-If cloning a context on a machine where the ports are taken and
you do not want to shutdown the services at this point.
-If cloning a context but the database it needs to connect is not available.
Do you want the inputs to be validated (y/n) [n] ? : y
Role separation is supported y/n [n] ? :
Specify value for OSBACKUPDBA group [dba] :
Specify value for OSDGDBA group [dba] :
Specify value for OSKMDBA group [dba] :
Specify value for OSRACDBA group [dba] :
Checking the port pool 3
done: Port Pool 3 is free
Report file located at /cln/tst/ora_ebst2/dbtech/product/oraDB19c/dbhome_1/appsutil/temp/portpool.lst
Complete port information available at /cln/tst/ora_ebst2/dbtech/product/oraDB19c/dbhome_1/appsutil/temp/portpool.lst
Backing up /cln/tst/ora_ebst2/dbtech/product/oraDB19c/dbhome_1/appsutil/EBST2_hn5229.xml to /cln/tst/ora_ebst2/dbtech/product/oraDB19c/dbhome_1/appsutil/EBST2_hn5229.xml0.bak
Creating the new Database Context file from :
/cln/tst/ora_ebst2/dbtech/product/oraDB19c/dbhome_1/appsutil/template/adxdbctx.tmp
The new database context file has been created :
/cln/tst/ora_ebst2/dbtech/product/oraDB19c/dbhome_1/appsutil/EBST2_hn5229.xml
Log file located at /cln/tst/ora_ebst2/dbtech/product/oraDB19c/dbhome_1/appsutil/CloneContext_0411200248.log
contextfile=/cln/tst/ora_ebst2/dbtech/product/oraDB19c/dbhome_1/appsutil/EBST2_hn5229.xml
========================================================================================
# if classpath error, make sure in appsutil/clone/bin directory, not appsutil/bin.
# ensure all the directories are pre-created before continuing
grep 's\_' "${ORACLE_HOME}/appsutil/${PDB_SID}_${HOSTNAME}.xml"|grep '\>\/'|grep -v dbhome_1
particularly grep outbound ${ORACLE_HOME}/appsutil/${PDB_SID}_${HOSTNAME}.xml
grep "s_perl5lib" "${ORACLE_HOME}/appsutil/${PDB_SID}_${HOSTNAME}.xml"
to ensure the libraries mentioned are the ones that exist. Change as necessary.
# -----------------------
# configure DB Tech Stack
# -----------------------
export ROOTPRE_EXECUTED=Y
echo "${PATH}"|grep 'perl\/bin' >/dev/null
[[ "$?" -ne 0 ]] && export PATH="${ORACLE_HOME}/perl/bin:${PATH}"
echo "${PATH}"|grep '\/usr\/vacpp\/bin' >/dev/null
[[ "$?" -ne 0 ]] && export PATH="/usr/vacpp/bin:${PATH}"
cd "${ORACLE_HOME}/appsutil/clone/bin"
export TEMP="${ORACLE_BASE}/temp/${PDB_SID}"
export TMP="${ORACLE_BASE}/temp/${PDB_SID}"
export TMPDIR="${ORACLE_BASE}/temp/${PDB_SID}"
echo "${SRC_APPS_PWD}"|perl adcfgclone.pl dbTechStack "${ORACLE_HOME}/appsutil/${PDB_SID}_${HOSTNAME}.xml"
# Fails after 5 mins for no obvious reason? ouicli.pl? Check the oraInventory logs in /cln/acc/ora_bin/app/oracle/oraInventory/logs/
# Also, Inventory entry must not already exist in inventory.xml!
# ----------------------------------------
# set the environment required for CDB+PDB
# ----------------------------------------
cd "${ORACLE_HOME}/appsutil"
. ./txkSetCfgCDB.env -dboraclehome="${ORACLE_HOME}"
# ---------------------------------------------------------------------------
# this next script will create new tns files so keep the old ones if required
# ---------------------------------------------------------------------------
cd "${ORACLE_HOME}/network/admin"
# remove the links
rm -rf *ora
# and any other old shit
cd "${ORACLE_HOME}/appsutil/bin"
perl txkGenCDBTnsAdmin.pl -dboraclehome="${ORACLE_HOME}" -cdbname=${CDB_SID} -cdbsid=${CDB_SID} -dbport="${LISTENER_PORT}" -outdir="${ORACLE_HOME}/appsutil/log" -israc=no
cd "${ORACLE_HOME}/network/admin"
# ---------------------------------
# start listener for the first time
# ---------------------------------
cd "${ORACLE_HOME}/appsutil/scripts/${PDB_SID}_${HOSTNAME}"
./adcdblnctl.sh start "${CDB_SID}"
# ------------------
# duplicate Database
# ------------------
Use RMAN to clone EBSP
# done with txkSetCfgCDB.env export LD_LIBRARY_PATH=$ORACLE_HOME/lib
# check these entries are in tnsnames.ora
CDBEBSP = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = hn511)(PORT = 1526)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = CDBEBSP)))
RMANCAT = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = hn511)(PORT = 3529)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = rmancat)))
. "${ORACLE_HOME}/${CDB_SID}_${HOSTNAME}.env" # sets ORACLE_SID
cd "${ORACLE_HOME}/dbs"
# rename spfile
# rm *EBSP* lk* hc* snap* spfile*
vi "init${CDB_SID}.ora"
check the convert parameters - properly
*.db_file_name_convert='/cln/exp/ora_ebsp/db/apps_st/data','/cln/acc/ora_ebsa2/db/apps_st/data'
*.db_file_name_convert='/cln/exp/ora_ebsp/dbtech/oradata/CDBEBSP','/cln/acc/ora_ebsa2/dbtech/oradata/CDBEBSA2'
*.log_file_name_convert='/cln/exp/ora_ebsp/db/apps_st/data','/cln/acc/ora_ebsa2/db/apps_st/data'
*.log_file_name_convert='/cln/exp/ora_ebsp/dbtech/oradata/CDBEBSP','/cln/acc/ora_ebsa2/dbtech/oradata/CDBEBSA2'
echo "startup force nomount pfile=init${CDB_SID}.ora"|sqlplus -s '/ as sysdba'
cd
cat<<EORMAN>dup_${SRC_CDB_SID}_${CDB_SID}.rman
connect catalog rman/"${RMAN_PWD}"@rmancat
connect auxiliary /
run {
allocate auxiliary channel t0 type 'sbt_tape' parms 'SBT_LIBRARY=/opt/commvault/Base64/libobk.a(shr.o)';
allocate auxiliary channel t1 type 'sbt_tape' parms 'SBT_LIBRARY=/opt/commvault/Base64/libobk.a(shr.o)';
allocate auxiliary channel t2 type 'sbt_tape' parms 'SBT_LIBRARY=/opt/commvault/Base64/libobk.a(shr.o)';
allocate auxiliary channel t3 type 'sbt_tape' parms 'SBT_LIBRARY=/opt/commvault/Base64/libobk.a(shr.o)';
allocate auxiliary channel t4 type 'sbt_tape' parms 'SBT_LIBRARY=/opt/commvault/Base64/libobk.a(shr.o)';
allocate auxiliary channel t5 type 'sbt_tape' parms 'SBT_LIBRARY=/opt/commvault/Base64/libobk.a(shr.o)';
allocate auxiliary channel t6 type 'sbt_tape' parms 'SBT_LIBRARY=/opt/commvault/Base64/libobk.a(shr.o)';
allocate auxiliary channel t7 type 'sbt_tape' parms 'SBT_LIBRARY=/opt/commvault/Base64/libobk.a(shr.o)';
set until time "to_date('${PIT}','YYYY-MM-DD HH24:MI:SS')";
duplicate database ${SRC_CDB_SID} dbid 3916989110 to ${CDB_SID} nofilenamecheck;
}
EORMAN
export NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"
date > "dup_${SRC_CDB_SID}_${CDB_SID}_${FILE_SUFFIX}.log"
nohup rman cmdfile="dup_${SRC_CDB_SID}_${CDB_SID}.rman" log="dup_${SRC_CDB_SID}_${CDB_SID}_${FILE_SUFFIX}.log" &
date >> "dup_${SRC_CDB_SID}_${CDB_SID}_${FILE_SUFFIX}.log"
# -------------------------------------
# create new password file if necessary
# -------------------------------------
cd "${ORACLE_HOME}/dbs"
ls -al orapw*
mv orapw${SRC_CDB_SID} orapw${CDB_SID}
mv orapwEBSP orapw${PDB_SID}
cd "${ORACLE_HOME}"
# -------------------------------------------
# reopen the accounts and reset the passwords
# -------------------------------------------
. "${ORACLE_HOME}/${CDB_SID}_${HOSTNAME}.env"
printf "%s\n%s\n" "alter user sys account unlock container=all;" "alter user system identified by ${SYSTEM_PWD} account unlock container=all;"|sqlplus -s "/ as sysdba"
# -----------------
# test connectivity
# -----------------
echo "exit"|sqlplus "system/${SYSTEM_PWD}@${CDB_SID}"
# Verify oratab is updated
# Update CommVault with the instance ${CDB_SID}
*** Ensure backups are not running ***
# -----------------------------
# rename PDB and start services
# -----------------------------
sqlplus / as sysdba<<EOSQL
alter pluggable database EBSP close;
alter pluggable database EBSP open restricted;
alter session set container=EBSP;
alter pluggable database rename global_name to ${PDB_SID};
exec dbms_service.delete_service('EBSM');
exec dbms_service.delete_service('EBSP');
exec dbms_service.delete_service('ebs_EBSP');
exec dbms_service.create_service('ebs_${PDB_SID}','ebs_${PDB_SID}');
exec dbms_service.start_service('ebs_${PDB_SID}');
alter system register;
alter session set container=CDB\$ROOT;
alter pluggable database ${PDB_SID} close;
alter pluggable database ${PDB_SID} open;
alter session set container=${PDB_SID};
exec dbms_service.start_service('ebs_${PDB_SID}');
exec dbms_service.start_service('${PDB_SID}');
alter pluggable database save state;
select name from dba_services;
EOSQL
# -----------------------------
# run the library update script
# -----------------------------
cd "${ORACLE_HOME}/appsutil/install/${PDB_SID}_${HOSTNAME}"
echo "@adupdlib.sql so"|sqlplus -s '/ as sysdba'
# ---------------------------------------------------------
# verify tempfiles are sufficient and update them if needed
# ---------------------------------------------------------
sqlplus / as sysdba<<'EOSQL'|grep -E '^alter' >rebuild_temp.sql
set lines 1000 pages 100 echo off feed off head off trims on termo off
select 'alter database tempfile '''||name||''' drop;'
from v$tempfile
where con_id = 1
/
select 'alter tablespace "'||vt.name||'" add tempfile '''||vtf.name||''' size 1g reuse autoextend on next 1g maxsize 32767m;'
from v$tempfile vtf
, v$tablespace vt
, dba_tablespaces dt
where vt.ts# = vtf.ts#
and vt.name = dt.tablespace_name
and dt.contents = 'TEMPORARY'
and vtf.status = 'ONLINE'
and vt.con_id = 1
/
EOSQL
echo "@rebuild_temp"|sqlplus -s '/ as sysdba'
rm rebuild_temp.sql
sqlplus / as sysdba<<EOSQL|grep -E '^alter' > rebuild_temp.sql
set lines 1000 pages 100 echo off feed off head off trims on termo off
alter session set container = ${PDB_SID};
select 'alter database tempfile '''||name||''' drop;' from v\$tempfile where con_id = 3
/
select 'alter tablespace "'||vt.name||'" add tempfile '''||vtf.name||''' size 1g reuse autoextend on next 1g maxsize 32767m;'
from v\$tempfile vtf
, v\$tablespace vt
, dba_tablespaces dt
where vt.ts# = vtf.ts#
and vt.name = dt.tablespace_name
and dt.contents = 'TEMPORARY'
--and vtf.status = 'ONLINE'
and vt.con_id = 3
/
EOSQL
sqlplus / as sysdba<<EOSQL
alter session set container = ${PDB_SID};
@rebuild_temp
EOSQL
rm rebuild_temp.sql
# ----------------------------------
# configure the Destination Database
# ----------------------------------
# this creates the PDB context directory under $TNS_ADMIN
export ROOTPRE_EXECUTED="Y"
which perl|grep '\/usr\/bin\/perl' >/dev/null
[[ "$?" -eq 0 ]] && export PATH="${ORACLE_HOME}/perl/bin:${PATH}"
which java|grep 'jdk\/jre\/bin' >/dev/null
[[ "$?" -ne 0 ]] && export PATH="${ORACLE_HOME}/jdk/jre/bin:${PATH}"
echo "${PATH}"|grep '\/usr\/vacpp\/bin' >/dev/null
[[ "$?" -ne 0 ]] && export PATH="/usr/vacpp/bin:${PATH}"
cd "${ORACLE_HOME}/perl/lib/"
for i in $(ls|grep '\.'); do
PERLVER="$i"
done
export PERL5LIB="${ORACLE_HOME}/perl/lib/${PERLVER}:${ORACLE_HOME}/perl/lib/site_perl/${PERLVER}:${ORACLE_HOME}/perl/lib:${ORACLE_HOME}/appsutil/perl"
cd "${ORACLE_HOME}/appsutil/clone/bin"
echo "${SRC_APPS_PWD}"|perl adcfgclone.pl dbconfig "${ORACLE_HOME}/appsutil/${PDB_SID}_${HOSTNAME}.xml"
# If TNS errors, chek the service_names = ${CDB_SID} and local_listener (possibly change it to ${HOST}:${PORT}), and restart the listener - does it start?
# -------------------------------------------------
# link the TNS_ADMIN files to the context directory
# -------------------------------------------------
cd "${ORACLE_HOME}/network/admin"
for i in tnsnames.ora listener.ora sqlnet.ora; do
mv "$i" "$i.$(date +'%Y%m%d')"
ln -sf "${PDB_SID}_${HOSTNAME}/$i" "$i"
done
# -----------------------------------------------------
# set the Target UTL_FILE_DIR values in Oracle Database
# -----------------------------------------------------
{ echo ${SRC_APPS_PWD}; }|perl "${ORACLE_HOME}/appsutil/bin/txkCfgUtlfileDir.pl" -contextfile="${CONTEXT_FILE}" -oraclehome="${ORACLE_HOME}" -outdir="${ORACLE_HOME}/appsutil/log" -mode=getUtlFileDir -promptmsg=hide
# perl issues, check "which perl" and $PERL5LIB
grep s_db_util_filedir "${CONTEXT_FILE}"
vi "${ORACLE_HOME}/dbs/${PDB_SID}_utlfiledir.txt"
# comment out any lines at the bottom of the file and add the above directory
# run the following commands to store the updated value back into the database:
{ echo ${SRC_APPS_PWD}; echo ${SYSTEM_PWD}; }|perl ${ORACLE_HOME}/appsutil/bin/txkCfgUtlfileDir.pl -contextfile="${CONTEXT_FILE}" -oraclehome="${ORACLE_HOME}" -outdir="${ORACLE_HOME}/appsutil/log" -mode=setUtlFileDir
# if errors, apps is locked again or system password is wrong
printf "%s\n" "alter user system identified by ${SYSTEM_PWD} account unlock container=all;"|sqlplus "/ as sysdba"
# --------------------------------------------
# create the directory object for outbound dir
# --------------------------------------------
OUTBOUND_DIR=$(grep s_outbound_dir "${CONTEXT_FILE}"|perl -ne 'print $1 if m!\>(.+)\<!')
{ echo ${SRC_APPS_PWD}; echo ${SYSTEM_PWD}; echo "${OUTBOUND_DIR}"; }|perl "${ORACLE_HOME}/appsutil/bin/txkCfgUtlfileDir.pl" -contextfile="${CONTEXT_FILE}" -oraclehome="${ORACLE_HOME}" -outdir="${ORACLE_HOME}/appsutil/log" -mode=createDirObject
# --------------------------
# import the CDB directories
# --------------------------
cd "${DATA_PUMP_DIR}"
FILENAME="dba_directories_dml_${CDB_SID}_${FILE_SUFFIX}"
echo "@${FILENAME}"|sqlplus -s system/${SYSTEM_PWD}
# --------------------------
# import the PDB directories
# --------------------------
cd "${DATA_PUMP_DIR_PDB}"
FILENAME="dba_directories_dml_${PDB_SID}_${FILE_SUFFIX}"
echo "@${FILENAME}"|sqlplus -s system/${SYSTEM_PWD}@${PDB_SID}
# ----------------------
# drop existing db links
# ----------------------
# public:
sqlplus -s system/${SYSTEM_PWD}@${PDB_SID}<<EOSQL
spool /tmp/drop_db_links_$$.sql
set headi off newpa none feedb on verif off trims on
select 'drop public database link '||db_link||';'
from dba_db_links
where owner = 'PUBLIC'
/
spool off
@/tmp/drop_db_links_$$.sql
host rm /tmp/drop_db_links_$$.sql
EOSQL
# private:
sqlplus -s system/${SYSTEM_PWD}@${PDB_SID}<<EOSQL
whenever sqlerror exit failure
set headi off newpa none feedb on verif off trims on
create or replace procedure drop_dblink ( p_schema_name in varchar2
, p_db_link in varchar2
) as
plsql varchar2(4000);
cur number;
uid number;
rc number;
begin
select u.user_id
into uid
from dba_users u
where u.username = p_schema_name
;
plsql := 'drop database link "'||p_db_link||'"';
cur := sys.dbms_sys_sql.open_cursor;
sys.dbms_sys_sql.parse_as_user ( c => cur
, statement => plsql
, language_flag => dbms_sql.native
, userid => uid
);
rc := sys.dbms_sys_sql.execute (cur);
sys.dbms_sys_sql.close_cursor (cur);
end;
/
spool /tmp/drop_db_links_$$.sql
select 'exec drop_dblink( '''||owner||''''||','||''''||db_link||''''||');'
from dba_db_links
where owner != 'PUBLIC'
/
spool off
@/tmp/drop_db_links_$$.sql
host rm /tmp/drop_db_links_$$.sql
EOSQL
# -----------------------
# import the PDB db_links
# -----------------------
cd "${DATA_PUMP_DIR_PDB}"
FILENAME="dba_db_links_${PDB_SID}_${FILE_SUFFIX}"
cat<<EOCAT>impdp_dba_db_links.par
userid='system/${SYSTEM_PWD}@${PDB_SID}'
full=y
directory=DATA_PUMP_DIR_PDB
dumpfile=${FILENAME}.dmp
logfile=impdp_${FILENAME}.log
EOCAT
impdp parfile=impdp_dba_db_links.par
# -----------------------------------------------------------------------------
# relock the sys/system accounts - after Apps tier section has run the FNDCPASS
# -----------------------------------------------------------------------------
printf "%s\n%s\n" "alter user sys account lock container=all;" "alter user system account lock container=all;"|sqlplus -s "/ as sysdba"
END OF DB CLONE
Clone and Configure the Application Tier
