?
Solved

Calculate Size of SQL Server 2008 DB

Posted on 2013-01-14
4
Medium Priority
?
377 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 30

Accepted Solution

by:
Brad Howe earned 1000 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 1000 total points
ID: 38912334
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

770 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