0% found this document useful (0 votes)
5 views3 pages

Clone DB

The document outlines the steps to clone an Oracle database named 'prodb' to 'clonedb', including enabling fast recovery area and archivelog mode, creating necessary configuration files, and setting up directories. It details the creation of a password file, backup of the control file, and modifications to initialization parameters. Finally, it includes instructions for starting the new database, recovering it from backup mode, and enabling archivelog mode for the cloned database.

Uploaded by

raisulg.kccl
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

Clone DB

The document outlines the steps to clone an Oracle database named 'prodb' to 'clonedb', including enabling fast recovery area and archivelog mode, creating necessary configuration files, and setting up directories. It details the creation of a password file, backup of the control file, and modifications to initialization parameters. Finally, it includes instructions for starting the new database, recovering it from backup mode, and enabling archivelog mode for the cloned database.

Uploaded by

raisulg.kccl
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Existing Database Name: prodb Target Database Name: clonedb

Must Need:
Fast Recovery Area: Enable
show parameter reco;
alter system set db_recovery_file_dest_size=8G;

Archivelog Mode: Enable


archive log list;
shutdown immediate;
startup mount;
alter database archivelog;
alter database open;
startup force; [find scn number]

1. Create pfile using spfile: create pfile='D:\initprodb.ora' from


spfile;

2. Create Backup of Control File: alter database backup controlfile to trace as


'D:\control.sql';

3. Create a Password file: host orapwd.exe file=D:\PWDprodb.ora


password=Admin$321

4. Copy files to new Server Location: D:\app\Administrator\product\12.1.0\dbhome_1\


database

5. Rename initprodb.ora to initclonedb.ora & PWDprodb to PWDclonedb.ora

6. Modify Contro.SQL

--Start Control.SQL Text--


STARTUP NOMOUNT
CREATE CONTROLFILE SET DATABASE "CLONEDB" RESETLOGS
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 'D:\APP\ADMINISTRATOR\ORADATA\CLONEDB\REDO01.LOG' SIZE 50M BLOCKSIZE
512,
GROUP 2 'D:\APP\ADMINISTRATOR\ORADATA\CLONEDB\REDO02.LOG' SIZE 50M BLOCKSIZE
512,
GROUP 3 'D:\APP\ADMINISTRATOR\ORADATA\CLONEDB\REDO03.LOG' SIZE 50M BLOCKSIZE 512
DATAFILE
'D:\APP\ADMINISTRATOR\ORADATA\CLONEDB\SYSTEM01.DBF',
'D:\APP\ADMINISTRATOR\ORADATA\CLONEDB\SYSAUX01.DBF',
'D:\APP\ADMINISTRATOR\ORADATA\CLONEDB\UNDOTBS01.DBF',
'D:\APP\ADMINISTRATOR\ORADATA\CLONEDB\USERS01.DBF',
'D:\APP\ADMINISTRATOR\ORADATA\CLONEDB\EXAMPLE01.DBF'
CHARACTER SET WE8MSWIN1252
;
--END Control.SQL Text--

7. Modify initclonedb.ora
-- Start initclonedb.ora Text--

clonedb.__data_transfer_cache_size=0
clonedb.__db_cache_size=1006632960
clonedb.__java_pool_size=16777216
clonedb.__large_pool_size=33554432
clonedb.__oracle_base='D:\app\Administrator'#ORACLE_BASE set from environment
clonedb.__pga_aggregate_target=486539264
clonedb.__sga_target=1459617792
clonedb.__shared_io_pool_size=67108864
clonedb.__shared_pool_size=318767104
clonedb.__streams_pool_size=0
*.audit_file_dest='D:\app\Administrator\admin\clonedb\adump'
*.audit_trail='db'
*.compatible='12.1.0.2.0'
*.control_files='D:\app\Administrator\oradata\clonedb\control01.ctl','D:\app\
Administrator\recovery_area\clonedb\control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='clonedb'
*.db_recovery_file_dest='D:\app\Administrator\recovery_area'
*.db_recovery_file_dest_size=6420m
*.diagnostic_dest='D:\app\Administrator'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=clonedbXDB)'
*.open_cursors=300
*.pga_aggregate_target=459m
*.processes=300
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=1377m
*.undo_tablespace='UNDOTBS1'
-- END initclonedb.ora Text--

8. Create Directories
mkdir D:\app\Administrator\admin\clonedb\adump
mkdir D:\app\Administrator\oradata\clonedb
mkdir D:\app\Administrator\recovery_area\clonedb
mkdir D:\app\Administrator\recovery_area\clonedb\ARCHIVELOG
9. Create a Oracle Database Service

oradim -NEW -SID clonedb -STARTMODE manual -PFILE "D:\app\Administrator\product\


12.1.0\dbhome_1\database\initclonedb.ora"

10. Start database backup mode


select * from v$backup;

select max(first_change#) change from v$archived_log;


-- Save the Change Number 2504107
alter database begin backup;

10. Copy old database files from oradat to new database

11. Create some table in hr account


create table hr.test1 as select * from hr.employees;
create table hr.test2 as select * from hr.employees;
create table hr.test3 as select * from hr.employees;
commit;

alter system switch logfile;


alter database end backup;
alter system archive log current;
select name from v$archived_log where first_change# >=&changeno order by name;

copy these archivelog files to new server.

12. remove previous control01.ctl from oradata folder in new server.

13. set SID, Base & Home path & start sqlplus

echo %ORACLE_SID%
set ORACLE_SID=clonedb
set ORACLE_BASE=D:\app\Administrator
set ORACLE_HOME=D:\app\Administrator\product\12.1.0\dbhome_1

14. start control.sql


@D:\app\Administrator\product\12.1.0\dbhome_1\database\CONTROL.sqL

15. Recover database [when it was in backup mode]

recover database using backup controlfile until cancel;


D:\app\Administrator\recovery_area\clonedb\ARCHIVELOG\2023_04_09\
O1_MF_1_5_L34ZFDP4_.ARC

recover database using backup controlfile until cancel;


D:\app\Administrator\recovery_area\clonedb\ARCHIVELOG\2023_04_09\
O1_MF_1_6_L350BBT2_.ARC
D:\app\Administrator\recovery_area\clonedb\ARCHIVELOG\2023_04_09\
O1_MF_1_7_L350GXX1_.ARC
cancel

15. alter database open resetlogs;

16.
select instance_name, status from v$instance;
select table_name from dba_tables where owner='HR';

17. Enable Archivelog Mode;


archive log list;

oradim -startup -sid clonedb


oradim -NEW -SID clonedb -STARTMODE auto
oradim -NEW -SRVC OracleServiceCLONEDB -STARTMODE auto

To set the ORACLE_HOME environment variable go to My Computer -> Properties ->


Advanced -> Environment Variables -> System Variables -> New/Edit/Delete.

You might also like