Performing Block Media Recovery using RMAN

Oracle Version :- 11g
Os Version:-    Rhel 6.4

To demonstrate this scenario we need some corrupted datablocks on some data files.

So here we will corrupt a data block manually in order to test the block recovery feature of RMAN.

Step 1:-We will create a user and will grant him dba privilge.

[oracle@server1 ~]$ sqlplus /  as sysdba

SQL> create user soumya identified by soumya;
User created.

SQL> grant dba to soumya;
Grant succeeded.


Step 2:- Now create a table inside the newly created user
SQL> conn soumya/soumya
Connected.
SQL> create table tbs_corruption (id number);
Table created.

SQL> insert into tbs_corruption values (1);
1 row created.

SQL> commit;
Commit complete.

Step 3:-Now we will take rman backup of database
[oracle@server1 ~]$ rman target /

RMAN> backup database plus archivelog;
Starting backup at 17-JAN-15
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=39 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=6 RECID=1 STAMP=869264964
input archived log thread=1 sequence=7 RECID=2 STAMP=869265416
channel ORA_DISK_1: starting piece 1 at 17-JAN-15
channel ORA_DISK_1: finished piece 1 at 17-JAN-15
piece handle=/u01/app/oracle/rman_backup/PRIM_DB_07psvs08_7_1 tag=TAG20150117T223656 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 17-JAN-15

Starting backup at 17-JAN-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/prim/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/prim/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/prim/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/prim/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/prim/users01.dbf
channel ORA_DISK_1: starting piece 1 at 17-JAN-15
channel ORA_DISK_1: finished piece 1 at 17-JAN-15
piece handle=/u01/app/oracle/rman_backup/PRIM_DB_08psvs0a_8_1 tag=TAG20150117T223657 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:05
Finished backup at 17-JAN-15

Starting backup at 17-JAN-15
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=8 RECID=3 STAMP=869265483
channel ORA_DISK_1: starting piece 1 at 17-JAN-15
channel ORA_DISK_1: finished piece 1 at 17-JAN-15
piece handle=/u01/app/oracle/rman_backup/PRIM_DB_09psvs2c_9_1 tag=TAG20150117T223804 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 17-JAN-15

Starting Control File and SPFILE Autobackup at 17-JAN-15
piece handle=/u01/app/oracle/flash_recovery_area/PRIM/autobackup/2015_01_17/o1_mf_s_869265485_bco5qp79_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 17-JAN-15

Step 4:-Now we will find out the datablock number which we need to restore
[oracle@server1 ~]$ sqlplus /  as sysdba
SQL> conn soumya/soumya
Connected.
SQL>  select HEADER_BLOCK from dba_segments where segment_name='TBS_CORRUPTION';

HEADER_BLOCK
------------
         522

The header block of the segment is 522.We are going to corrupt the next data block which is 523.

Step 5:- We will check in which datafile the above data block exists.
SQL> select a.name from v$datafile a, dba_segments b
  2  where a.file#=b.header_file and b.segment_name='TBS_CORRUPTION';

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/prim/users01.dbf

So the table is  stored inside users01.dbf datafile.

Step 6:-Now lets corrupt the datafile
[oracle@server1 ~]$ dd of=/u01/app/oracle/oradata/prim/users01.dbf bs=8192 conv=notrunc seek=523 <<EOF
> testing corruption
> EOF
0+1 records in
0+1 records out
19 bytes (19 B) copied, 5.8942e-05 s, 322 kB/s

Now we have successfully corrupted the datafile

Step 7:- Now we need to flush the database buffer cache
[oracle@server1 ~]$ sqlplus soumya/soumya
SQL> alter system flush buffer_cache;
System altered.

SQL> select * from tbs_corruption;
select * from tbs_corruption
              *
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 4, block # 523)
ORA-01110: data file 4: '/u01/app/oracle/oradata/prim/users01.dbf'

Step 8:-Now we will do block media recovery using rman
[oracle@server1 ~]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jan 17 23:15:40 2015

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

connected to target database: PRIM (DBID=4130009889)

RMAN> blockrecover datafile 4 block 523;

Starting recover at 17-JAN-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=49 device type=DISK

