Skip to content

Netezza – Scripts to find databases without backups

1) Databases without Successful Full Backup for 15 days

Select unique a.dbname DatabaseName from
(
select dbname, status, max(starttime) starttime from _v_backup_history where starttime> (CURRENT_TIMESTAMP-15) and OPTYPE='FULL'
group by dbname,status
) a,
(
select dbname, status, max(starttime) starttime from _v_backup_history where starttime> (CURRENT_TIMESTAMP-15)
and status = 'FAILED' and OPTYPE='FULL'
group by dbname,status
) b
where
a.dbname = b.dbname and b.starttime>=a.starttime

2) Databases without any backup – lifetime

select datname DatabaseName from _T_database
where datname not in
(select dbname from _v_backup_history)
and datname not like 'MASTER_DB'

No comments yet

Leave a Reply

You may use basic HTML in your comments. Your email address will not be published.

Subscribe to this comment feed via RSS