Wednesday, February 3, 2010

Backp and Restore Dates

Some times we need to know when the database had its last backup or restore

msdb Database holds the details of all the Backups and Restores happened on a server.

backupset table holds the details of Backups
restorehistory table holds the details of Restores.

Below scripted code will bring the list of backup and Restore for the given database.

Here we GO..!!

Code to list Backup.
select database_name,backup_finish_date ,user_name from msdb..backupset
where database_name='DatabaseName'
order by backup_finish_date desc

Code to list Restore.
select destination_database_name,restore_date,user_name from msdb..restorehistory
where destination_database_name='DatabaseName'
order by restore_date desc

No comments:

Post a Comment