Professional Documents
Culture Documents
Cloning Database Using Rman Backup
Cloning Database Using Rman Backup
$ cd $ORACLE_HOME/network/admin
$ vi listener.ora
MY_LIS =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.55.219)(PORT = 6261))
)
)
)
SID_LIST_MY_LIS =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME =/u01/app/oracle/product/10.2.0.1.0)
(SID_NAME =galaxy)
)
)
$ cd $ORACLE_HOME/network/admin
$ vi tnsnames.ora
to_galaxy =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.55.219)(PORT = 6261))
)
(CONNECT_DATA =
(SERVICE_NAME =galaxy)
)
)
SQL> create tablespace rmants datafile '/u05/davedb/rmants.dbf' size 200m;
Tablespace created.
SQL>
SQL> create user rms identified by rms default tablespace rmants;
User created.
SQL>
SQL> grant connect,resource,recovery_catalog_owner to rms;
Grant succeeded.
SQL>
$ rman catalog rms/rms
Recovery Manager: Release 10.2.0.1.0 - Production on Fri Aug 3 18:28:27 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to recovery catalog database
RMAN>
RMAN> create catalog;
run {
backup database;
change archivelog all validate;
sql'alter system archive log current';
backup archivelog all;
}
$lsnrctl
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 08-AUG-2007 08:50:53
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> stop MY_LIS
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.55.219)(PORT=6261)))
The command completed successfully
LSNRCTL> start MY_LIS
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.16.55.219)(PORT=6261)))
Services Summary...
Service "auxdb" has 1 instance(s).
Instance "auxdb", status UNKNOWN, has 1 handler(s) for this service...
Service "galaxy" has 1 instance(s).
Instance "galaxy", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL>
$ export ORACLE_SID=auxdb
$ sqlplus /as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Aug 8 08:59:59 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount pfile=$ORACLE_HOME/dbs/initauxdb.ora
ORACLE instance started.
Total System Global Area 155189248 bytes
Fixed Size
1218220 bytes
Variable Size
96471380 bytes
Database Buffers
50331648 bytes
Redo Buffers
7168000 bytes
SQL>
$ rman catalog rms/rms target sys/admin@to_galaxy auxiliary sys/admin@auxdb
Recovery Manager: Release 10.2.0.1.0 - Production on Tue Aug 7 18:09:32 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: GALAXY (DBID=3423097528)
connected to recovery catalog database
connected to auxiliary database: AUXDB (not mounted)
RMAN>duplicate target database to auxdb pfile=$ORACLE_HOME/dbs/initauxdb.ora;
Starting Duplicate Db at 07-AUG-07
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=35 devtype=DISK
allocated channel: ORA_AUX_DISK_2
channel ORA_AUX_DISK_2: sid=34 devtype=DISK
contents of Memory Script:
{
set until scn 313251;
set newname for datafile 1 to
"/u01/product/auxdb/system.dbf";
filename=/u01/product/auxdb/undotbs.dbf
filename=/u01/product/auxdb/sysaux.dbf
filename=/u01/product/auxdb/ts11.dbf
filename=/u01/product/auxdb/dict.dbf
155189248 bytes
1218220 bytes
96471380 bytes
50331648 bytes
7168000 bytes
CONTROLFILE REUSE SET DATABASE "AUXDB" RESETLOGS ARCHIVELOG
5
MAXDATAFILES
100
MAXINSTANCES
1
MAXLOGHISTORY
292
LOGFILE
GROUP 1 ( '/u01/product/auxdb/redolog1a.dbf' ) SIZE 10 M REUSE,
GROUP 2 ( '/u01/product/auxdb/redolog2b.dbf' ) SIZE 10 M REUSE
DATAFILE
'/u01/product/auxdb/system.dbf'
CHARACTER SET US7ASCII
contents of Memory Script:
{
set newname for tempfile 1 to
"/u01/product/auxdb/temp01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/u01/product/auxdb/undotbs.dbf";
catalog clone datafilecopy "/u01/product/auxdb/sysaux.dbf";
catalog clone datafilecopy "/u01/product/auxdb/ts11.dbf";
catalog clone datafilecopy "/u01/product/auxdb/dict.dbf";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed temporary file 1 to /u01/product/auxdb/temp01.dbf in control file
cataloged datafile copy
datafile copy filename=/u01/product/auxdb/undotbs.dbf recid=1 stamp=630007823
cataloged datafile copy
datafile copy filename=/u01/product/auxdb/sysaux.dbf recid=2 stamp=630007823
cataloged datafile copy
datafile copy filename=/u01/product/auxdb/ts11.dbf recid=3 stamp=630007823
cataloged datafile copy
datafile copy filename=/u01/product/auxdb/dict.dbf recid=4 stamp=630007823
datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=630007823
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=630007823
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=630007823
datafile 5 switched to datafile copy
input datafile copy recid=4 stamp=630007823
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 07-AUG-07
RMAN>
filename=/u01/product/auxdb/undotbs.dbf
filename=/u01/product/auxdb/sysaux.dbf
filename=/u01/product/auxdb/ts11.dbf
filename=/u01/product/auxdb/dict.dbf