Results 1 to 8 of 8

Thread: Database Size

  1. #1
    Join Date
    Jul 2003
    Location
    New York City
    Posts
    29

    Database Size

    Hi,
    I have 30 servers and about 600 databases. I want to know the size of databases ( data files as will log files) both used and allocated space.
    Can any one tell me the easiest way to get this information?

    Thanks.

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    There is no easy way, can run sp_spaceused for each db on every sevrer and run 'dbcc sqlperf(logspace)' on every server.

  3. #3
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    Run this command on all the 30 servers, which will list all the database sizes and log sizes

    exec master.dbo.sp_msforeachdb 'sp_spaceused'

    exec master.dbo.sp_msforeachdb 'dbcc sqlperf(logspace)'

  4. #4
    Join Date
    Sep 2002
    Posts
    5,938
    Don't have to run 'dbcc sqlperf(logspace)' for each db since it gives you log size of all dbs on the server.

  5. #5
    Join Date
    Jul 2003
    Location
    New York City
    Posts
    29
    Hi,

    Yeah!

    When I execute this (below) as suggested by MAK, I get information about MASTER database only, that too so many times..( I guess it is executed n number of times where n is number of databases in my server ).

    exec master.dbo.sp_msforeachdb 'sp_spaceused'

    How can I get information about every database in the server?

    I tried executing this in a separate query analyzer window also...

    Thanks.

  6. #6
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    try this.


    exec sp_msforeachdb 'exec ?.dbo.sp_spaceused'

  7. #7
    Join Date
    Jul 2003
    Location
    New York City
    Posts
    29
    Thanks Mak,
    It works.

    I have one doubt.
    When I issue that command, I get reserved, and unused. Also I get unallocated. Unallocated space is still free, but don't understand what are unused and reserved?

    Can you please give me some idea?

    Thanks.

  8. #8
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    Reserved = data+indexsize+unused

    unused is - out of the reserved space, the space that is not used.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •