Querying for DBCC run information

General DBCC run information

Use the following endpoints to query for information about DBCC runs.

  • GET /systemtools/v1/database-consistency-checks
  • GET /systemtools/v1/database-consistency-checks/{dbccId}

For example, the following request retrieves information on DBCC run cc:303, which executed all checks against the cc_activity and cc_address table.

GET /systemtools/v1/database-consistency-checks/cc:303

{
    "data": {
        "attributes": {
            "description": "Tables:  cc_activity, cc_address; Checks:  All.",
            "duration": "0.151",
            "endTime": "2022-09-19T22:23:23.163Z",
            "errors": 1,
            "extensionsSchemaVersion": 508,
            "id": "cc:303",
            "key": 16,
            "majorSchemaVersion": 50,
            "minorSchemaVersion": 603,
            "platformMajorSchemaVersion": 50,
            "platformMinorSchemaVersion": 605,
            "startTime": "2022-09-19T22:23:23.012Z",
            "totalChecks": 17
        },

The key value is needed to rerun DBCCs that report consistency errors on their first run.

The response does not include endTime if the DBCC is in progress.

DBCC run reports

Use the following endpoint to retrieve the consistency check report in a zip file format.

  • GET /systemtools/v1/database-consistency-checks/{dbccId}/report

Note that the response for this endpoint is not JSON. Some API tools, such as Postman, may not be able to interact with the response correctly.

This endpoint also accepts an errorOnly query parameter, which indicates whether to include only errors in the consistency check report. The default is false.

If you execute a GET /report?errorsOnly=true, the response depends on the state of the DBCC.

DBCC is complete? Number of errors Response
Yes 1 or more A report of the errors and only the errors.
Yes 0 The following error message: "The count of consistency checks with errors in this run is zero. To download the full report, retry the request without the 'errorsOnly' query parameter."
No n/a The following error message: "Cannot generate the report because the consistency check run '{0}' is still running. Retry after the batch process is finished."

Note that when you run a DBCC using the POST /systemtools/v1/batch-processes/DBConsistencyCheck/start endpoint, the response does not include the dbccId value. This is because, for most batch processes, the results are not stored in the database. Therefore, there is no "ID value" that can be provided for all batch process types. If you want to run a DBCC and then download the report through Cloud API, you must execute three calls:

  1. Execute the batch process with POST /systemtools/v1/batch-processes/DBConsistencyCheck/start
  2. Retrieve the dbccID value with GET /systemtools/v1/database-consistency-checks
  3. Get the DBCC report with GET /systemtools/v1/database-consistency-checks/{dbccId}/report