This post is not about how we normally do an EBS 12.2 cloning. You can search many blogs, articles over web. Well, in this post i am going to illustrate on how we can clone an EBS 12.2.10 environment where the Database is 19c multitenant with one CDB and one PDB. The main challenge comes when we want to do a restore the database and rename it based upon our target convention.
Did, any of the below questions come to your mind, when you are about to do these sort of clone
1. When we do a restore/recover the database which is multitenant in nature, then in the target, then how the database will be opened
2. Which script to use to achieve the multitenant clone for EBS
3. How to rename the PDB after clone
High level Steps:-
Run adpreclone on the source database and application nodes.
Back up the full Container Database (CDB) database with archives by using RMAN Hot backup and copy it to the target node.
Clean up the target database and application node.
Copy the source application binaries and database binaries to the target node.
Configure $Oracle_Home on the target database node.
Restore and recover the databases.
Perform post-restore steps on the Target database node.
Configure the application on the target application node.
Perform post-clone steps on the application node.
Start the target application services.
Steps:-
I am not going to explain the clone steps as there are already many blogs, articles available. I am going to jump directly on the main part on how to restore/recover the database.
Create a pairs file:-
cat pairsfile.txt
s_undo_tablespace=APPS_UNDOTS1
s_db_oh=/u02/oracle/ABCD/product/19c/db
s_dbhost=fjfjfjjfldw
s_dbSid=BORISPP2
s_pdb_name=PDB_name
s_cdb_name=cdb_name
s_base=/u02/oracle/ABCD/product/19c/base
s_dbuser=oracle
s_dbgroup=oinstall
s_dbhome1=/u03/oracle/ABCD/product/11.2.0.4/data
s_display=localhost:10.0
s_dbCluster=false
s_isDBCluster=n
s_dbport=1526
s_port_pool=6
This pairs file will be used to create the new context file.
Create the context file
perl adclonectx.pl \
contextfile=/u02/oracle/ABCD/product/19c/db/appsutil/PDB_0wbcvrjgtki7uqv.xml\
template=/u02/oracle/ABCD/product/19c/db/appsutil/template/adxdbctx.tmp \
pairsfile=/u02/oracle/ABCD/product/19c/db/appsutil/clone/pairsfile.txt
Configure the DB technology stack
perl adcfgclone.pl dbTechStack /u02/oracle/ABCD/product/19c/db/appsutil/PDB_0wbcvrjgtki7uqv.xml
Create the listener.ora and tnsnames.ora files for the target CDB by running the following commands:
1.Set the environment.
On UNIX:
$ cd /u02/oracle/ABCD/product/19c/db/appsutil
$ source ./txkSetCfgCDB.env -dboraclehome=/u02/oracle/ABCD/product/19c/db
Generate the listener.ora and tnsnames.ora.
$ cd <ORACLE_HOME>/appsutil/bin
$ perl txkGenCDBTnsAdmin.pl -dboraclehome/u02/oracle/ABCD/product/19c/db -cdbnameCDB \
-cdbsid=CDB -dbport=1526 -outdir=$ORACLE_HOME/appsutil/log \
where:
Parameter Description
Cdbname Name of the target container database.
Cdbsid Oracle SID of the target container database instance.
• For single-node database, the value is same as the cdbname.
• For Oracle RAC database, it is the Instance name of the target database.
Israc • Provide the value 'yes' for an Oracle RAC database.
• Provide the value 'no' for a single-node database.
virtualhostname Virtual hostname for the Oracle RAC database. For a single-node database, this parameter should not be used.
Start the listener for the target container database as follows:
On UNIX:
$ cd /u02/oracle/ABCD/product/19c/db/appsutil/scripts/PDB_0wbcvrjgtki7uqv.xml
./adcdblnctl.sh start CDB
Restore the database(Delete the existing datafiles if any before starting the process)
Start the target in nomount using temporary init/spfile
set -x
export TIMESTAMP=`date +%Y%m%d`
export BACKUP_BASE=/u02/oracle/ABCD/product/19c/base
export LOGFILE=/u02/oracle/ABCD/product/19c/base/DB_Duplicate-${TIMESTAMP}.log
touch ${LOGFILE}
rman log=${LOGFILE} << EOF
connect auxiliary /
run {
allocate auxiliary channel aux1 device type disk;
allocate auxiliary channel aux2 device type disk;
allocate auxiliary channel aux3 device type disk;
allocate auxiliary channel aux4 device type disk;
allocate auxiliary channel aux5 device type disk;
allocate auxiliary channel aux6 device type disk;
allocate auxiliary channel aux7 device type disk;
allocate auxiliary channel aux8 device type disk;
allocate auxiliary channel aux9 device type disk;
allocate auxiliary channel aux10 device type disk;
allocate auxiliary channel aux11 device type disk;
allocate auxiliary channel aux12 device type disk;
set newname for datafile '/u03/oracle/ABCD/product/11.2.0.4/data/a_txn_ind02.dbf' to '/binaries/oracle/ABCD/data/a_txn_ind02.dbf';
set newname for datafile '/u03/oracle/ABCD/product/11.2.0.4/data/a_txn_ind10.dbf' to '/binaries/oracle/ABCD/data/a_txn_ind10.dbf';
set newname for datafile '/u03/oracle/ABCD/product/11.2.0.4/data/a_txn_ind15.dbf' to '/binaries/oracle/ABCD/data/a_txn_ind15.dbf';
set newname for datafile '/u03/oracle/ABCD/product/11.2.0.4/data/a_txn_ind21.dbf' to '/binaries/oracle/ABCD/data/a_txn_ind21.dbf';
set newname for datafile '/u03/oracle/ABCD/product/11.2.0.4/data/a_txn_ind33.dbf' to '/binaries/oracle/ABCD/data/a_txn_ind33.dbf';
set newname for datafile '/u03/oracle/ABCD/product/11.2.0.4/data/a_txn_ind38.dbf' to '/binaries/oracle/ABCD/data/a_txn_ind38.dbf';
set newname for datafile '/u03/oracle/ABCD/product/11.2.0.4/data/a_txn_ind46.dbf' to '/binaries/oracle/ABCD/data/a_txn_ind46.dbf';
set newname for datafile '/u03/oracle/ABCD/product/11.2.0.4/data/a_txn_ind47.dbf' to '/binaries/oracle/ABCD/data/a_txn_ind47.dbf';
duplicate database to 'CDB' backup location '/binaries/BKP_12210_TST002' nofilenamecheck;
release channel aux1;
release channel aux2;
release channel aux3;
release channel aux4;
release channel aux5;
release channel aux6;
release channel aux7;
release channel aux8;
release channel aux9;
release channel aux10;
release channel aux11;
release channel aux12;
}
EOF
echo >> ${LOGFILE}
The DB will be open read write mode and the PDB name will have the source PDB name. Thus we will have to rename it based upon our target value
Rename the PDB
If any service already exists with the Target PDB name, delete it as follows:
[oracle@ABCD db]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Sep 22 11:05:42 2021
Version 19.11.0.0.0
Copyright (c) 1982, 2020, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.11.0.0.0
SQL> alter session set container="ABCDT02";
Session altered.
Run the following steps to rename the PDB.
[oracle@ABCD dbs]$ !sq
sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Sep 22 11:18:31 2021
Version 19.11.0.0.0
Copyright (c) 1982, 2020, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.11.0.0.0
SQL> alter pluggable database "ABCDT02" close;
alter pluggable database "ABCDT02" close
*
ERROR at line 1:
ORA-65020: pluggable database ABCDT02 already closed
SQL> alter pluggable database "ABCDT02" unplug into '/u02/oracle/ABCD/product/19c/db/dbs/ABCDT02_PDBDesc.xml';
Pluggable database altered.
SQL> drop pluggable database "ABCDT02";
Pluggable database dropped.
SQL> create pluggable database "ABCDPP2" using '/u02/oracle/ABCD/product/19c/db/dbs/ABCDT02_PDBDesc.xml' NOCOPY SERVICE_NAME_CONVERT=('ebs_ABCDT02','ebs_ABCDPP2','ABCDT02_ebs_patch','ABCDPP2_ebs_patch');
Pluggable database created.
SQL> alter pluggable database "ABCDPP2" open read write;
Pluggable database altered.
SQL> alter pluggable database all open;
Pluggable database altered.
SQL> alter pluggable database all save state instances=all;
Pluggable database altered.
SQL>
Run the library update script against the Oracle database.
cd <ORACLE_HOME>/appsutil/install/<CONTEXT_NAME>
$ sqlplus / as sysdba @adupdlib.sql <libext>
Store the target UTL_FILE_DIR values in the target database
You can refer my earlier blog https://samappsdba.blogspot.com/2020/12/upgrade-EBS-12.2-database-12c12.1.0.2-to-19c19.3-Part-1.html on how to do this.
Configure the target database
cd /u02/oracle/ABCD/product/19c/db/appsutil/clone/bin
$ perl adcfgclone.pl dbconfig contextfile
In every cloning methodology, database cloning is the most vital part and if that is complete, half of the work is done. The application clone can be configured by using the adcfgclone.pl appsTier dualfs option, the steps for which i have not covered here and which is very straightforward.
I hope this can be helpful to someone. Till then happy learning
References:-Cloning Oracle E-Business Suite Release 12.2 with Multitenant Database using Rapid Clone (Doc ID 2552208.1)
we have an option to rname pdb and i usually do that for renaming
ReplyDeletealter pluggable database prodpdb close immediate;
alter pluggable database prodpdb open read write restrict;
alter pluggable database prodpdb rename global name to testpdb;
alter pluggable database testpdb close immediate;
alter pluggable database testpdb open read write ;
check service names with production and delete them and create test service names using "exec dbms_service.DELETE(prod service)" and CREATE,STOP,START