Get BackUp Information of all SQL Server 2005/2008 Databases

I had recently shared a few queries related to SQL Server BackUp over here:

How to do a Full and Differential Database Backup in SQL Server

Verifying and Restoring a Differential Backup using T-SQL In SQL Server

Delete BackUp and Restore History for databases in SQL Server 2005/2008

The msdb database stores details of all backup and restore operations. Now if you want to retrieve back up information of all your databases on your server, then here’s the query to do so:

SELECT database_name, user_name as ExecutedBy, physical_device_name,
backup_finish_date, backup_finish_date
FROM msdb..backupset bckset
INNER JOIN msdb..backupmediafamily bckfmly
ON bckset.media_set_id = bckfmly.media_set_id


Note: I have run this query on a new setup hence do not have many backup’s.

About The Author

Suprotim Agarwal, MCSD, MCAD, MCDBA, MCSE, is the founder of DotNetCurry, DNC Magazine for Developers, SQLServerCurry and DevCurry. He has also authored a couple of books 51 Recipes using jQuery with ASP.NET Controls and a new one recently at The Absolutely Awesome jQuery CookBook.

Suprotim has received the prestigous Microsoft MVP award for nine times in a row now. In a professional capacity, he is the CEO of A2Z Knowledge Visuals Pvt Ltd, a digital group that represents premium web sites and digital publications comprising of Professional web, windows, mobile and cloud developers, technical managers, and architects.

Get in touch with him on Twitter @suprotimagarwal, LinkedIn or befriend him on Facebook


Avinash Desai said...

hey its good stuff

Nate said...

Thanks for the script. Had a question regarding output. I've got several lines per DB per day, and some of the physical_device_name outputs look like {59569BB3-0139-4BE0-83D8-BDBD990266EF}7. What is that about?

Thanks again!