> 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/databases-creating-blank-ones-using-sc.md).

# Scripts for creating blank databases

[Command Centre Databases (SQL)](broken://pages/cCfAltV0RyZ60G9YuhuO) › Creating blank ones using scripts (8.20 and above)

## This page answers

* Where are the create-database scripts on 8.20+ install media?
* How do you run them with sqlcmd?
* Why do the clients error afterward, and how do you fix the thumbprint?

> **Note:** On a live site, detach and back up the existing databases before proceeding.

The 8.20+ install media no longer contains blank versions of `CCFTCentral` and `CCFTEvent`. Instead there are two SQL scripts that create them, on the install media under:

```
\Utilities\Database scripts
```

* `CreateCentralDatabase.sql`: creates `CCFTCentral`
* `CreateEventDatabase.sql`: creates `CCFTEvents`

The scripts cannot be run directly. They can be opened and executed in SSMS, but SSMS may not be installed on the CC server, so they can also be applied with `sqlcmd` from the command line. Log in as a local admin (or launch CMD as admin) and run:

```
sqlcmd -S CCserverName\instanceName -i SQLscriptLocation
```

![sqlcmd executing in a CMD window to create the databases](https://328339335-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6bM8WhlBE9BYizPWJaPN%2Fuploads%2Fgit-blob-600b31dd611127e84dd10733331d87d0361488c3%2FSECHUB-CCS-SQL-CREATE-sqlcmd-command.png?alt=media)

> **Note:** In the command above the `-S` switch is uppercase and the `-i` switch is lowercase. The switches are case-sensitive and affect how the command runs.

This creates and attaches the databases to the `GALLAGHER` instance. The database files are saved in the SQL program-files folder, which depends on the SQL version. For a default CC 8.20 install using x64 SQL 2017:

```
C:\Program Files\Microsoft SQL Server\MSSQL14.GALLAGHER\MSSQL\DATA
```

You could leave the databases there, but then detaching/attaching from `CCFTServiceManager` would no longer work and you would need SSMS. To move them to the default Gallagher data folder:

1. Stop the Command Centre services.
2. Use `CCFTServiceManager` to detach the databases.
3. Copy the databases from the SQL program-files data folder (above).
4. Paste them into the Gallagher data folder: `C:\Program Files (x86)\Gallagher\Command Centre\Data`
5. Use `CCFTServiceManager` to attach the databases.
6. Apply a new recovery code to the databases (see below).
7. Start the Command Centre services.

***

## Regenerating the thumbprint

At this point the services start, but launching the clients gives an error:

![Thumbprint mismatch error when launching the CC client after attaching blank databases](https://328339335-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6bM8WhlBE9BYizPWJaPN%2Fuploads%2Fgit-blob-eb99277b8ffb60fd82485875d45aeb600293f765%2FSECHUB-CCS-SQL-CREATE-thumbprint-error.png?alt=media)

The server thumbprint in the client config files no longer matches the thumbprint in the new blank databases, so the clients are no longer trusted by the server. To resolve:

1. Launch `CCFTRecoveryCode.exe` and choose **Generate a new code for this system**.
2. Use `CCFTServiceManager` to start the services.

***

## Replacing the event database only

If you are only restoring `CCFTEvent`, the procedure is the same but run `CreateEventDatabase.sql` only, copy/replace `CCFTEvent` only, attach, and start services. **No new recovery code is needed** in this case; the clients should connect once the services start for the first time.

***

🔗 **Related**

* [Databases - Attaching blank ones to 8.20 and above](/knowledge-hub/products/cc-software/configure/databases-an-overview-of-command-centr/databases-attaching-blank-ones-to-8-20.md). Reusing blank databases from previous version media.
* [Databases - Detaching and Reattaching](/knowledge-hub/products/cc-software/configure/databases-an-overview-of-command-centr/databases-detaching-and-reattaching.md). The detach/attach tooling.


---

# 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/databases-creating-blank-ones-using-sc.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.
