Friday, May 18, 2007

RMAN -- Restore from cold backup procedure:

Restore from cold backup procedure:
===================================

1. Obtain the datafile, redo log file, control file info

select name from v$datafile;
select member from v$logfile;
select name from v$controlfile;

2. shutdown database and startup in nomount mode ( need to restore
controlfile)

3. Remove the current datafile, redo logfile, control files found in
step 1

rm /ora02/oradata/GEN3Q/gen3q_system01.dbf
rm /ora02/oradata/GEN3Q/GEN3Q_audit_rdbs01.dbf
rm /ora01/oradata/GEN3Q/gen_data_01.dbf
rm /ora02/oradata/GEN3Q/gen_data_02.dbf
rm /ora01/oradata/GEN3Q/gen_data_03.dbf
rm /ora02/oradata/GEN3Q/gen_data_04.dbf
rm /ora01/oradata/GEN3Q/gen_data_05.dbf
rm /ora02/oradata/GEN3Q/gen_data_06.dbf
rm /ora01/oradata/GEN3Q/gen_data_07.dbf
rm /ora02/oradata/GEN3Q/gen_data_08.dbf
rm /ora01/oradata/GEN3Q/gen_data_09.dbf
rm /ora02/oradata/GEN3Q/gen_data_10.dbf
rm /ora01/oradata/GEN3Q/gen_data_11.dbf
rm /ora01/oradata/GEN3Q/gen_data_12.dbf
rm /ora01/oradata/GEN3Q/gen_indx_01.dbf
rm /ora02/oradata/GEN3Q/gen_indx_02.dbf
rm /ora01/oradata/GEN3Q/gen_indx_03.dbf
rm /ora02/oradata/GEN3Q/gen_indx_04.dbf
rm /ora01/oradata/GEN3Q/gen_indx_05.dbf
rm /ora02/oradata/GEN3Q/gen_indx_06.dbf
rm /ora01/oradata/GEN3Q/gen_indx_07.dbf
rm /ora02/oradata/GEN3Q/gen_indx_08.dbf
rm /ora01/oradata/GEN3Q/genp_indx01.dbf
rm /ora02/oradata/GEN3Q/genp_rbs01.dbf
rm /ora01/oradata/GEN3Q/genp_rbs02.dbf
rm /ora01/oradata/GEN3Q/genp_temp01.dbf
rm /ora02/oradata/GEN3Q/genp_temp02.dbf
rm /ora01/oradata/GEN3Q/genp_tools01.dbf
rm /ora02/oradata/GEN3Q/genp_users01.dbf
rm /ora01/oradata/GEN3Q/gen_rep_data_01.dbf
rm /ora02/oradata/GEN3Q/gen_rep_data_02.dbf
rm /ora01/oradata/GEN3Q/gen_rep_data_03.dbf
rm /ora02/oradata/GEN3Q/gen_rep_data_04.dbf
rm /ora02/oradata/GEN3Q/foglight_01.dbf
rm /ora03/oradata/GEN3Q/genp_temp03.dbf
rm /ora01/oraredo/GEN3Q/gen3q_redo01a.log
rm /ora02/oraredo/GEN3Q/gen3q_redo01b.log
rm /ora01/oraredo/GEN3Q/gen3q_redo02a.log
rm /ora02/oraredo/GEN3Q/gen3q_redo02b.log
rm /ora01/oraredo/GEN3Q/gen3q_redo03a.log
rm /ora02/oraredo/GEN3Q/gen3q_redo03b.log
rm /ora01/oraredo/GEN3Q/gen3q_redo04a.log
rm /ora02/oraredo/GEN3Q/gen3q_redo04b.log
rm /ora01/oraredo/GEN3Q/gen3q_redo05a.log
rm /ora02/oraredo/GEN3Q/gen3q_redo05b.log
rm /ora01/oraredo/GEN3Q/gen3q_redo06a.log
rm /ora02/oraredo/GEN3Q/gen3q_redo06b.log
rm /ora01/oradata/GEN3Q/gen3q_control01.ctl
rm /ora02/oradata/GEN3Q/gen3q_control02.ctl
rm /ora01/oradata/GEN3Q/gen3q_control03.ctl


4. Connect to target database and catalog database
set ORACLE env
rman target / catalog rman/xxx@cataprd6

5. Reset database to the correct incarnation if necessary
(not in this case, we have only one incarnation)

RMAN> list incarnations;
RMAN> reset database to incarnation <inc_key>;

6. Run the following command:

run {
# set until time if necessary
# set until time '06-Mar-2007 23:00:00';
allocate channel d1 type disk;
allocate channel d2 type disk;
restore controlfile;
# mount database after restoring control file
alter database mount;
restore database;
alter database open resetlogs;
}

7. Add temp files if needed

====== Actual Screen Output on Mar 31, 2007 ===========

RMAN>
2> run {
3> allocate channel d1 type disk;
4> allocate channel d2 type disk;
5> restore controlfile;
6> alter database mount;
7> restore database;
8> alter database open resetlogs;
9> }
RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: d1
RMAN-08500: channel d1: sid=13 devtype=DISK

