0% found this document useful (0 votes)
12 views3 pages

PDF00075_Great Tips on Table Recovery with RMAN Backup

Uploaded by

syed.cse38
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

PDF00075_Great Tips on Table Recovery with RMAN Backup

Uploaded by

syed.cse38
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Great Tips on Table Recovery with RMAN Backup

Great Tips on Table Recovery with RMAN Backup

M ost database administrators face the scenario when they have to recover some specific table
that dropped/truncated during a RMAN backup. Most of the times the goal is to recover a single
table and not all objects in the tablespace.

Suppose our target database is on host A and we want to restore the database on host B. Both
of them have different directory structures. The table to be recovered is named MYTABLE and is
located on MYTABLESPACE tablespace. Also we do not want ORACLE_SID to be changed for
restored database. The steps required to recover the MYTABLE table are discussed as follows.

Backup controlfile and archived logs:

First of all we need to backup the controlfile and move all archived logs to host B. The archive
logs will be from the time you performed the backup.

sqlplus>alter database backup controlfile to ‘/oracle/control.ctl';

Datafile Locations:

The file number and location of datafile will be changed on host B. Therefore you need to keep
track of the file numbers and names on host A. You can retrieve this information by running
below command.

sqlplus> select file#, name from v$datafile;

file# name
—– ————————————————
1 /oracle/orcl/oradata/system01.dbf
2 /oracle/ orcl/oradata/users.dbf
3 /oracle/orcl/oradata/undo01.dbf
4 /oracle/orcl/oradata/tools01.dbf
5 /oracle/orcl/oradata/mytable01.dbf
6 /oracle/orcl/oradata/mytable02.dbf
7 /oracle/orcl/oradata/undo02.dbf
8 /oracle/orcl/oradata/rcvcat.dbf

Locating backups:

The backup sets must be located in the same directory where it was written during backup. For
disk backups you either set up an NFS directory mounted on both host A and B or you can use
symbolic links on host B.

Availability of init.ora on Host B:

Make sure that init.ora is available on host B including any location specific parameters such as
ifile, log_archive_dest*, *_dump_dest or control file backup taken on Host A.

Allowing RMAN Remote connections:

http://www.articles.freemegazone.com/table-recovery-rman-backup.php

PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com


Great Tips on Table Recovery with RMAN Backup

You must set up a password file for duplicated database in order to allow RMAN remote
connections.

$orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=oracle

Database Recovery:

Now you need to perform below steps on Host B in order to recover the database.

First you will run startup nomount command.

sqlplus> startup nomount pfile=<location of init.ora>

Then run below command to mount the database.

sqlplus> alter database mount;

You can use RMAN for changing datafiles location from the location on host A to host B. However
it is necessary to restore both undo tablespaces if you keep switching between two undo
tablespaces in your database.

RMAN> run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
set newname for datafile 1 to ‘/oracle/datafiles/system01.dbf';
set newname for datafile 3 to ‘/oracle/datafiles/undo01.dbf';
set newname for datafile 5 to ‘/oracle/datafiles/mytable01.dbf';
set newname for datafile 6 to ‘/oracle/datafiles/mytable02.dbf';
set newname for datafile 7 to ‘/oracle/datafiles/undo02.dbf';
restore tablespace SYSTEM;
restore tablespace UNDOTBS1;
restore tablespace MYTABLESPACE;
switch datafile all;
}

Now you will perform incomplete recovery. Instead of restoring whole database backup you can
save space and time by making offline tablespaces datafiles that need not to be restored such as
datafiles other than SYSTEM, UNDOTBS1 and MYTABLESPACE.

sqlplus>alter database datafile 2 offline drop;


alter database datafile 4 offline drop;
alter database datafile 8 offline drop;
sqlplus> recover database using backup controlfile until cancel; (or until time)

Apply the archived redo log files to the point just before the table was dropped. Once you have
required archived redo log files in the log_archive_dest directory then you can stop the recovery
process by typing cancel at the prompt.

Before opening the database you must rename the logfiles by issuing below command.

sqlplus> alter database rename file ‘<host A location>' to ‘<host B location>';

http://www.articles.freemegazone.com/table-recovery-rman-backup.php

PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com


Great Tips on Table Recovery with RMAN Backup

sqlplus> alter database open resetlogs;

Finally you can query the table MYTABLE to find out the data. If your required table is recovered
then you can export the table and import it to your target database.

http://www.articles.freemegazone.com/table-recovery-rman-backup.php

PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com

You might also like