Finding Last Backup Date in SQL Server 2005

I saw a question on the SO forums asking for a simple way to find the last backup date of a SQL Server 2005 database. Here's one approach.

SQL Server Last Backup

During a backup operation, the following tables are updated in SQL Server 2005:
  • msdb.dbo.backupfile,
  • msdb.dbo.backupmediaset ,
  • msdb.dbo.backupmediafamily and
  • msdb.dbo.backupset.
Here we are doing a join between sys.sysdatabase and msdb.dbo.backupset which gets us the database name, the last backup date and who took the backup. sys.sysdatabase is queried as it contains one row for each database in an instance of Microsoft SQL Server.

OUTPUT

SQL Server BackUp

1 comment:

  1. Simone has is using great examples using churches and monasteries but too long to type all of that out here.draas.biz

    ReplyDelete