Sunday, March 25, 2012

Database free space: big discrepancy between sp_spaceused and EM taskpad view

I am monitoring free space in my database so I can manually grow the
data file rather than relying on autogrow. I get the free space by
using the 'unallocated space' value returned by sp_spaceused.
Today I was alerted that there was less than 2% free space remaining
in my database. I verified with sp_spaceused and it was reporting ~8GB
unallocated space in a ~500GB database. Then I checked the free space
by looking at the taskpad view for my database in Enterprise Manager.
This showed ~60GB free. I ran a profiler trace to see what EM is doing
to calculate free space but I can't tell what calculations it does,
other than to see that in addition to sp_spaceused it uses the
following two commands:
select sum(convert(float,size)) * (8192.0/1024.0) from dbo.sysfiles
and
DBCC showfilestats
Am I wrong in thinking that the 'unallocated space' and free space
reported by EM should be similar? Is one a more reliable indicator
than the other?
ThanksHi
Before using sp_spaceused run DBCC UPDATEUSAGE command
<pshroads@.gmail.com> wrote in message
news:1184779707.553225.56190@.d30g2000prg.googlegroups.com...
>I am monitoring free space in my database so I can manually grow the
> data file rather than relying on autogrow. I get the free space by
> using the 'unallocated space' value returned by sp_spaceused.
> Today I was alerted that there was less than 2% free space remaining
> in my database. I verified with sp_spaceused and it was reporting ~8GB
> unallocated space in a ~500GB database. Then I checked the free space
> by looking at the taskpad view for my database in Enterprise Manager.
> This showed ~60GB free. I ran a profiler trace to see what EM is doing
> to calculate free space but I can't tell what calculations it does,
> other than to see that in addition to sp_spaceused it uses the
> following two commands:
> select sum(convert(float,size)) * (8192.0/1024.0) from dbo.sysfiles
> and
> DBCC showfilestats
> Am I wrong in thinking that the 'unallocated space' and free space
> reported by EM should be similar? Is one a more reliable indicator
> than the other?
> Thanks
>

No comments:

Post a Comment