Database 150% Full | sp_spaceused reports negative unallocated space

A while ago, the monitoring tool reported that one of the databases was 150% full ! Logged on to the server and issued sp_spaceused command against that database. The output was as below.

As highlighted, the unallocated space was showing negative values. This was because the space usage information was not updated. After running DBCC UPDATEUSAGE against that database, the unallocated space value updated correctly. Alternatively the following command can also be executed to fix this issue.

sp_spaceused @updateusage = 'TRUE'

The below command can be used to update the usage of all the databases in one go.

EXEC SP_MSFOREACHDB @COMMAND1 ='use [?] print db_name() DBCC UPDATEUSAGE(0)'