channel ORA_DISK_1: restoring block(s)
channel ORA_DISK_1: specifying block(s) to restore from backup set
restoring blocks of datafile 00004
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/rman_backup/PRIM_DB_0cpsvs3b_12_1
channel ORA_DISK_1: piece handle=/u01/app/oracle/rman_backup/PRIM_DB_0cpsvs3b_12_1 tag=TAG20150117T223835
channel ORA_DISK_1: restored block(s) from backup piece 1
channel ORA_DISK_1: block restore complete, elapsed time: 00:00:01

starting media recovery
media recovery complete, elapsed time: 00:00:03

Finished recover at 17-JAN-15

RMAN> exit

Now recovery has been done. we will check the table's data now
[oracle@server1 ~]$ sqlplus soumya/soumya
SQL> select * from tbs_corruption;

        ID
----------
         1

So we have successfully recovered the corrupted data block .






Noarchivelog database recovery on oracle 11g

Oracle Version:- Oracle 11g


Scenario: Database is in nonarchive log mode. And all the datafiles , redologfiles and controlfiles have been lost.Rman backup is present.
And only controlfile is present from multiplexed location.

Solution:-

SQL> select log_mode from V$database;

LOG_MODE
------------
NOARCHIVELOG

SQL> select name from V$DATAFILE;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/prim/system01.dbf
/u01/app/oracle/oradata/prim/sysaux01.dbf
/u01/app/oracle/oradata/prim/undotbs01.dbf
/u01/app/oracle/oradata/prim/users01.dbf
/u01/app/oracle/oradata/prim/example01.dbf
/u01/app/oracle/oradata/prim/somtbs.dbf

Now let's see what happens when I move all datafiles, redo log and control files to another directory
simulating a disks failure. I assume for this scenario to be able to get back with a consistent copy of at least one multiplexed control files.

[oracle@server1 prim]$ cd /u01/app/oracle/oradata/prim
[oracle@server1 prim]$ ls -ltrh
total 1.6G
drwxr-xr-x  2 oracle oinstall 4.0K Oct 20 22:15 temp
-rw-r-----  1 oracle oinstall  51M Oct 20 22:23 redo02.log
-rw-r-----  1 oracle oinstall  51M Oct 20 22:23 redo03.log
-rw-r-----  1 oracle oinstall 5.1M Oct 20 22:23 users01.dbf
-rw-r-----  1 oracle oinstall 101M Oct 20 22:23 example01.dbf
-rw-r-----  1 oracle oinstall 101M Oct 20 22:23 somtbs.dbf
-rw-r-----  1 oracle oinstall  21M Oct 20 22:23 temp01.dbf
-rw-r-----  1 oracle oinstall 681M Oct 20 22:29 system01.dbf
-rw-r-----  1 oracle oinstall  56M Oct 20 22:29 undotbs01.dbf
-rw-r-----  1 oracle oinstall 511M Oct 20 22:29 sysaux01.dbf
-rw-r-----  1 oracle oinstall  51M Oct 20 22:30 redo01.log
-rw-r-----. 1 oracle oinstall 9.3M Oct 20 22:30 control01.ctl

[oracle@server1 prim]$ mkdir temp
[oracle@server1 prim]$ mv *.* temp

Now lets try to shutdown the running database:-
SQL> shut immediate;
Database closed.
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/prim/control01.ctl'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

Well it doesn't work. Of course the instance is not able to find and write any SCN on the
current control file. So issue the following command

SQL> shutdown abort; 
ORACLE instance shut down. 
Let's see what happens when an instance is not able to find a control file. The instance is not
able to be open in MOUNT mode

[oracle@localhost old]$ sqlplus / as sysdba 
SQL> startup mount; 
ORACLE instance started. 
 
Total System Global Area  456146944 bytes 
Fixed Size                  1344840 bytes 
Variable Size             352324280 bytes 
Database Buffers           96468992 bytes 
Redo Buffers                6008832 bytes 
ORA-00205: error in identifying control file, check alert log for more info 
 
SQL> shutdown immediate; 
ORA-01507: database not mounted 
 
ORACLE instance shut down. 
SQL> exit 

