Get the last database backup for all databases in a SQL Server instance

I don’t like to publish small code snippets, but I’ve just rewritten one of my most used SQL scripts for SQL Server that gets the details about the last backup for every database (for both backup database and backup log).

It now makes use of with () and rank() over() to make it much easier to read and modify.

So I think it’s worth to share it.

As you can see, modify it to include for example incremental backups should be very easy.

Cheers

Ludo

The following two tabs change content below.

Ludovico

Oracle ACE and Senior Consultant at Trivadis SA
Ludovico is an Oracle ACE Director, frequent speaker and community contributor, working as Senior Database Specialist for Trivadis, Switzerland.

4 thoughts on “Get the last database backup for all databases in a SQL Server instance

  1. Pingback: Get the last database backup for all databases in a SQL Server instance - Ludovico Caldara - Blogs - triBLOG

  2. Certainly, or wrap an SSRS report aronud the data for presentation. The information presented here is just like any other SQL query and can be made available through a variety of presentation layers.

  3. Pingback: Need help with this backup audit SQL Server script | Question and Answer

Leave a Reply

Your email address will not be published. Required fields are marked *