sp_dbcc_recommendations

Description

Analyzes faults reported by the checkstorage operation corresponding to the specified operation ID, or date, and generates a list of recommended corrective actions for the specified object in the target database.

Syntax

sp_dbcc_recommendations dbname [,“date”[, opid [, “objectname”]]]

Parameters

dbname

is the name of the database for which recommendations are generated. Type is varchar, and this parameter is required.

date

is a datetime value representing the date and time the dbcc checkstorage operation (for which the reported faults will be analyzed) finished. If you do not specify date or opid, Adaptive Server uses the date of the most recent operation. If you specify both date and opid, Adaptive Server ignores the date. date is optional.

opid

is the operation ID of the checkstorage operation, for which the reported faults will be analyzed. If an opid or date is not specified, Adaptive Server uses the date of the most recent operation. If both date and opid are specified, Adaptive Server ignores the date. The type for this parameter is int.

objectname

is the name of the object for which sp_dbcc_recommendations generates the recommendations. If an objectname is not specified, recommendations for all objects in the database are generated. The type for this parameter is varchar.

Examples

Example 1

Generates a list of recommended fixes for the object t1, in database my_db, based on the faults reported by the checkstorage operation corresponding to operation id 2:

sp_dbcc_recommendations my_db, null, 2, ‘t1’

Example 2

Generates a list of recommended fixes for all objects in database my_db, based on the faults reported by the checkstorage operation that finished on Sep 15 2002 at 7:10:18:463PM:

sp_dbcc_recommendations my_db, ‘Sep 15 2002 7:10:18:463PM’

Example 3

Generates a list of recommended fixes for all objects in database my_db, based on the most recent checkstorage operation:

sp_dbcc_recommendations my_db

Usage

sp_dbcc_recomendations analyzes faults reported by the checkstorage operation corresponding to the specified operation ID, or date, and generates a list of recommended corrective actions for the specified object in the target database

Permissions

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

Granular permissions enabled

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

Granular permissions disabled

With granular permissions disabled, any valid user of the specified database can run sp_dbcc_recommendations.