rman backup and Recovery, if all archive logs and redo logs are available

1-  ————Take Rman Backup——————-

RMAN> run
2> {
3> ALLOCATE CHANNEL disk1 DEVICE TYPE DISK FORMAT 'C:\oraclexe\rman\rman%U';
4> backup AS COMPRESSED BACKUPSET tag Full_database_open database;
5> }

using target database control file instead of recovery catalog
allocated channel: disk1
channel disk1: SID=9 device type=DISK

Starting backup at 25-AUG-13
channel disk1: starting compressed full datafile backup set
channel disk1: specifying datafile(s) in backup set
input datafile file number=00002 name=C:\ORACLEXE\APP\ORACLE\ORADATA\XE\UNDOTBS1.DBF
input datafile file number=00006 name=C:\USERS.DBF02.DBF
input datafile file number=00001 name=C:\ORACLEXE\APP\ORACLE\ORADATA\XE\SYSTEM.DBF
input datafile file number=00005 name=C:\ORACLEXE\APP\ORACLE\ORADATA\XE\USERS01.DBF
input datafile file number=00004 name=C:\ORACLEXE\APP\ORACLE\ORADATA\XE\USERS.DBF
input datafile file number=00003 name=C:\ORACLEXE\APP\ORACLE\ORADATA\XE\SYSAUX.DBF
channel disk1: starting piece 1 at 25-AUG-13
channel disk1: finished piece 1 at 25-AUG-13
piece handle=C:\ORACLEXE\RMAN\RMAN03OI68FH_1_1 tag=FULL_DATABASE_OPEN comment=NONE
channel disk1: backup set complete, elapsed time: 00:00:55
channel disk1: starting compressed full datafile backup set
channel disk1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel disk1: starting piece 1 at 25-AUG-13
channel disk1: finished piece 1 at 25-AUG-13
piece handle=C:\ORACLEXE\RMAN\RMAN04OI68H8_1_1 tag=FULL_DATABASE_OPEN comment=NONE
channel disk1: backup set complete, elapsed time: 00:00:01
Finished backup at 25-AUG-13
released channel: disk1

RMAN>

2- ———–shutdown the database to delete it *.dbf files————-

C:\Users\sherkhan>sqlplus /nolog

SQL*Plus: Release 11.2.0.2.0 Production on Sun Aug 25 12:09:14 2013

Copyright (c) 1982, 2010, Oracle. All rights reserved.

SQL> conn /as sysdba
Connected.
SQL> shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

3- ———-Deleted files manually———-

4- Try to start the database

SQL> startup
ORACLE instance started.
Total System Global Area 1071333376 bytes
Fixed Size 1388352 bytes
Variable Size 620757184 bytes
Database Buffers 444596224 bytes
Redo Buffers 4591616 bytes
ORA-00205: error in identifying control file, check alert log for more info

SQL> exit
Disconnected from Oracle Database 11g Express Edition Release 11.2.0.2.0 – Production

 5-  ———-connect rman to restore controlfile————

C:\Users\sherkhan>rman target /

Recovery Manager: Release 11.2.0.2.0 – Production on Sun Aug 25 12:12:55 2013

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

connected to target database: XE (not mounted)

RMAN> restore controlfile from 'C:\oraclexe\rman\RMAN04OI68H8_1_1';

Starting restore at 25-AUG-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=63 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
output file name=C:\ORACLEXE\APP\ORACLE\ORADATA\XE\CONTROL.DBF
Finished restore at 25-AUG-13

RMAN>
6-  ———-mout the DB——

RMAN> sql 'alter database mount';

sql statement: alter database mount
released channel: ORA_DISK_1
7- ——–Restored the database in preview to confirm backup is OK———

RMAN> run
2> {
3> restore database preview
4> ;
5> }

Starting restore at 25-AUG-13
Starting implicit crosscheck backup at 25-AUG-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=63 device type=DISK
Crosschecked 3 objects
Finished implicit crosscheck backup at 25-AUG-13

