Search

Friday, October 14, 2011

Script to Check Backup History

use msdb;

SELECT backupset.database_name,backupset.backup_start_date,backupmediafamily.physical_device_name,(backupset.backup_size/1024)/1000 as size
FROM backupset,backupmediafamily where backupset.media_set_id = backupmediafamily.media_set_id
and datediff(dd,backupset.backup_start_date,getdate()) < 30 and type='l'
order by backupset.database_name,backupset.backup_start_date desc

i=diff
l=log
d=full
===================================================================================
use msdb;


SELECT backupset.database_name,backupset.backup_start_date,backupset.backup_finish_date,backupmediafamily.physical_device_name,(backupset.backup_size/1024)/1000 as size,
backupset.first_lsn,backupset.last_lsn
FROM backupset,backupmediafamily where backupset.media_set_id = backupmediafamily.media_set_id
and datediff(dd,backupset.backup_start_date,getdate()) < 13
and database_name ='TestDatabase'-- and type='l'
order by backupset.database_name,backupset.backup_start_date desc


No comments:

Post a Comment