sp_dbcc_deletehistory

Deletes the results of dbcc checkstorage operations performed on the target database before the specified date and time.

Note: sp_dbcc_deletehistory does not free any space associated with the deleted historical data, as workspaces are pre-allocated and of a fixed size.

Syntax

sp_dbcc_deletehistory [cutoffdate [, dbname | dbid]]

Parameters

Examples

Usage

There are additional considerations when using sp_dbcc_deletehistory:
  • sp_dbcc_deletehistory deletes the results of dbcc checkstorage operations performed on the target database before the specified date and time.

  • If the target database is dbccdb, and the dbccalt database exists, sp_dbcc_deletehistory deletes historical data for dbccdb from dbccalt.

  • The value specified for cutoffdate is compared to the finish time of each dbcc operation.

  • Use the dbid option to delete the historical data of the dbccdb database for a database that has already been dropped.

  • Using the dbid option is the only way to delete the historical data of the dbccdb database for a database that has already been dropped.

  • To see the dates when dbcc checkstorage was run so that you can choose the value for cutoffdate, run sp_dbcc_summaryreport.

See also:
  • dbcc in Reference Manual: Commands

  • System Administration Guide for information on the dbccalt database.

Permissions

The permission checks for sp_dbcc_deletehistory differ based on your granular permissions settings.

SettingDescription
Enabled

With granular permissions enabled, you must be the database owner of dbccdb (or dbccalt), or have the manage checkstorage privilege on the specified database.

Disabled

With granular permissions disabled, you must be the database owner of the specified database or a user with sa_role to run sp_dbcc_deletehistory on a specific database. Only a user with sa_role can run sp_dbcc_deletehistory without specifying a database name.

Related reference
Specifying the Date
sp_dbcc_deletedb
sp_dbcc_evaluatedb
sp_dbcc_summaryreport
sp_plan_dbccdb