In oracle 19c, there is a new feature of duplicate/cloning an oracle database using dbca with simple and one line command. With this command, we need need to setup listener or pfile manually. All will be taken care by the the dbca duplicate command.

In the below example, we will clone the primary database ILTST19C to DB19C on remote server.

PRIMARY DATABASE - >

Hostname -> dbprod.eraazi.com
DBNAME - > ILTST19C

AUXILARY DB - > ( Means the to be cloned database ) .

Hostname -> dbtest.eraazi.com
DBNAME - > DB19C

1. Install the oracle 19c rdbms oracle_home, on auxilary host.

2. Create file structure where the datafiles will be created.

mkdir -p /data/datafile

3. Run the dbca command from the NEW 19C ORACLE_HOME

export ORACLE_HOME=/oracle/app/oracle/product/19.3.0/dbhome_1

cd $ORACLE_HOME/bin

SYNTAX:

./dbca -silent -createDuplicateDB -gdbName {CLONE_DB_NAME} -primaryDBConnectionString <hostname:port/service> -sid  {CLONE_DB_SID} -databaseConfigType SINGLE -initParams db_unique_name={CLONE_DB_NAME}  -sysPassword {PRIMARY_DB_SYS_PWD} -datafileDestination {CLONE_DATAFILE_LOC}

 

 

./dbca -silent -createDuplicateDB -gdbName DB19C -primaryDBConnectionString dbprod.eraazi.com:1522/ILTST19C 
-sid DB19C -databaseConfigType SINGLE -initParams db_unique_name=DB19C -sysPassword exatree234# 
-datafileDestination /data/datafile

 

$ ./dbca -silent -createDuplicateDB -gdbName DB19C -primaryDBConnectionString dbprod.eraazi.com:1522/ILTST19C 
-sid DB19C -databaseConfigType SINGLE  -initParams db_unique_name=DB19C -sysPassword exatree234# -datafileDestination /data/datafile

Prepare for db operation
22% complete
Listener config step
44% complete
Auxiliary instance creation
67% complete
RMAN duplicate
89% complete
Post duplicate database operations
100% complete

Look at the log file "/oracle/app/oracle/cfgtoollogs/dbca/DB19C/DB19C.log" for further details.


NOTE - Here sys password is the sys password of primary database.

And cloning completed. ????

It took 5 minutes to clone a 15GB database.

Check the datafiles:

SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
/data/datafile/DB19C/system01.dbf
/data/datafile/DB19C/sysaux01.dbf
/data/datafile/DB19C/undotbs01.dbf
/data/datafile/DB19C/users01.dbf
/data/datafile/DB19C/ctlgsm_01.dbf
/data/datafile/DB19C/ctlgsmidx_01.dbf
/data/datafile/DB19C/pcgsm_01.dbf
/data/datafile/DB19C/pcgsmidx_01.dbf
/data/datafile/DB19C/cat_01.dbf
/data/datafile/DB19C/catidx_01.dbf
/data/datafile/DB19C/ctldata_01.dbf

FILE_NAME
--------------------------------------------------------------------------------
/data/datafile/DB19C/ctldataidx_01.dbf
/data/datafile/DB19C/pcdata_01.dbf
/data/datafile/DB19C/pcdataidx_01.dbf
/data/datafile/DB19C/inventorytps01.dbf
/data/datafile/DB19C/catdata01.dbf
/data/datafile/DB19C/catdataidx01.dbf

It created the listener also .

[email protected]:...le/product/19.3.0/dbhome_1/dbs$ ps -ef | grep tns
  oracle 19577 10879   0 16:40:27 pts/1       0:00 grep tns
  oracle 15376     1   0 16:13:00 ?           0:01 /oracle/app/oracle/product/19.3.0/dbhome_1/bin/tnslsnr LISTENER -inherit

And we have successfully cloned a database with just a simple command. In the next article i will explain how to clone a RAC database using DBCA.

19CDBCA ORACLE 19C