Monday, 17 December 2018

How to recover database from rman command with example


Hi DBA-Mates,
We would like give a simple demo for how to recover database from rman backup with example.

It is very simple steps. As we all know these steps but for Quick check we can check it.

Please find the below details.
Backup details:
[oracle@localhost backup]$ ls -ltr
total 816752
-rwxrwxrwx 1 oracle oracle 794894336 Dec 12 05:09 ORCL_20181212_5_1_FULL
-rwxrwxrwx 1 oracle oracle   1114112 Dec 12 05:09 ORCL_20181212_6_1_FULL
-rwxrwxrwx 1 oracle oracle   9797632 Dec 12 05:31 ORCL_20181212_7_1_CONTROL
-rwxrwxrwx 1 oracle oracle  29705728 Dec 12 05:46 ORCL_20181212_8_1_ARCHIVE

 [oracle@localhost backup]$ rman target /
Recovery Manager: Release 11.2.0.2.0 - Production on Wed Dec 12 05:58:31 2018
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
connected to target database: ORCL (not mounted)

1. RMAN> startup nomount;
database is already started

2. RMAN> restore controlfile from '/home/oracle/backup/ORCL_20181212_7_1_CONTROL';
Starting restore at 12-DEC-18
using channel ORA_DISK_1
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/home/oracle/app/oracle/oradata/orcl/control01.ctl
output file name=/home/oracle/app/oracle/flash_recovery_area/orcl/control02.ctl
Finished restore at 12-DEC-18

3. RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1

4. RMAN> restore database;
Starting restore at 12-DEC-18
Starting implicit crosscheck backup at 12-DEC-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK
Crosschecked 3 objects
Finished implicit crosscheck backup at 12-DEC-18
Starting implicit crosscheck copy at 12-DEC-18
using channel ORA_DISK_1
Finished implicit crosscheck copy at 12-DEC-18
searching for all files in the recovery area
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/archivelog/2018_12_12/o1_mf_1_565_g1249wpd_.arc
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/orcl/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /home/oracle/app/oracle/oradata/orcl/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /home/oracle/app/oracle/oradata/orcl/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /home/oracle/app/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /home/oracle/app/oracle/oradata/orcl/example01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /home/oracle/app/oracle/oradata/orcl/APEX_1930613455248703.dbf
channel ORA_DISK_1: reading from backup piece /home/oracle/backup/ORCL_20181212_5_1_FULL
channel ORA_DISK_1: piece handle=/home/oracle/backup/ORCL_20181212_5_1_FULL tag=DATABASE_BKP121218
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:03:37
Finished restore at 12-DEC-18

5. RMAN> recover database;
Starting recover at 12-DEC-18
using channel ORA_DISK_1
starting media recovery
archived log for thread 1 with sequence 565 is already on disk as file /home/oracle/app/oracle/flash_recovery_area/ORCL/archivelog/2018_12_12/o1_mf_1_565_g1249wpd_.arc
archived log for thread 1 with sequence 566 is already on disk as file /home/oracle/app/oracle/oradata/orcl/redo02.log
archived log file name=/home/oracle/app/oracle/flash_recovery_area/ORCL/archivelog/2018_12_12/o1_mf_1_565_g1249wpd_.arc thread=1 sequence=565
archived log file name=/home/oracle/app/oracle/oradata/orcl/redo02.log thread=1 sequence=566
media recovery complete, elapsed time: 00:00:01
Finished recover at 12-DEC-18

6. RMAN> alter database open resetlogs;
database opened
RMAN>

SQL> select name,open_mode from v$database;
NAME      OPEN_MODE
--------- --------------------
ORCL      READ WRITE
SQL>

Some more useful links:
Regards,

5 comments:

  1. Hi there! This article could not be written much better! Reading through this article reminds me of my previous roommate!

    He continually kept preaching about this. I am going to forward
    this information to him. Fairly certain he's going to have a great read.
    Thanks for sharing!

    ReplyDelete
  2. Thanks for sharing this amazing blog.It is really an informative post, Ps if you want more then checkout

    Big Data Hadoop Training in Noida
    Oracle DBA Training in noida

    ReplyDelete
  3. Excellent and useful blog admin, really helpful to me. Thanks for sharing.,

    Oracle DBA Online Training

    ReplyDelete
  4. My spouse and I love your blog and find almost all of your posts to be just what I’m looking for. Appreciating the persistence you put into your blog and the detailed information you provide. I found another one blog like you Oracle Cloud Infrastructure .Actually I was looking for the same information on internet for Oracle Cloud Infrastructure and came across your blog. I am impressed by the information that you have on this blog. Thanks once more for all the details.

    ReplyDelete

Thank you for your comments and suggestions. It's good to talk you.