Question: How can I see the number of days
since my last backup?
It is easy to see the number of days since the last backup in
MSSQL, but I need to know how to see the backup frequency in Oracle.
Answer: There are many ways to see the
number of days since your last Oracle backup.
Unlike MS-SQL, Oracle provides many backup methods:
- 3rd party backup tools (Symantec, Veritas, Omniback
etc.)
If you are using RMAN for your backups, there is a catalog
database you can query with as set of RMAN commands:
RMAN> list archivelog all backed up 1 times to
device type xxx;
You can see the frequency and dates of backups using the RMAN
catalog tables:
Or query the v$ views for RMAN backup completion
details:
These RMAN SQL queries will all find the number of days since the
last database backup:
--
*****************************************
-- SQL for v$backup_set to
see last backup
--
*****************************************
select
*
from
v$backup_set
where
completion_time > sysdate-7
order by
completion_time desc;
--
*****************************************
-- SQL for rc_backup_set
to see most recent backup
-- *****************************************
select *
from
rc_backup_set
where
completion_time > sysdate-7
order by
completion_time desc;
--
*****************************************
-- Display most recently
completed RMAN backup
-- *****************************************
select *
from
rc_backup_set
where
backup_type = 'D'
and
controlfile_included = 'BACKUP'
order by
completion_time desc
--
*****************************************
-- Display
newest_backupset_time for RMAN backup
-- *****************************************
select
db_name,
newest_backup_time
from
rman.rc_backupset_summary
where
dn_name = 'MKYSID';
--
*****************************************
-- You can also outer join
rc_backupset_summary
-- into
rc_database
to see the RMAN latest backup start time:
--
*****************************************
select
name,
max(start_time)
from
rman.rc_database d,
rman.rc_backup_set s
where
db_id(+) = dbid
group by
name
order by 2 desc;
--
*****************************************
-- Display RMAN backupo
status start and end times:
-- *****************************************
select
operation,
status,
object_type,
to_char(start_time,'mm/dd/yyyy:hh:mi:ss') as start_time,
to_char(end_time,'mm/dd/yyyy:hh:mi:ss') as end_time
from
v$rman_status
where
start_time > SYSDATE -1
and
operation = 'BACKUP'
and
object_type = 'DB FULL'
order by
start_time desc;
There are many more permutations of RMAN queries to see the
latest backup details, see the
Oracle RMAN book for details.
|
|
Get the Complete
Oracle SQL Tuning Information
The landmark book
"Advanced Oracle
SQL Tuning The Definitive Reference" is
filled with valuable information on Oracle SQL Tuning.
This book includes scripts and tools to hypercharge Oracle 11g
performance and you can
buy it
for 30% off directly from the publisher.
|