Finding Last Backup Date in SQL Server 2005

Finding Last Backup Date in SQL Server 2005

Monday, May 13, 2013 Posted by Suprotim Agarwal
Labels: SQL Server Administration, Transact SQL T-SQL

Tweet
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

你可能感兴趣的:(Finding Last Backup Date in SQL Server 2005)