Saturday, 12 November 2011

RMAN Cloning Using backup Copy


RMAN Cloning Using backup Copy

Step:1
1)BY using RMAN Backup(command) the prod DB in NODE1.
Ex:
RMAN>backup current controlfile;
RMAN>backup database plus archivelog;

2)Move RMAN Backup copy from NODE1 to NODE2.

Step:2
Connect to RMAN in NODE2 and startup db (no mount)

[oracle@localhost ~]$ rman

Recovery Manager: Release 11.2.0.1.0 - Production on Sat Nov 12 11:58:20 2011

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

RMAN> connect target sys/sys

connected to target database (not started)

RMAN> startup nomount

Oracle instance started

Total System Global Area 535662592 bytes
Fixed Size 1337720 bytes
Variable Size 163579528 bytes
Database Buffers 364904448 bytes
Redo Buffers 5840896 bytes

Step:3
Restore the Controlfile in no mount stage.

RMAN> restore controlfile from '/home/oracle/PROD/autobackup/2011_11_11/o1_mf_s_766931942_7csljsn9_.bkp';

Starting restore at 12-NOV-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=134 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
output file name=/home/oracle/app/oracle/oradata/prod/control01.ctl
output file name=/home/oracle/app/oracle/oradata/prod/control02.ctl
output file name=/home/oracle/app/oracle/oradata/prod/control03.ctl
Finished restore at 12-NOV-11

Step:4
Try to Mount the Database

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

Step:5
Register the RMAN Backup piece(Copy of NODE1) NODE2

RMAN> catalog backuppiece '/home/oracle/PROD/backupset/2011_11_11/o1_mf_annnn_TAG20111111T121851_7cskc6by_.bkp';
cataloged backup piece
backup piece handle=/home/oracle/PROD/backupset/2011_11_11/o1_mf_annnn_TAG20111111T121851_7cskc6by_.bkp RECID=6 STAMP=767016752

RMAN> catalog backuppiece '/home/oracle/PROD/backupset/2011_11_11/o1_mf_annnn_TAG20111111T121851_7cskc6by_.bkp';

cataloged backup piece
backup piece handle=/home/oracle/PROD/backupset/2011_11_11/o1_mf_annnn_TAG20111111T121851_7cskc6by_.bkp RECID=7 STAMP=767016757

RMAN> catalog backuppiece '/home/oracle/PROD/backupset/2011_11_11/o1_mf_annnn_TAG20111111T123702_7csldy4q_.bkp';

cataloged backup piece
backup piece handle=/home/oracle/PROD/backupset/2011_11_11/o1_mf_annnn_TAG20111111T123702_7csldy4q_.bkp RECID=8 STAMP=767016787

RMAN> catalog backuppiece '/home/oracle/PROD/backupset/2011_11_11/o1_mf_ncnnf_TAG20111111T123840_7cslj7hn_.bkp';

cataloged backup piece
backup piece handle=/home/oracle/PROD/backupset/2011_11_11/o1_mf_ncnnf_TAG20111111T123840_7cslj7hn_.bkp RECID=9 STAMP=767016848

RMAN> catalog backuppiece '/home/oracle/PROD/backupset/2011_11_11/o1_mf_ncsnf_TAG20111111T121913_7csldf7d_.bkp';

cataloged backup piece
backup piece handle=/home/oracle/PROD/backupset/2011_11_11/o1_mf_ncsnf_TAG20111111T121913_7csldf7d_.bkp RECID=11 STAMP=767016874

RMAN> catalog backuppiece '/home/oracle/PROD/backupset/2011_11_11/o1_mf_nnndf_TAG20111111T121913_7cskckv3_.bkp';

cataloged backup piece
backup piece handle=/home/oracle/PROD/backupset/2011_11_11/o1_mf_nnndf_TAG20111111T121913_7cskckv3_.bkp RECID=12 STAMP=767016911

RMAN> catalog backuppiece '/home/oracle/PROD/backupset/2011_11_11/o1_mf_nnndf_TAG20111111T121913_7cskckv3_.bkp';

cataloged backup piece
backup piece handle=/home/oracle/PROD/backupset/2011_11_11/o1_mf_nnndf_TAG20111111T121913_7cskckv3_.bkp RECID=13 STAMP=767016953

Step:6
Rename and Relocate the Redologs

SQL> alter database rename file '/oracle/oradata/prod/redo001.log'(Node 1 location) to '/home/oracle/app/oracle/oradata/prod/redo01.log'(Node 2 location);

Database altered.

