Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 Calculating sizes(disk usage) on different levels

Author  Topic 

ashishmgupta
Starting Member

12 Posts

Posted - 2007-03-26 : 09:54:48
I am looking to do the following:-

a) Calculating the size(disk usage) of databases in a given Sql server 2005.
b) Calculating the size(disk usage) of tables in a database.
c) Calculating the size(disk usage) all the related data for a key value, for example get size of the all the related data associated with FKSomeForeignKey with value (1234) which is probably a foreign key in all the related tables.

As of now I have the following corresponding solutions :-
a) exec sp_spaceused on all the databases on a given server
b) exec sp_spaceused <tablename> on a particular database
c) Get all the data for a all the columns related for the given value,in this example,get values of all the related columns from all the tables where I find a particluar value of FKSomeForeignKey ,put that in a temporary table
and doing exec sp_spaceused <TempTableName>.

Quesions:-

a) Is this the correct way of accurately calculating the sizes?
b) If not,what is the correct/better approach?
c) Is there a tool(free/commercial) available to do exactly this?

Thanks in advance,
Ashish
   

- Advertisement -