There are at times when different teams have control over a particular server but you have the responsibility of restoring the database in case of disater. This is a tricky situation. If you dont have a policy regarding backups? You should have a record of recent backups in the server for each databases. If you have knowledge on say when was latest full/differential/log backup taken on a particualr database, you will not be totally lost in time of a catastrophe. If you are new to the environement, this script will give you an idea of what backup plan goes on each database. Especially if you administer multiple servers, it will help you document your backup locations.
How to use the script
The procedure uses msdb to get the relevent backups you need to look at.
The Procedure can be executed in 3 ways.
- EXEC USP_DBA_RECENTBACKUPS: This will detail all recent backups of all types (Full, differential and log ) for each database. Eg. If you take only full backups you will find only one record for each server.
- EXEC USP_DBA_RECENTBACKUPS '<DBNAME>': The same result as above. But here you are ineterested in a single database. It will list all recent backups of all types for the given databse.
- EXEC USP_DBA_RECENTBACKUPS '<DBNAME>','R': If you are having a simple backup plan of Full, differential and log backups, you can use this syntax to see what you need to restore the database. It will list latest full backup, latest differntial backup, and all the log backups therafter.
Hope this script will be useful for you.
- There is no guarentee that the files listed in the backup history is available in the location. chances are someone might have moved/ deleted the records.
- The data is retrived from msdb database. It is recomented that you save the results for whole server in an excel fie.