SQL> alter database rename file '/oracle/oradata/prod/redo03.log' to '/home/oracle/app/oracle/oradata/prod/redo02.log';

Database altered.

SQL> alter database rename file '/oracle/oradata/prod/redo002.log' to '/home/oracle/app/oracle/oradata/prod/redo03.log';

Database altered.

Step:7
To know the last sequence available in the archivelog backup
Ex:
RMAN > list backup of archivelog all;

Step:8
Now restore the datafiles to new locations(Node 2) and recover.

RMAN> run
2> {
3> set until sequence 2 THREAD 1;
4> set newname for datafile 1 to '/home/oracle/app/oracle/oradata/prod/system01.dbf';
5> set newname for datafile 2 to '/home/oracle/app/oracle/oradata/prod/sysaux01.dbf';
6> set newname for datafile 3 to '/home/oracle/app/oracle/oradata/prod/undotbs01.dbf';
7> set newname for datafile 4 to '/home/oracle/app/oracle/oradata/prod/users01.dbf';
8> restore database;
9> switch datafile all;
10> recover database;
  1. }
Output:

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 12-NOV-11
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /home/oracle/app/oracle/oradata/prod/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /home/oracle/app/oracle/oradata/prod/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /home/oracle/app/oracle/oradata/prod/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /home/oracle/app/oracle/oradata/prod/users01.dbf
channel ORA_DISK_1: reading from backup piece /home/oracle/PROD/backupset/2011_11_11/o1_mf_nnndf_TAG20111111T121913_7cskckv3_.bkp
channel ORA_DISK_1: piece handle=/home/oracle/PROD/backupset/2011_11_11/o1_mf_nnndf_TAG20111111T121913_7cskckv3_.bkp tag=TAG20111111T121913
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:02:18
Finished restore at 12-NOV-11

datafile 1 switched to datafile copy
input datafile copy RECID=5 STAMP=767017238 file name=/home/oracle/app/oracle/oradata/prod/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=6 STAMP=767017239 file name=/home/oracle/app/oracle/oradata/prod/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=7 STAMP=767017240 file name=/home/oracle/app/oracle/oradata/prod/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=8 STAMP=767017241 file name=/home/oracle/app/oracle/oradata/prod/users01.dbf

Starting recover at 12-NOV-11
using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 1 is already on disk as file /home/oracle/app/oracle/flash_recovery_area/PROD/archivelog/2011_11_11/o1_mf_1_1_7ct6vcqm_.arc
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=7
channel ORA_DISK_1: reading from backup piece /home/oracle/PROD/backupset/2011_11_11/o1_mf_annnn_TAG20111111T123702_7csldy4q_.bkp
channel ORA_DISK_1: piece handle=/home/oracle/PROD/backupset/2011_11_11/o1_mf_annnn_TAG20111111T123702_7csldy4q_.bkp tag=TAG20111111T123702
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/home/oracle/app/oracle/flash_recovery_area/PROD/archivelog/2011_11_12/o1_mf_1_7_7cw5t5c4_.arc thread=1 sequence=7
archived log file name=/home/oracle/app/oracle/flash_recovery_area/PROD/archivelog/2011_11_11/o1_mf_1_1_7ct6vcqm_.arc thread=1 sequence=1
channel default: deleting archived log(s)
archived log file name=/home/oracle/app/oracle/flash_recovery_area/PROD/archivelog/2011_11_12/o1_mf_1_7_7cw5t5c4_.arc RECID=9 STAMP=767017245
media recovery complete, elapsed time: 00:00:03
Finished recover at 12-NOV-11
Step:9
Try to open the db.

RMAN> alter database open resetlogs;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 11/12/2011 12:21:44
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-39700: database must be opened with UPGRADE option
Process ID: 20364
Session ID: 125 Serial number: 17
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
ORA-03114: not connected to ORACLE
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 11/12/2011 12:21:44
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-39700: database must be opened with UPGRADE option
Process ID: 20364
Session ID: 125 Serial number: 17
[oracle@localhost ~]$

Step:10

SQL> startup upgrade
ORACLE instance started.

Total System Global Area 535662592 bytes
Fixed Size 1337720 bytes
Variable Size 163579528 bytes
Database Buffers 364904448 bytes
Redo Buffers 5840896 bytes
Database mounted.
Database opened.
SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ WRITE

SQL> select open_mode,log_mode from v$database;

OPEN_MODE LOG_MODE
-------------------- ------------
READ WRITE ARCHIVELOG

No comments:

Post a Comment