July 10, 2013 at 6:49 am
i would like to find the above details
DB names, last backup finished date , backup size of all the databases , free space in data files in all the databases, is any script to achieve this . .
July 10, 2013 at 7:37 am
1. sys.databases
2,3. msdb..backupset
4. fileproperty(name, 'spaceused')/128 from sys.database_files -- MB
July 10, 2013 at 7:39 am
This will get you the first 3.
select name, backup_finish_date, backup_size from msdb.dbo.backupset
To get free space you will have to loop through all the databases and look at dbo.sysfiles.
--EDIT--
I should mention that the first query will only find those databases that have been backed up. If you have a database that has never been backed up it will NOT be in the results.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply