May 13, 2013

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


Did you like this post?
kick it on DotNetKicks.com
subscribe via rss subscribe via e-mail
print this post follow me on twitter


About The Author

Suprotim Agarwal, ASP.NET Architecture MVP works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He has also written an EBook 51 Recipes using jQuery with ASP.NET Controls.

Follow him on twitter @suprotimagarwal

 
  Feedback:

comments

1 Response to "Finding Last Backup Date in SQL Server 2005"
  1. usman khatri said...
    June 9, 2014 at 8:37 AM

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

 

Copyright © 2009-2014 All Rights Reserved for SQLServerCurry.com by Suprotim Agarwal | Terms and Conditions