PROD Hot Oracle Database Cloning Without RMAN

Hot database cloning is ideal for 24/7 production databases where downtime is not an option. This method uses the hot backup mode to clone a database while it is running — no RMAN required, no database shutdown needed.

In this guide, we’ll demonstrate hot cloning of a database named PROD using SQL*Plus and basic OS utilities like scp.


 Prerequisites

  • Archivelog mode must be enabled.

  • Sufficient space on target host.

  • SSH access between source and target.

  • Consistent file paths between source and target (or adjustments in init.ora and controlfile script).


Source & Clone Configuration

  • Source DB SID: PROD

  • Clone DB SID: PROD

  • File paths are the same on both systems.


Step 1: Clone the Parameter File (init.ora)

On the source:


SQL> create pfile from spfile;

Then, copy it to the target server:


scp $ORACLE_HOME/dbs/initPROD.ora oracle@funclonedb.lab:$ORACLE_HOME/dbs/

On the target, edit initPROD.ora as needed:


cat $ORACLE_HOME/dbs/initPROD.ora

Ensure directories for:

  • Control files

  • Audit dump (adump)

Create them if missing:


mkdir -p /u01/db_files/PROD/control mkdir -p /u01/db_files/PROD/adump

Step 2: Clone the Controlfile (Trace Method)

On the source:


SQL> alter database backup controlfile to trace as '/tmp/PROD_ctl.sql'
REUSE RESETLOGS;

Copy the controlfile trace to the target:


scp /tmp/PROD_ctl.sql oracle@funclonedb.lab:/tmp/

Edit the controlfile trace on the target:


vi /tmp/PROD_ctl.sql

Clean it up:

  • Delete everything before CREATE CONTROLFILE

  • Delete everything after the last ;

You should retain something like:


CREATE CONTROLFILE REUSE DATABASE "PROD" RESETLOGS NOARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 292 LOGFILE GROUP 1 '/u01/db_files/PROD/redo01.log' SIZE 200M, GROUP 2 '/u01/db_files/PROD/redo02.log' SIZE 200M, GROUP 3 '/u01/db_files/PROD/redo03.log' SIZE 200M DATAFILE '/u01/db_files/PROD/system01.dbf', '/u01/db_files/PROD/sysaux01.dbf', '/u01/db_files/PROD/undotbs01.dbf', '/u01/db_files/PROD/users01.dbf' CHARACTER SET AL32UTF8;

Step 3: Clone the Datafiles

3.1 Put DB in Backup Mode


SQL> alter system switch logfile; SQL> alter database begin backup;

3.2 Copy Datafiles & Redo Logs


scp /u01/db_files/PROD/*log oracle@funclonedb.lab:/u01/db_files/PROD/ scp /u01/db_files/PROD/*.dbf oracle@funclonedb.lab:/u01/db_files/PROD/

3.3 End Backup Mode


SQL> alter database end backup; SQL> alter system switch logfile; SQL> archive log list;

3.4 Copy Archivelogs

Copy all archivelogs generated between begin backup and end backup to the same location on the target:


scp /u02/PROD/archivelog/* oracle@funclonedb.lab:/u02/PROD/archivelog/

Step 4: Mount and Recover Clone DB

4.1 Startup and Mount


sqlplus / as sysdba SQL> startup nomount; SQL> @/tmp/PROD_ctl.sql SQL> alter database mount;

4.2 Recover Database


SQL> recover database using backup controlfile until cancel;

Feed the required archive logs when prompted. Continue hitting ENTER until prompted to type CANCEL.


4.3 Open Clone Database


SQL> alter database open resetlogs;

Hot Clone Complete

We’ve now created a fully functional clone of the PROD database without shutting it down and without using RMAN.







Please do like and subscribe to my youtube channel: https://www.youtube.com/@foalabs If you like this post please follow,share and comment