Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in

Archives: December 2011

Getting data and log size of all databases

Hi guys.

The procedure bellow get the data and log size of all databases in current instance.


CREATE PROCEDURE dbo.uspDatabaseSize
@tbl table (Database_Id int, DataUsedMB Float)

insert into @tbl
exec sp_MSforeachdb
'select db_id(''?'') , (SUM(ps.reserved_page_count)*8)/1024 from ?.sys.dm_db_partition_stats ps';
WITH DataSize
        DB_ID(d.instance_name)… Read more

3 comments, 1,015 reads

Posted in Adeilson Brito on 3 December 2011