RMAN-03022: compiling command: allocate
RMAN-03023: executing command: allocate
RMAN-08030: allocated channel: d2
RMAN-08500: channel d2: sid=14 devtype=DISK

RMAN-03022: compiling command: restore

RMAN-03022: compiling command: IRESTORE
RMAN-03023: executing command: IRESTORE
RMAN-08016: channel d1: starting datafile backupset restore
RMAN-08502: set_count=4 set_stamp=618620009 creation_time=30-MAR-2007
22:53:29
RMAN-08021: channel d1: restoring controlfile
RMAN-08505: output filename=/ora01/oradata/GEN3Q/gen3q_control01.ctl
RMAN-08023: channel d1: restored backup piece 1
RMAN-08511: piece
handle=/oracle/admin/GEN3Q/backup/cold_GEN3Q_1_4_task6mar30.dbf
tag=TASK6MAR30 params=NULL
RMAN-08024: channel d1: restore complete
RMAN-08058: replicating controlfile
RMAN-08506: input filename=/ora01/oradata/GEN3Q/gen3q_control01.ctl
RMAN-08505: output filename=/ora02/oradata/GEN3Q/gen3q_control02.ctl
RMAN-08505: output filename=/ora01/oradata/GEN3Q/gen3q_control03.ctl

RMAN-03022: compiling command: alter db
RMAN-06199: database mounted

RMAN-03022: compiling command: restore
RMAN-03025: performing implicit partial resync of recovery catalog
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete

