Professional Documents
Culture Documents
DB Cloning
Prod database: NEP
Dev database: NEDEV
The Standard process was:
a. Execute the production backup based on the BCV policy.
b. Validate the production backup in the backup server: Startup the database and shutdown immediate
C. copy all the data files from the backup server to the development server and clone the database.
BUT
In this case the 2nd DBA (Paul) used shutdown abort during the backup validation process instead of
clean shutdown because the "shutdown immediate" was taking long time.
I was not aware of shutdown abort.
Cloning process:
a. I started the copying process of data files and submitted the parallel jobs of sftp
ftp -n -v << EOF
open x.x.x.x
user oracle <pwd>
binary
lcd /u01/oradata
cd /u01/oradata
mget *.dbf
Time taken: 3 hours approximately
b. I verified the count of data files. It was matching with the source.
Backup server: Source server: ls -l | awk '{ print $5 " " $9}' > source.txt
Development Server: local server: ls -l | awk '{ print $5 " " $9}' > dev.txt
diff source.txt dev.txt
I did not find any difference.
c. Prepared the control file script. create_ctl_nedev.sql
STARTUP NOMOUNT
CREATE CONTROLFILE set DATABASE "NEDEV" RESETLOGS FORCE LOGGING
NOARCHIVELOG
MAXLOGFILES 192
MAXLOGMEMBERS 3
MAXDATAFILES 1024
2
MAXINSTANCES 32
MAXLOGHISTORY 584
LOGFILE
GROUP 1 (
'/oracle03/oradata/NEDEV/redo_g1_t1_m1.log',
'/oracle04/oradata/NEDEV/redo_g1_t1_m2.log'
) SIZE 100M,
GROUP 2 (
'/oracle03/oradata/NEDEV/redo_g2_t1_m1.log',
'/oracle04/oradata/NEDEV/redo_g2_t1_m2.log'
) SIZE 100M
-- STANDBY LOGFILE
DATAFILE
'/oracle07/oradata/NEDEV/system01.dbf',
'/oracle07/oradata/NEDEV/undotbs01.dbf',
'/oracle07/oradata/NEDEV/sysaux01.dbf',
'/oracle07/oradata/NEDEV/users01.dbf',
'/oracle07/oradata/NEDEV/undotbs02.dbf',
'/oracle07/oradata/NEDEV/s_ts_poaq_data.dbf',
'/oracle07/oradata/NEDEV/s_ts_cc_data01.dbf',
'/oracle07/oradata/NEDEV/s_ts_cc_indx01.dbf',
'/oracle07/oradata/NEDEV/s_fi_data1.dbf',
'/oracle07/oradata/NEDEV/s_ts_poaq_data02.dbf',
'/oracle07/oradata/NEDEV/s_ts_poaq_data03.dbf',
'/oracle07/oradata/NEDEV/s_ts_poaq_indx02.dbf',
CHARACTER SET AL32UTF8
e. Created the controlfiles.
sqlplus sys as sysdba
sqlplus> startup nomount
sqlplus> @create_ctl_nedev
controlfile created
sqlplus> recover database until cancel using controlfile;
I started applying the archive logs: I got the archive log information from the alert log of production
database. The archive logs generated between begin and end backups.
3
MAXINSTANCES 32
MAXLOGHISTORY 584
LOGFILE
GROUP 1 (
'/oracle03/oradata/NEP/redo_g1_t1_m1.log',
'/oracle04/oradata/NEP/redo_g1_t1_m2.log'
) SIZE 100M,
GROUP 2 (
'/oracle03/oradata/NEP/redo_g2_t1_m1.log',
'/oracle04/oradata/NEP/redo_g2_t1_m2.log'
) SIZE 100M
-- STANDBY LOGFILE
DATAFILE
'/oracle07/oradata/NEP/system01.dbf',
'/oracle07/oradata/NEP/undotbs01.dbf',
'/oracle07/oradata/NEP/sysaux01.dbf',
'/oracle07/oradata/NEP/users01.dbf',
'/oracle07/oradata/NEP/undotbs02.dbf',
'/oracle07/oradata/NEP/s_ts_poaq_data.dbf',
'/oracle07/oradata/NEP/s_ts_cc_data01.dbf',
'/oracle07/oradata/NEP/s_ts_cc_indx01.dbf',
'/oracle07/oradata/NEP/s_fi_data1.dbf',
'/oracle07/oradata/NEP/s_ts_poaq_data02.dbf',
'/oracle07/oradata/NEP/s_ts_poaq_data03.dbf',
'/oracle07/oradata/NEP/s_ts_poaq_indx02.dbf',
CHARACTER SET AL32UTF8;
CREATE CONTROLFILE reuse DATABASE "NEP" NOPRESETLOGS ARCHIVELOG
sqlplus> alter database open;
Note: We brought up NEP in the development server. We had not the dev and production connectivity
so we were not worried about db links.
sqlplus> alter databse backup controlfile to trace;
sqlplus> shutdown immediate
$export ORACLE_SID=NEDEV
$sqlplus sys as sysdba
6
STARTUP NOMOUNT
CREATE CONTROLFILE set DATABASE "NEDEV" RESETLOGS FORCE LOGGING
NOARCHIVELOG
MAXLOGFILES 192
MAXLOGMEMBERS 3
MAXDATAFILES 1024
MAXINSTANCES 32
MAXLOGHISTORY 584
LOGFILE
GROUP 1 (
'/oracle03/oradata/NEDEV/redo_g1_t1_m1.log',
'/oracle04/oradata/NEDEV/redo_g1_t1_m2.log'
) SIZE 100M,
GROUP 2 (
'/oracle03/oradata/NEDEV/redo_g2_t1_m1.log',
'/oracle04/oradata/NEDEV/redo_g2_t1_m2.log'
) SIZE 100M
-- STANDBY LOGFILE
DATAFILE
'/oracle07/oradata/NEDEV/system01.dbf',
'/oracle07/oradata/NEDEV/undotbs01.dbf',
'/oracle07/oradata/NEDEV/sysaux01.dbf',
'/oracle07/oradata/NEDEV/users01.dbf',
'/oracle07/oradata/NEDEV/undotbs02.dbf',
'/oracle07/oradata/NEDEV/s_ts_poaq_data.dbf',
'/oracle07/oradata/NEDEV/s_ts_cc_data01.dbf',
'/oracle07/oradata/NEDEV/s_ts_cc_indx01.dbf',
'/oracle07/oradata/NEDEV/s_fi_data1.dbf',
'/oracle07/oradata/NEDEV/s_ts_poaq_data02.dbf',
'/oracle07/oradata/NEDEV/s_ts_poaq_data03.dbf',
'/oracle07/oradata/NEDEV/s_ts_poaq_indx02.dbf',
7
sqlplus> @create_ctl_nedev.sql
Controlfile created
sqlplus> alter database open resetlogs;
sqlplus> select * from global_name;
GLOBAL_NAME
--------------------------------------------------------------------------------
NEP
sqlplus> alter database rename global_name to 'NEDEV';
6. Add the temporary files in the temporary tablespace
7. Drop database links and restore the old one.