Solved

Calculate Size of SQL Server 2008 DB

Posted on 2013-01-14
4
350 Views
Last Modified: 2013-03-07
Hi Experts,
How to calculate total size of SQL Server 2008 DB with breakdown for tables , indexes etc

thank a lot
0
Comment
Question by:juliakir
  • 2
4 Comments
 
LVL 30

Accepted Solution

by:
Brad Howe earned 250 total points
ID: 38774780
Simpe TSQL to get this info for you.

http://gallery.technet.microsoft.com/Determine-size-of-database-6c5373cd


USE BizTalkDTADb --You can change this to desires database
GO

SET NOCOUNT ON
DBCC UPDATEUSAGE(0)
-- DB size.
EXEC sp_spaceused
-- Table row counts and sizes.
CREATE TABLE #t
(
[name] NVARCHAR(128)
, [rows] CHAR(11)
, reserved VARCHAR(18)
, data VARCHAR(18)
, index_size VARCHAR(18)
, unused VARCHAR(18)
)
INSERT #t EXEC sp_msForEachTable 'EXEC sp_spaceused ''?'''
SELECT [name] as 'Table name'
, [rows] as 'Rows'
, cast(replace(reserved, ' KB', '') as bigint) as 'reserved (KB)'
, cast(replace(data, ' KB', '') as bigint) as 'data (KB)'
, cast(replace(index_size, ' KB', '') as bigint) as 'index_size (KB)'
, cast(replace(unused, ' KB', '') as bigint) as 'unused (KB)'
FROM #t
-- # of rows.
SELECT SUM(CAST([rows] AS int)) AS [rows]
FROM #t
DROP TABLE #t
GO


Cheers,
Hades666
0
 
LVL 35

Expert Comment

by:David Todd
ID: 38796005
Hi,

From SSMS, in Object Explorer, Right click on the database, select Reports, select Standard Reports, Select Disk Usage by Table.

Enjoy.

Regards
  David
0
 

Author Comment

by:juliakir
ID: 38911794
David ,
that is nice feature ! What kind of privelegies developer should have in order to be able to do that ?

thank you
0
 
LVL 35

Assisted Solution

by:David Todd
David Todd earned 250 total points
ID: 38912334
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now