Starting implicit crosscheck copy at 25-AUG-13
using channel ORA_DISK_1
Finished implicit crosscheck copy at 25-AUG-13

searching for all files in the recovery area
cataloging files…
no files cataloged

using channel ORA_DISK_1
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
——- —- — ———- ———– ———— —————
3 Full 244.20M DISK 00:00:54 25-AUG-13
BP Key: 3 Status: AVAILABLE Compressed: YES Tag: FULL_DATABASE_OPEN
Piece Name: C:\ORACLEXE\RMAN\RMAN03OI68FH_1_1
List of Datafiles in backup set 3
File LV Type Ckp SCN Ckp Time Name
—- — —- ———- ——— —-
1 Full 10399829954 25-AUG-13 C:\ORACLEXE\APP\ORACLE\ORADATA\XE\SYSTEM.DBF
2 Full 10399829954 25-AUG-13 C:\ORACLEXE\APP\ORACLE\ORADATA\XE\UNDOTBS1.DBF
3 Full 10399829954 25-AUG-13 C:\ORACLEXE\APP\ORACLE\ORADATA\XE\SYSAUX.DBF
4 Full 10399829954 25-AUG-13 C:\ORACLEXE\APP\ORACLE\ORADATA\XE\USERS.DBF
5 Full 10399829954 25-AUG-13 C:\ORACLEXE\APP\ORACLE\ORADATA\XE\USERS01.DBF
6 Full 10399829954 25-AUG-13 C:\USERS.DBF02.DBF

archived logs generated after SCN 10399829548 not found in repository
Media recovery start SCN is 10399829548
Recovery must be done beyond SCN 10399829954 to clear datafile fuzziness
Finished restore at 25-AUG-13

RMAN>
8- ———-Backup is good, Now Restoring the database —————–

RMAN> restore database;

Starting restore at 25-AUG-13
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 C:\ORACLEXE\APP\ORACLE\ORADATA\XE\SYSTEM.DBF
channel ORA_DISK_1: restoring datafile 00002 to C:\ORACLEXE\APP\ORACLE\ORADATA\XE\UNDOTBS1.DBF
channel ORA_DISK_1: restoring datafile 00003 to C:\ORACLEXE\APP\ORACLE\ORADATA\XE\SYSAUX.DBF
channel ORA_DISK_1: restoring datafile 00004 to C:\ORACLEXE\APP\ORACLE\ORADATA\XE\USERS.DBF
channel ORA_DISK_1: restoring datafile 00005 to C:\ORACLEXE\APP\ORACLE\ORADATA\XE\USERS01.DBF
channel ORA_DISK_1: restoring datafile 00006 to C:\USERS.DBF02.DBF
channel ORA_DISK_1: reading from backup piece C:\ORACLEXE\RMAN\RMAN03OI68FH_1_1
channel ORA_DISK_1: piece handle=C:\ORACLEXE\RMAN\RMAN03OI68FH_1_1 tag=FULL_DATABASE_OPEN
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:25
Finished restore at 25-AUG-13

RMAN>

9- ————-recover database using archive logs and redologs————-

SQL> recover database using backup controlfile until cancel;

ORA-00279: change 10399829954 generated at 08/25/2013 12:07:13 needed for
thread 1
ORA-00289: suggestion :
C:\ORACLEXE\APP\ORACLE\FAST_RECOVERY_AREA\XE\ARCHIVELOG\2013_08_25\O1_MF_1_4_%U_
.ARC

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
C:\oraclexe\app\oracle\fast_recovery_area\XE\ONLINELOG\O1_MF_2_91MDOXCB_.LOG
Log applied.
Media recovery complete.

10- Open the database

SQL> alter database open resetlogs;
Database altered.
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
SQL>

————-Completed ————-

Advertisements

About Sher khan

Senior Oracle DBA, Oracle 10g , Oracle 11g OCE ,Oracle 12C and Oracle 11g OPN certified Specialist, OCP Certified in Oracle 9i,10g , 11g and 12C. I am working in Oracle technology since 2004. Currently working in U.A.E Email: sher487@hotmail.com
This entry was posted in rman. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s