the following query will show the last full/incremental/archivelog/controlfile backup.
select name, full, inc, log, ctl
from
rman.rc_database d,
(select db_id, max(START_TIME) full
from rman.rc_backup_set s
where s.backup_type in ('D')
and controlfile_included = 'NONE'
group by db_id) f,
(select db_id, max(START_TIME) inc
from rman.rc_backup_set s
where s.backup_type in ('I')
group by db_id) i,
(select db_id, max(START_TIME) log
from rman.rc_backup_set s
where s.backup_type in ('L')
group by db_id) l,
(select db_key, max(completion_TIME) ctl
from rman.rc_backup_controlfile s
group by db_key) c
where f.db_id(+) = d.dbid
and i.db_id(+) = d.dbid
and l.db_id(+) = d.dbid
and c.db_key(+) = d.db_key
order by 1
sample output shown below.
NAME FULL INC LOG CTL
-------- ----------------- ----------------- ----------------- -----------------
datab1 17-feb-2011:01:09
datab2 29-may-2011:18:30 31-may-2011:18:10 31-may-2011:18:13 31-may-2011:18:22
datab3 27-apr-2011:14:39 06-apr-2011:17:49 03-may-2011:09:29
select name, full, inc, log, ctl
from
rman.rc_database d,
(select db_id, max(START_TIME) full
from rman.rc_backup_set s
where s.backup_type in ('D')
and controlfile_included = 'NONE'
group by db_id) f,
(select db_id, max(START_TIME) inc
from rman.rc_backup_set s
where s.backup_type in ('I')
group by db_id) i,
(select db_id, max(START_TIME) log
from rman.rc_backup_set s
where s.backup_type in ('L')
group by db_id) l,
(select db_key, max(completion_TIME) ctl
from rman.rc_backup_controlfile s
group by db_key) c
where f.db_id(+) = d.dbid
and i.db_id(+) = d.dbid
and l.db_id(+) = d.dbid
and c.db_key(+) = d.db_key
order by 1
sample output shown below.
NAME FULL INC LOG CTL
-------- ----------------- ----------------- ----------------- -----------------
datab1 17-feb-2011:01:09
datab2 29-may-2011:18:30 31-may-2011:18:10 31-may-2011:18:13 31-may-2011:18:22
datab3 27-apr-2011:14:39 06-apr-2011:17:49 03-may-2011:09:29
this is incorrect and showing incorrect data.
ReplyDelete