SQLServer probe reports incorrect values for free space metrics

Document ID : KB000034336
Last Modified Date : 14/02/2018
Show Technical Document Details

 

Issue:

SQLServer probe is returning incorrect space calculations for the following metrics:

  • database_size
  • free_Size
  • fg_free_size
  • table_size

The space calculations may be inaccurate, empty or display negative values.

Environment:  

SQLServer 2008 - 2014.

 

Cause: 

This is due to the sp_spaceused system stored procedure returning incorrect data. This is most common when the database has had Data Definition Language (DDL) modifications, such as CREATE, ALTER, or DROP statements.

 

Resolution:

1. Run the following command to recreate the statistics for the database. Note this can take some time to run on large tables or databases.

DBCC UPDATEUSAGE (DatabaseName)

 

Example: DBCC UPDATEUSAGE (CA_UIM)

 

Additional Information:

 

DBCC UPDATEUSAGE (msdn)