Sei sulla pagina 1di 5

10 steps for cloning a database.

Summary :-

The following steps must be on Source -Production instance/Server
Step 1. Shutdown database in normal mode and start it up in restricted mode.
Step . Ta!e the bac!up of control file
Step ". Shutdown database again in normal mode.
Step #. $opy /%TP init parameter file &control file script and all the database file
on the destination server/location& once all the files are successfully copied&
you may startup the database normally.
The following step must be on destination ' $lone instance/server
Step (. )dit init parameter file and control file script.
Step *. +ew )nvironment setup .
Step ,. $onnect with svrmgrl and recreate control file
Step -. .pen the database in resetlogs.
Step /. Shutdown the database in normal mode
Step 10. Ta!e the cold bac!up and start the database in archive/non archive mode.


0etails :-

Step 1 ' " on the Source Server 1 Server 23


S456758 connect internal/oracle
Connected.
S456758 shutdown 9
Database closed.
Database dismounted.
ORACLE instance shut down.
S456758 startup restrict
ORACLE instance started.
Total System Global Area 57!"#$ bytes
%i&ed Si'e 7#(!" bytes
)ariable Si'e "#($"" bytes
Database *u++ers ,777!, bytes
Redo *u++ers 77$!" bytes
Database mounted.
Database o-ened.
S456758 alter database bac!up controlfile to trace9
Statement -rocessed.
S)R.GR/
S)R.GR/ show -arameter user0dum-0dest
1A.E T23E )AL4E
55555555555555555555555555555555555 5555555 5555555555555555555555555
user0dum-0dest strin6 E78ora$,8admin8ora$,8udum-


+ote :- :ac!up control file will generate in user dump destination as above. $hec! for the
latest .ra;<<<<<8.trc . 5ename this file to $trlprod.s=l

S456758 shutdown immediate9
Database closed.
Database dismounted.
ORACLE instance shut down.















Step #: $opy all the parameter files 1initsid.ora& configsid.ora 3& $ontrol files& $trlprod.s=l
1 created as above3 and all data files to clone server . >t is good to follow the .%2. >f you
are cloning a database on the same machine then create a different directory structure
1 as .%23 for cloning instance and copied all the re=uired files of primary instance here.

Step #a : .n ?ni< 1 @et us say your cloning instance name is clone3
>f you had followed .%2 & your initsid.ora parameters files would be in
A.52$@)B:2S)/admin/clone/pfile/initclone.ora
and configsid.ora would be in
A.52$@)B:2S)/admin/clone/pfile/configclone.ora.

$reate a symbolic lin!

$hange the wor!ing directory to A.52$@)BC.6)/dbs and create a symbolic
lin!
A ln 's A.52$@)B:2S)/admin/clone/pfile/initclone.ora initclone.ora


Step ( : .n destination server

$hange the following parameter in the initsid.ora of the cloning instance/server

>nitSid.ora 1initora-1*.ora3 of the
Source/production server.

>nitSid.ora 1initclone.ora3 of the
destination/clone server.

dbBname D Eora-1*E
instanceBname D ora-1*
serviceBnames D ora-1*
controlBfiles D
0bBnameD FcloneG
>nstanceBnameD clone
ServiceBname D clone
$ontrolBfile D
1.All Parameter files
2. Control file
3. Datafiles
4. Redo log files
Source Production
Instance/Server
Destination Clone Instance
/Server
1.All Parameter files
2. Control file
3. Datafiles
4. Redo log files
1Ee:Hora-1*HoradataHora-1*Hcontro
l01.ctlE&
Ef:Hora-1*HoradataHora-1*Hcontrol
0.ctlE&
Eg:Hora-1*HoradataHora-1*Hcontrol
0".ctlE3
1F$:HcloneHcontrol01.ctlG&G0:HcloneHcontrol
0.ctlG3


The other parameter which is re=uired to change is userBdumpBdest&
bac!groundBdumpBdest&logBarchiveBdest


.ra<<<<.trc is copied from source/production instance to destination/clone instance and
renamed it as ctrlclone.s=l .

)dit ctrlclone.s=l as follows.


.ra<<<<.trc in user dump dest of Source/Production
instance

$trlclone.s=l

START43 1O.O41T
CREATE CO1TROL%9LE 5)?S) 02T2:2S) E.52-1*E
+.5)S)T@.7S 25$C>4)@.7
.A:LOG%9LES ;!
.A:LOG.E.*ERS !
.A:DATA%9LES ;!
.A:91STA1CES ,
.A:LOG<9STOR2 $5
LOG%9LE
GRO43 I):H.52-1*H.5202T2H.52-1*HREDO#;.LOG=
S9>E .?
GRO43 ! I):H.52-1*H.5202T2H.52-1*HREDO#!.LOG=
S9>E .?
GRO43 ; I):H.52-1*H.5202T2H.52-1*HREDO#.LOG=
S9>E .
DATA%9LE
I):H.52-1*H.5202T2H.52-1*HS2STE.#.D*%=?
I):H.52-1*H.5202T2H.52-1*HR*S#.D*%=?
I):H.52-1*H.5202T2H.52-1*HTE.3#.D*%=?
I):H.52-1*H.5202T2H.52-1*HTOOLS#.D*%=?
I):H.52-1*H.5202T2H.52-1*H91D:#.D*%=?
I):H.52-1*H.5202T2H.52-1*HDR#.D*%=?
I):H.52-1*H02T2:2S)H1GAR5ORA$,#.D*%=?
I):H.52-1*H02T2:2S)HR*STEST#.D*%=
C<ARACTER SET @E$9SO$$5(3
A
B RecoCery is reDuired i+ any o+ the data+iles are restored
bacEu-s?
B or i+ the last shutdown was not normal or immediate.
5)$.4)5 02T2:2S)
B All lo6s need archiCin6 and a lo6 switch is needed.
2@T)5 SJST)6 25$C>4) @.7 2@@9
B Database can now be o-ened normally.
2@T)5 02T2:2S) .P)+9
FG Delete eCerythin6 u-to startu- nomount GF
START43 1O.O41T pfileDf:HcloneHinitclone.ora
CREATE CO1TROL%9LE set 02T2:2S) E$@.+)E resetlogs
noarchivelog
.A:LOG%9LES ;!
.A:LOG.E.*ERS !
.A:DATA%9LES ;!
.A:91STA1CES ,
.A:LOG<9STOR2 $5
LOG%9LE
GRO43 I%:H$@.+)H.52-1*8REDO#;.LOG=
S9>E .?
GRO43 ! I%:H$@.+)H.52-1*8REDO#!.LOG=
S9>E .?
GRO43 ; I%:H$@.+)H.52-1*8REDO#.LOG=
S9>E .
DATA%9LE
I%:H$@.+)H.52-1*8S2STE.#.D*%=?
I%:H$@.+)H.52-1*8R*S#.D*%=?
I%:H$@.+)H.52-1*8TE.3#.D*%=?
I%:H$@.+)H.52-1*8TOOLS#.D*%=?
I%:H$@.+)H.52-1*891D:#.D*%=?
I%:H$@.+)H.52-1*8DR#.D*%=?
I%:H$@.+)H02T2:2S)81GAR5ORA$,#.D*%=?
I%:H$@.+)H02T2:2S)8R*STEST#.D*%=
C<ARACTER SET @E$9SO$$5(3
A
B RecoCery is reDuired i+ any o+ the data+iles are
restored bacEu-s?
B or i+ the last shutdown was not normal or immediate.
K5)$.4)5 02T2:2S)
B All lo6s need archiCin6 and a lo6 switch is needed.
K2@T)5 SJST)6 25$C>4) @.7 2@@9
B Database can now be o-ened normally.
K2@T)5 02T2:2S) .P)+9













ST)P * :-

.+ +T :- Jou have to create a windows +T services as follows.

$:H8oradim -new -sid clone -srvc oracleservice$lone -intpwd oracle -startmode auto -pfile
f:HcloneHinitclone.ora

.+ ?ni< :-

123 123 $hange the wor!ing directory to /etc and edit the oratab file to put the
entry for $@.:) instance.
1:3 Setup login profile for the .racle user having dba group.
.52$@)BS>0D$@.+)
)<port .52$@)BS>0
.r .oraenv




ST)P , :- $reate controlfile as follows :-

$hec! in the initclone.ora 5)6.T)B@.7>+BP2SSL.50%>@) is set to
e<clusive or shared. >f this is set& then a valid passwordfile
should e<ist in .52$@)BC.6)/dbs or created using orapwd as

orapwd fileD/u01/oracle/4-1*/dbs/orapw4, passwordDoracle entriesD1

where /u01/oracle/4-1* is an oracle home


S456758 Mf:HcloneHctrlclone.s=l
ORACLE instance started.
Total System Global Area 57!;$#" bytes
%i&ed Si'e 7#,!# bytes
)ariable Si'e "#($"" bytes
Database *u++ers ,777!, bytes
Redo *u++ers 77$!" bytes
Statement -rocessed.

ST)P - :- .pen the database in resetlog mode as follows.

S456758 alter database open resetlogs9
Statement -rocessed.

ST)P / :- Shutdown the database in +ormal mode

S456758 connect internal/oracle
Connected.
S456758 shutdown 9
Database closed.
Database dismounted.
ORACLE instance shut down.

STEP 10 :- Ta!e the cold bac!up and start the database in archive/non archive mode.



+ote :-
You cannot move datafiles from one operating system and use them on a different
operating system. Therefore, it is not possible to clone a database running on
SUN on an HP machine. You would have to use eport!import.

Potrebbero piacerti anche