> For the complete documentation index, see [llms.txt](https://help.security.gallagher.com/knowledge-hub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.security.gallagher.com/knowledge-hub/products/cc-software/configure/databases-an-overview-of-command-centr/check-and-repair-the-databases.md).

# Check and repair the databases

Check the Command Centre databases for errors with DBCC CHECKDB and repair them.

Check the `CCFTCentral` and `CCFTEvent` databases for errors with `DBCC CHECKDB`, and repair the errors it finds.

### How the database is checked, by version

| Version            | How the database is checked                                                                                                                               |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **7.60 and lower** | The RepairDB utility is required to check the database, as the database is locked by an SA password.                                                      |
| **7.70 onwards**   | This is no longer the case. There is a RepairDB utility for later versions as well, but the scripts below can be run from SQL Management Studio directly. |

### Check the databases for errors (no repair)

```
DBCC CHECKDB (CCFTCentral)
```

checks the Central database, and

```
DBCC CHECKDB (CCFTEvent)
```

checks the Event database. If errors were found, there will be messages after the script has run.

![SQL Server Management Studio running DBCC CHECKDB (CCFTCentral), with messages ending "CHECKDB found 0 allocation errors and 0 consistency errors in database 'CCFTCentral'"](https://328339335-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6bM8WhlBE9BYizPWJaPN%2Fuploads%2Fgit-blob-b336d70488b59dff9211aff8caf526d4c84e9f60%2FSECHUB-TS-SQL-REPAIR-DB-01-dbcc-checkdb.jpg?alt=media)

### Repair database errors

{% hint style="warning" %}
**Important:** Stop the Command Centre services before running this script.
{% endhint %}

{% hint style="warning" %}
**Important:** This will take some time to run: the bigger the database, the longer it will take.
{% endhint %}

Run as a single query:

```
ALTER DATABASE CCFTCentral SET SINGLE_USER
DBCC CHECKDB(CCFTCentral, REPAIR_REBUILD)
ALTER DATABASE CCFTCentral SET MULTI_USER
```

Replace `CCFTCentral` with `CCFTEvent` in the query to check the CCFTEvent database.

![SQL Server Management Studio running the SINGLE\_USER, DBCC CHECKDB REPAIR\_REBUILD and MULTI\_USER query against CCFTCentral, with its messages](https://328339335-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6bM8WhlBE9BYizPWJaPN%2Fuploads%2Fgit-blob-2955d85c6ea424c47b92a9229b53b78cdaa38b7f%2FSECHUB-TS-SQL-REPAIR-DB-02-dbcc-repair-rebuild.jpg?alt=media)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.security.gallagher.com/knowledge-hub/products/cc-software/configure/databases-an-overview-of-command-centr/check-and-repair-the-databases.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
