When you have to restore a database from RMAN backup, last thing you want to do is to identify which backups, tapes and dates you need to use for database restore. There are few sql commands that can be very handy in order to extract those details.
column handle format a60
column media format a10
column tag format a20
column start_time format a20
column name format a10
set lines 200
to_char(s.start_time, 'DD-MON-YY HH24:MI') start_time,
s.elapsed_seconds/60 "MINUTES", p.backup_type
from RC_DATABASE d, RC_BACKUP_PIECE p, RC_BACKUP_SET s
where
d.name='ELPM' and
d.db_key = p.db_key and
s.db_key = p.db_key and
p.bs_key = s.bs_key and
s.start_time between to_date('08-SEP-11 00:00','dd-MON-yy hh24:mi')
and to_date('10-SEP-11 00:00','dd-MON-yy hh24:mi')
$>rman connect target / nocatalog
RMAN> restore database preview summary;
column handle format a60
column media format a10
column tag format a20
column start_time format a20
column name format a10
set lines 200
to_char(s.start_time, 'DD-MON-YY HH24:MI') start_time,
s.elapsed_seconds/60 "MINUTES", p.backup_type
from RC_DATABASE d, RC_BACKUP_PIECE p, RC_BACKUP_SET s
where
d.name='ELPM' and
d.db_key = p.db_key and
s.db_key = p.db_key and
p.bs_key = s.bs_key and
s.start_time between to_date('08-SEP-11 00:00','dd-MON-yy hh24:mi')
and to_date('10-SEP-11 00:00','dd-MON-yy hh24:mi')
Above script can give you backup details by providing database name and dates after connecting to RMAN repository.
Another method is to connect to RMAN prompt using control file
RMAN> restore database preview summary;
No comments:
Post a Comment