Since you have lost all your database files except one control file that was wisely multiplexed
on another disk (in my case it's in the flash recovery area path). We can use it to mount the
database, copying it to the original location.

[oracle@server1 prim]$ cd /u01/app/oracle/flash_recovery_area/prim
[oracle@server1 prim]$ ls -ltrh
-rw-r----- 1 oracle oinstall 9.3M Oct 20 22:40 control02.ctl
[oracle@server1 prim]$ cp control02.ctl /u01/app/oracle/oradata/prim/
[oracle@server1 prim]$ mv control02.ctl control01.ctl

Now the instance is able to open in mount mode using the CURRENT control file .
SQL> startup mount
ORACLE instance started.

Total System Global Area  413372416 bytes
Fixed Size                  2213896 bytes
Variable Size             314574840 bytes
Database Buffers           92274688 bytes
Redo Buffers                4308992 bytes
Database mounted.

SQL> select controlfile_type from v$database; 
 
CONTROL 
------- 
CURRENT 

[oracle@server1 prim]$ rman target /
RMAN> restore database;

Also check in OS level that after restore the database all datafiles are back.

Now it's time to open the database using the resetlogs option, but...

SQL> alter database open resetlogs; 
alter database open resetlogs 

ERROR at line 1: 
ORA-01139: RESETLOGS option only valid after an incomplete database recovery 

The following error happens because on the restored datafiles is written an SCN that was valid
at the time the backup was taken and equal to the control file of that moment.
The control file we are using is ahead compared with the SCN written on the datafiles...
You have to perform ("simulate") an incomplete recovery, typing CANCEL when requested

SQL> recover database until cancel;
ORA-00279: change 1214685 generated at 10/20/2014 22:05:35 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/PRIM/archivelog/2014_10_20/o1_mf_1_34_%u_.arc
ORA-00280: change 1214685 for thread 1 is in sequence #34


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/u01/app/oracle/flash_recovery_area/PRIM/archivelog/2014_10_20/o1_mf_1_34_%u_.arc
ORA-00308: cannot open archived log
'/u01/app/oracle/flash_recovery_area/PRIM/archivelog/2014_10_20/o1_mf_1_34_%u_.a
rc'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
[Here type Cancel]
cancel
Media recovery cancelled.
SQL> alter database open resetlogs;

Database altered.

SQL> select open_mode from v$database;

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

SQL> select name from V$DATAFILE;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/prim/system01.dbf
/u01/app/oracle/oradata/prim/sysaux01.dbf
/u01/app/oracle/oradata/prim/undotbs01.dbf
/u01/app/oracle/oradata/prim/users01.dbf
/u01/app/oracle/oradata/prim/example01.dbf

Now the database has been restored to the time when it was backed up.

Expdp backup using shell script in oracle 11g

Oracle Version: oracle 11g
OS Version:- RHEL 6


[oracle@server1 ~]$ mkdir /backups/db_backup/
[oracle@server1 ~]$ chown -Rf oracle:oinstall /backups/db_backup/
[oracle@server1 ~]$ sqlplus / as sysdba
SQL> CREATE DIRECTORY backup AS '/backups/db_backup/';
SQL> exit

# vi /home/oracle/expdp_backup.sh

#!/bin/bash
export PS1="`/bin/hostname -s`-> "
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=soumyadb
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
path1=/backups/db_backup
date1=`date +%d%m%y_%H%M%S`
/u01/app/oracle/product/11.2.0/db_1/bin/expdp system/system full=y directory=backup dumpfile=backup_$date1.dmp logfile=log_$date1.log exclude=statistics
cd /backups/db_backup/
/bin/tar -zcvf /backups/db_backup/backup_$date1.tar.gz backup_$date1.dmp

:wq



Now schedule the script inside crontab:-
#The expdp script will run everynight at 12 A.M
#crontab -e
0 0 * * * /home/oracle/expdp_backup.sh > /dev/null

Performing Disaster Recovery with RMAN

Here i'm trying to do the disaster recovery using RMAN.

Primary machine:192.168.2.102
Secondary Machine:192.168.2.104

In primary machine:-
[oracle@server1 ~]$ sqlplus /  as sysdba
SQL> select name from v$database;

NAME
---------
PRIM

Now creating a table and we will check it on the secondary machine which i would use for distaster recovery.
SQL> create table students (name varchar(20));

Table created.


SQL> insert into students values ('soumya');

1 row created.


SQL> commit;

Commit complete.

#Now I will take rman backup of the database.Also i need to make sure
control autobackup on option is enabled.

rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Sun Jan 11 12:05:08 2015

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

connected to target database: PRIM (DBID=4130009889)

RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name PRIM are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/app/%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_prim.f'; # default

As we can see CONTROLFILE AUTOBACKUP ON OPTION IS ENABLED.NOW we will start taking the backup.

RMAN> backup database plus archivelog;

#Now we need to create the directory structures for datafile, controlfile, redolog file and spfile in secondary database as of primary database.
To get the list of directory structure we will check the data dictionary view.

[oracle@server1 ~]$ sqlplus /  as sysdba
#To list all datafiles location:-
SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/prim/system01.dbf
/u01/app/oracle/oradata/prim/sysaux01.dbf
/u01/app/oracle/oradata/prim/undotbs01.dbf
/u01/app/oracle/oradata/prim/users01.dbf
/u01/app/oracle/oradata/prim/example01.dbf
/u01/app/oracle/oradata/prim/testtbs.dbf
/u01/app/oracle/oradata/prim/testtbs1.dbf

#To list all redolog file's location:-
SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/prim/redo03.log
/u01/app/oracle/oradata/prim/redo02.log
/u01/app/oracle/oradata/prim/redo01.log

#To list the all controlfile's location:-
SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/prim/control01.ctl
/u01/app/oracle/flash_recovery_area/prim/control02.ctl

#To list the directory where tracefile resides:-
SQL> show parameter dump_dest;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
background_dump_dest                 string      /u01/app/oracle/diag/rdbms/pri
                                                 m/prim/trace
core_dump_dest                       string      /u01/app/oracle/diag/rdbms/pri
                                                 m/prim/cdump
user_dump_dest                       string      /u01/app/oracle/diag/rdbms/pri
                                                 m/prim/trace

#Now we would create the directory structure for secondary database:-

In seondary database:-
[oracle@server2 ~]$ mkdir -p /u01/app/oracle/oradata/prim/
[oracle@server2 ~]$ mkdir -p /u01/app/oracle/flash_recovery_area/prim
[oracle@server2 ~]$ mkdir -p /u01/app/oracle/diag/rdbms/prim/prim
[oracle@server2 ~]$ mkdir -p /u01/app/oracle/diag/rdbms/prim/prim/adump
[oracle@server2 ~]$ mkdir -p /u01/app/oracle/diag/rdbms/prim/prim/bdump
[oracle@server2 ~]$ mkdir -p /u01/app/oracle/diag/rdbms/prim/prim/cdump
[oracle@server2 ~]$ mkdir -p /u01/app/oracle/diag/rdbms/prim/prim/udump
[oracle@server2 ~]$ chown -Rf oracle:oinstall /u01

#Now we can delete all the datafiles from the primary database if we want to.

#Now we will copy all the backup files into the secondary database machine.

[oracle@server2 ~]$ export ORACLE_SID=prim
[oracle@server2 ~]$ cd $ORACLE_HOME
[oracle@server2 db_1]$ pwd
/u01/app/oracle/product/11.2.0/db_1

We would like to paste the backup file into /tmp/backup location.
[oracle@server1 ~]$ mkdir -p /tmp/backup

#Now transferring backup from primary database server to secondary
#In primary database server:-
[oracle@server1 ~]$ cd /u01/app/oracle/flash_recovery_area/PRIM/backupset/2015_01_11
[oracle@server1 2015_01_11]$ scp -r * oracle@192.168.2.104:/tmp/backup/
#copy the archivelogs:-
[oracle@server1 2015_01_11]$ cd /u01/app/oracle/flash_recovery_area/PRIM/archivelog/2015_01_11
[oracle@server1 2015_01_11]$ scp * oracle@192.168.2.104:/tmp/backup/

#Now in secondary database server:-
[oracle@server2 u01]$ export ORACLE_SID=prim
[oracle@server2 u01]$ rman target /
#We are starting the database in nomount stage using dummy parameter file
RMAN> startup nomount
Oracle instance started

Total System Global Area     413372416 bytes

Fixed Size                     2213896 bytes
Variable Size                318769144 bytes
Database Buffers              88080384 bytes
Redo Buffers                   4308992 bytes

#Now we will restore spfile from our rman backup set
RMAN>  restore spfile from '/u01/c-4130009889-20150111-00';
Starting restore at 11-JAN-15
using channel ORA_DISK_1

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /tmp/backup/c-4130009889-20150111-00
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 11-JAN-15

#Now restore controlfile from Autobackup:-
MAN> shutdown

Oracle instance shut down

RMAN> startup nomount

connected to target database (not started)
Oracle instance started

Total System Global Area     413372416 bytes

Fixed Size                     2213896 bytes
Variable Size                327157752 bytes
Database Buffers              79691776 bytes
Redo Buffers                   4308992 bytes

RMAN> restore controlfile from ' /tmp/backup/c-4130009889-20150111-00';

Starting restore at 11-JAN-15
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=/u01/app/oracle/oradata/prim/control01.ctl
output file name=/u01/app/oracle/flash_recovery_area/prim/control02.ctl
Finished restore at 11-JAN-15

#Now open database in mount stage
RMAN> startup mount force

Oracle instance started
database mounted

Total System Global Area     413372416 bytes

Fixed Size                     2213896 bytes
Variable Size                327157752 bytes
Database Buffers              79691776 bytes
Redo Buffers                   4308992 bytes

#Now restore the datafiles
RMAN> restore database;

Starting restore at 11-JAN-15
Starting implicit crosscheck backup at 11-JAN-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 device type=DISK
Crosschecked 17 objects
Finished implicit crosscheck backup at 11-JAN-15

Starting implicit crosscheck copy at 11-JAN-15
using channel ORA_DISK_1
Finished implicit crosscheck copy at 11-JAN-15

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

using channel ORA_DISK_1

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 01/11/2015 13:57:48
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 5 found to restore
RMAN-06023: no backup or copy of datafile 4 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 2 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore

#we can see the above error while trying to restore the datafiles.Cause rman cant find the datafiles
in its repository.

RMAN> catalog start with '/tmp/backup';
searching for all files that match the pattern /tmp/backup

List of Files Unknown to the Database
=====================================
File Name: /tmp/backup/o1_mf_nnndf_TAG20150111T121621_bc471yc8_.bkp
File Name: /tmp/backup/o1_mf_annnn_TAG20150111T121747_bc474ms3_.bkp
File Name: /tmp/backup/o1_mf_annnn_TAG20150111T121611_bc471w8w_.bkp
File Name: /tmp/backup/c-4130009889-20150111-00
File Name: /tmp/backup/o1_mf_1_1_bc45yfkg_.arc
File Name: /tmp/backup/o1_mf_1_2_bc471lpp_.arc
File Name: /tmp/backup/o1_mf_annnn_TAG20150111T121611_bc471v5c_.bkp
File Name: /tmp/backup/o1_mf_annnn_TAG20150111T121611_bc471mz6_.bkp
File Name: /tmp/backup/o1_mf_1_3_bc474md4_.arc

Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /tmp/backup/o1_mf_nnndf_TAG20150111T121621_bc471yc8_.bkp
File Name: /tmp/backup/o1_mf_annnn_TAG20150111T121747_bc474ms3_.bkp
File Name: /tmp/backup/o1_mf_annnn_TAG20150111T121611_bc471w8w_.bkp
File Name: /tmp/backup/c-4130009889-20150111-00
File Name: /tmp/backup/o1_mf_1_1_bc45yfkg_.arc
File Name: /tmp/backup/o1_mf_1_2_bc471lpp_.arc
File Name: /tmp/backup/o1_mf_annnn_TAG20150111T121611_bc471v5c_.bkp
File Name: /tmp/backup/o1_mf_annnn_TAG20150111T121611_bc471mz6_.bkp
File Name: /tmp/backup/o1_mf_1_3_bc474md4_.arc

RMAN> restore database;
#Once restoring of datafiles are done, we will recover the database.

RMAN> recover database;
#The above step will recover the database along with backed up archivelogs.Now we will open the database with resetlogs option.

RMAN> alter database open resetlogs;

database opened


#Now check the table which we created at primary database.
[oracle@server2 backup]$ sqlplus /  as sysdba
SQL> select * from students;

NAME
--------------------
soumya


Done...
Related Posts Plugin for WordPress, Blogger...