Objective: To clone the library with Rman on the same machine
Environment: RedHat 4 + Oracle 10g
Master Library Name: DB01
Clone Library Name: Clonedb
1, the main library db01, with Rman for backup (datafile, controlfile, Archivelog file)
08:49:43 sql> show parameter name;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
Db_file_name_convert string
Db_name string Cuug
Db_unique_name string Cuug
Global_names Boolean FALSE
instance_name string Cuug
Lock_name_space string
Log_file_name_convert string
Service_names string Cuug
08:49:53 sql> Select Current_scn from V$database;
Current_scn
-----------
1139339
08:50:17 sql>
Rman> Run {
2> Allocate channel C1 type disk;
3> Allocate channel C2 type disk;
4> Backup full database format '/disk2/rman/db01/hot_bak/%d_%s_%t.bak ';
5> backup Archivelog All format '/disk2/rman/db01/hot_bak/arch_%s.bak ';
6> Backup current controlfile format '/disk2/rman/db01/hot_bak/ctl_%s.bak ';
7>}
08:58:59 sql> Col file_namr for A50
08:59:19 sql> Select File_id,file_name,tablespace_name from Dba_data_files;
file_id file_name Tablespace_name
---------- -------------------------------------------------- ------------------------------
5/U01/APP/ORACLE/ORADATA/DB01/LXTB1.DBF LXTBS1
4/U01/APP/ORACLE/ORADATA/DB01/USERS01.DBF USERS
3/U01/APP/ORACLE/ORADATA/DB01/SYSAUX01.DBF Sysaux
2/U01/APP/ORACLE/ORADATA/DB01/RTBS01.DBF Rtbs
1/U01/APP/ORACLE/ORADATA/DB01/SYSTEM01.DBF SYSTEM
8/U01/APP/ORACLE/ORADATA/DB01/UNDOTBS1.DBF UNDOTBS1
11/U01/APP/ORACLE/ORADATA/DB01/TBSBIG.DBF Tbs_big
12/U01/APP/ORACLE/ORADATA/DB01/INDX01.DBF INDX
6/U01/APP/ORACLE/ORADATA/DB01/LXTBS2.DBF LXTBS2
9 rows selected.
2, the establishment of pfile documents
08:59:31 sql> create Pfile from SPFile;
File created.
3, set up the directory of the Clone library
[Oracle@rh4 dbs]$ mkdir-p $ORACLE _base/admin/clonedb/bdump
[Oracle@rh4 dbs]$ mkdir-p $ORACLE _base/admin/clonedb/cdump
[Oracle@rh4 dbs]$ mkdir-p $ORACLE _base/admin/clonedb/udump
[Oracle@rh4 dbs]$ mkdir-p $ORACLE _base/oradata/clonedb
4, the main library pfile copy generated clone library pfile, and generate the clone library password file
[Oracle@rh4 dbs]$ orapwd file=orapwclonedb.ora password=oracle entries=3;
[Oracle@rh4 dbs]$ CP Initdb01.ora Initclonedb.ora
[Oracle@rh4 dbs]$ VI Initclonedb.ora
Replace the DB01 with Clonedb and add the following:
Db_file_name_convert = ("/u01/app/oracle/oradata/db01", "/u01/app/oracle/oradata/clonedb")
Log_file_name_convert = ("/disk1/oradata/db01", "/disk1/oradata/clonedb", "/disk2/oradata/db01", "/disk2/oradata/ Clonedb ")
5, the Clone library to boot to Nomount
[Oracle@rh4 dbs]$ Export Oracle_sid=clonedb
[Oracle@rh4 dbs]$!sql
Sqlplus '/as sysdba '
Sql*plus:release 10.2.0.1.0-production on Fri Mar 23 09:11:22 2012
Copyright (c) 1982, +, Oracle. All rights reserved.
Connected to a idle instance.
09:11:22 sql> startup pfile= $ORACLE _home/dbs/initclonedb.ora Nomount
ORACLE instance started.
Total System Global area 314572800 bytes
Fixed Size 1219160 bytes
Variable Size 113247656 bytes
Database buffers 197132288 bytes