Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

script Expand / Collapse
Author
Message
Posted Wednesday, July 10, 2013 6:49 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: 2 days ago @ 2:17 AM
Points: 521, Visits: 2,006
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 . .
Post #1472093
Posted Wednesday, July 10, 2013 7:37 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Today @ 3:45 PM
Points: 425, Visits: 1,326
1. sys.databases
2,3. msdb..backupset
4. fileproperty(name, 'spaceused')/128 from sys.database_files -- MB
Post #1472132
Posted Wednesday, July 10, 2013 7:39 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 3:28 PM
Points: 13,103, Visits: 11,933
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 Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1472135
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse