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 2005 Forums
 SQL Server Administration (2005)
 Getting Database Size

Author  Topic 

hk1
Starting Member

3 Posts

Posted - 2010-07-22 : 11:10:52
I have a website at Network Solutions on a shared hosting plan with SQL Server 2005. I wrote some code that logs visitor data and then I wrote an HTML dashboard to view this visitor information.

My database has 300MB of disk space allocated but I'm having trouble with it filling up which crashes the whole website. I'm planning to change our hosting to Arvixe which has a much higher SQL limit but for now I'm stuck with NS.

Is there any way where I can get the size of the database using code? My website is written in ASP Classic and uses ADO for database stuff.

I'm really going to need to optimize my code so that I'm not storing so much data but that's a fairly large task that I haven't had time to undertake. I also realize there are some really good tracking apps available such as Google Analytics and StatCounter. I currently use both of them but they don't give me the custom features that I'm looking for and already have programmed into my own app.

Kristen
Test

22859 Posts

Posted - 2010-07-22 : 11:19:37
THere is lots you can get from your own logs that you won't get from Google Analytics - more accurate page "journey" and Exit-pages for example (if a user requests page X but: they click off, page has Javascript error and google code doesn't fire, your application has error, your page redirects (you could probably tell Google Analytics that, but I doubt many apps bother), page is slow and user clicks next link before Google code runs, and so on).

All you can really do is to delete "stale" data to reduce database size, or export it to somewhere else - e.g. to a database on your local PC perhaps - and then delete it.

This may give you some ideas on sizes:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=61762
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-22 : 11:52:31
If you only care about the size of MDF+LDF, then you can query sp_databases in the master database. That's what I use, but it doesn't provide how much space is in use in each file.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -