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
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 How to Get the Database Size

Author  Topic 

real_pearl
Posting Yak Master

106 Posts

Posted - 2004-07-09 : 02:35:13
I want to know how we wan get the database size, is there any built-in stored procedure that returns the database size taking database name as input parameter.

I also want to know that if database doesn't have much data but its size is too much like 2GB, what is the reason and how can we decrease its size?

sachinsamuel
Constraint Violating Yak Guru

383 Posts

Posted - 2004-07-09 : 03:00:42
U can use sp_databases. It returns the all the database name and there size. To fire a selection in the result set, u can punch this data into a temporary table and get ur select list fired with the database name, for which u require the size.

Regards
Sachin
Go to Top of Page

real_pearl
Posting Yak Master

106 Posts

Posted - 2004-07-09 : 03:06:31
Thanks for the reply and please answer second part of my question.
Go to Top of Page

mr_mist
Grunnio

1870 Posts

Posted - 2004-07-09 : 03:18:14
Play around with sp_spaceused and DBCC showfilestats.

Space is not reclaimed unless you have the option on to auto-shrink. You are probably best leaving it as it is, because if you keep shrinking and increasing the DB size you can end up with a heavily fragmented file.

-------
Moo. :)
Go to Top of Page

sachinsamuel
Constraint Violating Yak Guru

383 Posts

Posted - 2004-07-09 : 03:18:56
The reason for this might be, the log file is very big. U need to shrink the log file.

regards
Sachin
Go to Top of Page
   

- Advertisement -