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

need script Expand / Collapse
Author
Message
Posted Thursday, November 15, 2012 9:51 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Tuesday, August 4, 2015 12:53 AM
Points: 241, Visits: 1,212
Hi Team,

I m looking out put like below

Database Name Mdf file size Ldf File size current size of the database

requesting to you guys please help me with exact script its really helpful to me.


Thanks in advance..
Post #1385256
Posted Thursday, November 15, 2012 10:03 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 8:11 AM
Points: 1,851, Visits: 21,646
Something like this?

SELECT DB_NAME(database_id) AS DatabaseName,
SUM(CASE WHEN type=0 THEN size ELSE 0 END) AS MdfSize,
SUM(CASE WHEN type=1 THEN size ELSE 0 END) AS LdfSize
FROM sys.master_files
GROUP BY database_id



____________________________________________________

Deja View - The strange feeling that somewhere, sometime you've optimised this query before

How to get the best help on a forum

http://www.sqlservercentral.com/articles/Best+Practices/61537



Post #1385259
Posted Thursday, November 15, 2012 10:08 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Tuesday, August 4, 2015 12:53 AM
Points: 241, Visits: 1,212
Hi

thanks for your reply..
but i m getting

database name mdfsize ldf size but i need current size of the database also could you please help me on this.
Post #1385261
Posted Thursday, November 15, 2012 1:26 PM
UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Yesterday @ 11:10 AM
Points: 1,487, Visits: 1,063
Wouldnt the size of the database be the MDF size + the LDF size?

No one minds helping, but if you want us to do your job for you, I'm sure someone is available for hire.

Post #1385340
Posted Thursday, November 15, 2012 8:42 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 5:48 PM
Points: 3,971, Visits: 6,355
Ray M (11/15/2012)
Wouldnt the size of the database be the MDF size + the LDF size?

No one minds helping, but if you want us to do your job for you, I'm sure someone is available for hire.



+1

I'm available.



My mantra: No loops! No CURSORs! No RBAR! Hoo-uh!

My thought question: Have you ever been told that your query runs too fast?

My advice:
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.


Need to UNPIVOT? Why not CROSS APPLY VALUES instead?
Since random numbers are too important to be left to chance, let's generate some!
Learn to understand recursive CTEs by example.
Splitting strings based on patterns can be fast!
My temporal SQL musings: Calendar Tables, an Easter SQL, Time Slots and Self-maintaining, Contiguous Effective Dates in Temporal Tables
Post #1385437
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse