Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
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
Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Today @ 9:35 AM
Points: 688, Visits: 2,717
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
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: Friday, February 5, 2016 8:05 AM
Points: 586, Visits: 2,216
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


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Today @ 1:54 PM
Points: 15,277, Visits: 15,263
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