Sie sind auf Seite 1von 10

11g ORACLE DATABASE COLD CLONING

11g
ORACLE DATABASE
CLONING(OFFLINE)

BY
NARASIMHARAO,
ORAFACT INC,.

ORAFACT

11g ORACLE DATABASE COLD CLONING

INDEX
Table of Contents
11g database Off line Cloning :..................................................................................................................3
Copy the environment file source to target ..........................................................................................3
Create directres in Oracle base:.................................................................................................................4
First goto admin directre......................................................................................................................4
Goto cfgtoollogs directre.....................................................................................................................4
Go to diag directre...............................................................................................................................5
Go to flash_recovery_area directre...................................................................................................6
Go to oradata directre........................................................................................................................6
Creating pfile:...........................................................................................................................................7
Generate the control script :..................................................................................................................7
Then generate the control script using ..............................................................................................8
Edit trace file ........................................................................................................................................8
Execute control script:...........................................................................................................................9
Add one temp table space ...................................................................................................................10
Checking the instance:.............................................................................................................................11

ORAFACT

11g ORACLE DATABASE COLD CLONING

11g database Off line Cloning :


Connect the user
[root@of30 ~]# su - narasimha
Hai narasimha ................ welcome
connect to source database ofdb and shutdown normal
SQL> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.

Copy the environment file source to target


[narasimha@of30 ~]$ cp ofdb.env clondb.env
[narasimha@of30 ~]$ vi clondb.env
### change the database name #####
export ORACLE_BASE=/d01/narasimha
export ORACLE_HOME=/d01/narasimha/11.1.0.6
export ORACLE_SID=clondb
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
and
:wq

ORAFACT

11g ORACLE DATABASE COLD CLONING

Create directres in Oracle base:


[root@of30 narasimha]# ls
10.2.0.1 11.1.0.6 admin cfgtoollogs diag flash_recovery_area New Folder oradata oraInventory
#####In that you check it all and if need crate directre ############

First goto admin directre


[root@of30 narasimha]# cd admin
[root@of30 admin]# ls
dev ofdb prod
[root@of30 admin]# mkdir clondb
[root@of30 admin]# ls
clondb dev ofdb prod
in ofdb having 3 directres
[root@of30 ofdb]# ls
adump dpdump pfile
we are create that directres
[root@of30 admin]# cd clondb/
[root@of30 clondb]# mkdir adump
[root@of30 clondb]# mkdir dpdump
[root@of30 clondb]# mkdir pfile
[root@of30 clondb]# ls
adump dpdump pfile

Goto cfgtoollogs directre


[root@of30 cfgtoollogs]# ls
dbca emca netca

ORAFACT

11g ORACLE DATABASE COLD CLONING


go to dbca directre
[root@of30 cfgtoollogs]# cd dbca/
[root@of30 dbca]# ls
ofdb prod
[root@of30 dbca]# mkdir clondb
[root@of30 dbca]# ls
clondb ofdb prod
go to emca directre
[root@of30 cfgtoollogs]# cd emca/
[root@of30 emca]# ls
ofdb prod
[root@of30 emca]# mkdir clondb
[root@of30 emca]# ls
clondb ofdb prod
go to netca directre
no need to create any directre

Go to diag directre
[root@of30 narasimha]# cd diag/
[root@of30 diag]# ls
asm clients crs diagtool lsnrctl netcman ofm rdbms tnslsnr
In that we create one directre only in RDBMS
[root@of30 diag]# cd rdbms/
[root@of30 rdbms]# ls
ofdb prod
[root@of30 rdbms]# mkdir clondb
[root@of30 rdbms]# ls
clondb ofdb prod
In that clondb we can create one clondb
5

ORAFACT

11g ORACLE DATABASE COLD CLONING


[root@of30 rdbms]# cd clondb/
[root@of30 clondb]# ls
[root@of30 clondb]# mkdir clondb
[root@of30 clondb]# ls
clondb

Go to flash_recovery_area directre
[root@of30 narasimha]# cd flash_recovery_area/
[root@of30 flash_recovery_area]# ls
DEV OFDB PROD
[root@of30 flash_recovery_area]# mkdir CLONDB
[root@of30 flash_recovery_area]# ls
CLONDB DEV OFDB PROD

Go to oradata directre
[root@of30 narasimha]# cd oradata/
[root@of30 oradata]# ls
dev ofdb prod
[root@of30 oradata]# mkdir clondb
[root@of30 oradata]# ls
clondb dev ofdb prod

Go to ofdb and copy all the C R D files to clondb


[root@of30 oradata]# cd ofdb/
[root@of30 ofdb]# ls
control01.ctl control03.ctl of_ts1.dbf redo01.log redo02.log redo03.log redo05a.log redo5.log
system01.dbf undotbs01.dbf
control02.ctl control04.ctl of_ts.dbf redo02a.log redo03a.log redo04a.log redo4.log sysaux01.dbf
temp01.dbf users01.dbf
[root@of30 ofdb]# cp * /d01/narasimha/oradata/clondb
after completing

ORAFACT

11g ORACLE DATABASE COLD CLONING

Creating pfile:
go to $ORACLE_HOME/dbs
in dbs directre spfile is there, we can create pfile using spfile
SQL> create pfile from spfile:
File created.
Edit the pfile where ofdb is there change the clondb and check the locations of control files.
Move to initofdb.ora to initclondb.ora
[root@of30 dbs]# vi initofdb.ora
[root@of30 dbs]# mv initofdb.ora initclondb.ora

Generate the control script :


after that go to source start the database ofdb
SQL> startup
ORACLE instance started.
Total System Global Area 1043886080 bytes
Fixed Size
2151000 bytes
Variable Size
515902888 bytes
Database Buffers
520093696 bytes
Redo Buffers
5738496 bytes
Database mounted.
Database opened.

Then generate the control script using


SQL> alter database backup controlfile to trace;
Database altered.
7

ORAFACT

11g ORACLE DATABASE COLD CLONING

And shutdown database


Go to trace :/d01/narasimha/diag/rdbms/ofdb/ofdb/trace

Edit trace file


copy the destination location

/d01/narasimha/create_clondb.sql

Edit the create_clondb.sql file

ORAFACT

11g ORACLE DATABASE COLD CLONING

Execute control script:


connect to destination user run the environment connect to SQL
[narasimha@of30 narasimha]$ sqlplus '/as sysdba'
SQL> startup nomount
ORACLE instance started.

Total System Global Area 1043886080 bytes


Fixed Size

2151000 bytes

Variable Size

515902888 bytes

Database Buffers

520093696 bytes

Redo Buffers

5738496 bytes

SQL> @/d01/narasimha/createclon.sql

Control file created.

SQL> alter database open resetlogs;

Database altered

ORAFACT

11g ORACLE DATABASE COLD CLONING

Add one temp table space


SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '/d01/narasimha/oradata/clondb/temp01.dbf'
SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
Tablespace altered.

Checking the instance:


SQL> select status,INSTANCE_NAME from v$instance;

STATUS

INSTANCE_NAME

------------ ---------------OPEN

clondb

End the 11g clone

10

ORAFACT

Das könnte Ihnen auch gefallen