4.6 KiB
CLONING RMAN FROM A BACKUP IN 10G
[oracle@boss ~]$ cd rmanbackup/ [oracle@boss rmanbackup]$ ls 01nsnp5o_1_1 02nsnp5r_1_1 03nsnp6k_1_1 control_filebkc-1965345038-20121213-01 [oracle@boss rmanbackup]$ vi control_filebkc-1965345038-20121213-01
Now go down and copy the pfile from the backup piece.
Copy the pfile from the backup piece and past it inthe clone db.
[oracle@boss ~]$ mkdir db6 [oracle@boss ~]$ cd db6 [oracle@boss db6]$ mkdir admin oradata [oracle@boss db6]$ cd admin/ [oracle@boss admin]$ mkdir pfile bdump cdump udump create [oracle@boss admin]$ cd pfile/ [oracle@boss pfile]$ vi initdb6.ora [oracle@boss pfile]$ cd ../../oradata/ [oracle@boss oradata]$ mkdir data log ctrl arch [oracle@boss oradata]$ [oracle@boss oradata]$ ls arch ctrl data log [oracle@boss oradata]$
Open the pfile add the db_unique_name=db6. Change the db_name as same as the source db background_dump_dest='/home/oracle/db6/admin/bdump/' compatible='10.2.0' control_files='/home/oracle/db6/oradata/ctrl/control1.ctrl' core_dump_dest='/home/oracle/db6/admin/cdump/' db_name='db2'-- snap db db_unique_name=db6-- clone db pga_aggregate_target=500m sga_target=800m undo_management='auto' undo_tablespace='undo' user_dump_dest='/home/oracle/db6/admin/udump/'
[oracle@boss ~]$ export ORACLE_SID=db6 [oracle@boss ~]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.4.0 - Production on Thu Dec 13 20:33:39 2012 Copyright (c) 1982, 2007, Oracle. All Rights Reserved. Connected to an idle instance. SQL> startup pfile='/home/oracle/db6/admin/pfile/initdb6.ora' nomount; ORACLE instance started. Total System Global Area 838860800 bytes Fixed Size 1270244 bytes Variable Size 213913116 bytes Database Buffers 620756992 bytes Redo Buffers 2920448 bytes
SQL>
[oracle@boss ~]$ export ORACLE_SID=db6 [oracle@boss ~]$ rman target / Recovery Manager: Release 10.2.0.4.0 - Production on Thu Dec 13 20:49:35 2012 Copyright (c) 1982, 2007, Oracle. All rights reserved. connected to target database: db2 (not mounted) RMAN> set dbid=1965345038 executing command: SET DBID RMAN> restore controlfile from '/home/oracle/rmanbackup/control_filebkc-1965345038-20121213-01'; Starting restore at 13-DEC-12 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=35 devtype=DISK channel ORA_DISK_1: restoring control file channel ORA_DISK_1: restore complete, elapsed time:00:00:01 output filename=/home/oracle/db6/oradata/ctrl/control1.ctrl Finished restore at 13-DEC-12 RMAN> alter database mount; database mounted released channel: ORA_DISK_1 RMAN> run 2> { 3> set newname for datafile 1 to '/home/oracle/db6/oradata/data/system.dbf'; 4> set newname for datafile 2 to '/home/oracle/db6/oradata/data/undo.dbf'; 5> set newname for datafile 3 to '/home/oracle/db6/oradata/data/sysaux.dbf'; 6> sql"alter database rename file ''/home/oracle/db2/oradata/log/log1.log'' to ''/home/oracle/db6/oradata/log/log1.log''"; 7> sql"alter database rename file ''/home/oracle/db2/oradata/log/log2.log''to ''/home/oracle/db6/oradata/log/log2.log''";
8> restore database;
9> switch datafile all; 10> recover database; 11> } executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME Starting restore at 13-DEC-12 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile backupset restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set restoring datafile 00001 to /home/oracle/db6/oradata/data/system.dbf restoring datafile 00002 to /home/oracle/db6/oradata/data/undo.dbf restoring datafile 00003 to /home/oracle/db6/oradata/data/sysaux.dbf channel ORA_DISK_1: reading from backup piece /u01/app/oracle/product/10.2.0/db_1/dbs/0anspjtv_1_1 channel ORA_DISK_1: restored backup piece 1 piece handle=/u01/app/oracle/product/10.2.0/db_1/dbs/0anspjtv_1_1 tag=TAG20121213T202119 channel ORA_DISK_1: restore complete, elapsed time:00:01:16 Finished restore at 13-DEC-12 datafile 1 switched to datafile copy input datafile copy recid=4 stamp=801956019 filename=/home/oracle/db6/oradata/data/system.dbf datafile 2 switched to datafile copy input datafile copy recid=5 stamp=801956019 filename=/home/oracle/db6/oradata/data/undo.dbf datafile 3 switched to datafile copy input datafile copy recid=6 stamp=801956019 filename=/home/oracle/db6/oradata/data/sysaux.dbf Starting recover at 13-DEC-12 using channel ORA_DISK_1 starting media recovery archive log thread 1 sequence 3 is already on disk as file /home/oracle/db2/oradata/log/log1.log archive log filename=/home/oracle/db2/oradata/log/log1.log thread=1 sequence=3 media recovery complete, elapsed time: 00:00:06 Finished recover at 13-DEC-12
RMAN> alter database open resetlogs; database opened
RMAN>exit