RMAN-03022: compiling command: IRESTORE
RMAN-03023: executing command: IRESTORE
RMAN-08016: channel d2: starting datafile backupset restore
RMAN-08502: set_count=2 set_stamp=618619679 creation_time=30-MAR-2007
22:47:59
RMAN-08089: channel d2: specifying datafile(s) to restore from backup
set
RMAN-08523: restoring datafile 00003 to
/ora01/oradata/GEN3Q/gen_data_01.dbf
RMAN-08523: restoring datafile 00004 to
/ora02/oradata/GEN3Q/gen_data_02.dbf
RMAN-08523: restoring datafile 00005 to
/ora01/oradata/GEN3Q/gen_data_03.dbf
RMAN-08016: channel d1: starting datafile backupset restore
RMAN-08502: set_count=1 set_stamp=618619679 creation_time=30-MAR-2007
22:47:59
RMAN-08089: channel d1: specifying datafile(s) to restore from backup
set
RMAN-08523: restoring datafile 00002 to
/ora02/oradata/GEN3Q/GEN3Q_audit_rdbs01.dbf
RMAN-08523: restoring datafile 00012 to
/ora02/oradata/GEN3Q/gen_data_10.dbf
RMAN-08523: restoring datafile 00013 to
/ora01/oradata/GEN3Q/gen_data_11.dbf
RMAN-08523: restoring datafile 00014 to
/ora01/oradata/GEN3Q/gen_data_12.dbf
RMAN-08523: restoring datafile 00034 to
/ora02/oradata/GEN3Q/foglight_01.dbf
RMAN-08023: channel d2: restored backup piece 1
RMAN-08511: piece
handle=/oracle/admin/GEN3Q/backup/cold_GEN3Q_1_2_task6mar30.dbf
tag=TASK6MAR30 params=NULL
RMAN-08024: channel d2: restore complete
RMAN-08016: channel d2: starting datafile backupset restore
RMAN-08502: set_count=3 set_stamp=618619944 creation_time=30-MAR-2007
22:52:24
RMAN-08089: channel d2: specifying datafile(s) to restore from backup
set
RMAN-08523: restoring datafile 00006 to
/ora02/oradata/GEN3Q/gen_data_04.dbf
RMAN-08523: restoring datafile 00007 to
/ora01/oradata/GEN3Q/gen_data_05.dbf
RMAN-08523: restoring datafile 00021 to
/ora01/oradata/GEN3Q/gen_indx_07.dbf
RMAN-08023: channel d1: restored backup piece 1
RMAN-08511: piece
handle=/oracle/admin/GEN3Q/backup/cold_GEN3Q_1_1_task6mar30.dbf
tag=TASK6MAR30 params=NULL
RMAN-08024: channel d1: restore complete
RMAN-08016: channel d1: starting datafile backupset restore
RMAN-08502: set_count=4 set_stamp=618620009 creation_time=30-MAR-2007
22:53:29
RMAN-08089: channel d1: specifying datafile(s) to restore from backup
set
RMAN-08523: restoring datafile 00001 to
/ora02/oradata/GEN3Q/gen3q_system01.dbf
RMAN-08523: restoring datafile 00008 to
/ora02/oradata/GEN3Q/gen_data_06.dbf
RMAN-08523: restoring datafile 00010 to
/ora02/oradata/GEN3Q/gen_data_08.dbf
RMAN-08523: restoring datafile 00016 to
/ora02/oradata/GEN3Q/gen_indx_02.dbf
RMAN-08523: restoring datafile 00018 to
/ora02/oradata/GEN3Q/gen_indx_04.dbf
RMAN-08523: restoring datafile 00020 to
/ora02/oradata/GEN3Q/gen_indx_06.dbf
RMAN-08523: restoring datafile 00022 to
/ora02/oradata/GEN3Q/gen_indx_08.dbf
RMAN-08523: restoring datafile 00023 to
/ora01/oradata/GEN3Q/genp_indx01.dbf
RMAN-08523: restoring datafile 00024 to
/ora02/oradata/GEN3Q/genp_rbs01.dbf
RMAN-08523: restoring datafile 00025 to
/ora01/oradata/GEN3Q/genp_rbs02.dbf
RMAN-08523: restoring datafile 00027 to
/ora02/oradata/GEN3Q/genp_temp02.dbf
RMAN-08523: restoring datafile 00029 to
/ora02/oradata/GEN3Q/genp_users01.dbf
RMAN-08523: restoring datafile 00031 to
/ora02/oradata/GEN3Q/gen_rep_data_02.dbf
RMAN-08523: restoring datafile 00033 to
/ora02/oradata/GEN3Q/gen_rep_data_04.dbf
RMAN-08023: channel d2: restored backup piece 1
RMAN-08511: piece
handle=/oracle/admin/GEN3Q/backup/cold_GEN3Q_1_3_task6mar30.dbf
tag=TASK6MAR30 params=NULL
RMAN-08024: channel d2: restore complete
RMAN-08016: channel d2: starting datafile backupset restore
RMAN-08502: set_count=5 set_stamp=618620185 creation_time=30-MAR-2007
22:56:25
RMAN-08089: channel d2: specifying datafile(s) to restore from backup
set
RMAN-08523: restoring datafile 00009 to
/ora01/oradata/GEN3Q/gen_data_07.dbf
RMAN-08523: restoring datafile 00026 to
/ora01/oradata/GEN3Q/genp_temp01.dbf
RMAN-08023: channel d2: restored backup piece 1
RMAN-08511: piece
handle=/oracle/admin/GEN3Q/backup/cold_GEN3Q_1_5_task6mar30.dbf
tag=TASK6MAR30 params=NULL
RMAN-08024: channel d2: restore complete
RMAN-08016: channel d2: starting datafile backupset restore
RMAN-08502: set_count=6 set_stamp=618620411 creation_time=30-MAR-2007
23:00:11
RMAN-08089: channel d2: specifying datafile(s) to restore from backup
set
RMAN-08523: restoring datafile 00011 to
/ora01/oradata/GEN3Q/gen_data_09.dbf
RMAN-08523: restoring datafile 00015 to
/ora01/oradata/GEN3Q/gen_indx_01.dbf
RMAN-08523: restoring datafile 00017 to
/ora01/oradata/GEN3Q/gen_indx_03.dbf
RMAN-08523: restoring datafile 00019 to
/ora01/oradata/GEN3Q/gen_indx_05.dbf
RMAN-08523: restoring datafile 00028 to
/ora01/oradata/GEN3Q/genp_tools01.dbf
RMAN-08523: restoring datafile 00030 to
/ora01/oradata/GEN3Q/gen_rep_data_01.dbf
RMAN-08523: restoring datafile 00032 to
/ora01/oradata/GEN3Q/gen_rep_data_03.dbf
RMAN-08523: restoring datafile 00035 to
/ora03/oradata/GEN3Q/genp_temp03.dbf
RMAN-08023: channel d1: restored backup piece 1
RMAN-08511: piece
handle=/oracle/admin/GEN3Q/backup/cold_GEN3Q_1_4_task6mar30.dbf
tag=TASK6MAR30 params=NULL
RMAN-08024: channel d1: restore complete
RMAN-08023: channel d2: restored backup piece 1
RMAN-08511: piece
handle=/oracle/admin/GEN3Q/backup/cold_GEN3Q_1_6_task6mar30.dbf
tag=TASK6MAR30 params=NULL
RMAN-08024: channel d2: restore complete
RMAN-03023: executing command: partial resync
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete

RMAN-03022: compiling command: alter db
RMAN-06400: database opened
RMAN-03023: executing command: alter db
RMAN-08006: database registered in recovery catalog
RMAN-03023: executing command: full resync
RMAN-08002: starting full resync of recovery catalog
RMAN-08004: full resync complete
RMAN-08031: released channel: d1
RMAN-08031: released channel: d2

RMAN>
RMAN> **end-of-file**

RMAN> exit


Recovery Manager complete.
tx2qdfsdb1> /oracle/admin/GEN3Q/rman/shell [GEN3Q] sqlplus system/xxx

SQL*Plus: Release 8.1.7.0.0 - Production on Sat Mar 31 12:22:46 2007

(c) Copyright 2000 Oracle Corporation. All rights reserved.


Connected to:
Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
With the Partitioning option
JServer Release 8.1.7.4.0 - Production

system@GEN3Q> alter system set fixed_date ='2007-03-30 11:59:00';

No comments: