> 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/troubleshoot/command-centre-errors/sql-sysadmin-access-is-lost.md).

# SQL sysadmin access is lost

Restore sysadmin access to the Gallagher SQL Server instance when no Windows account has it.

The Windows account that holds the **sysadmin** role on the Gallagher SQL Server instance has been lost (for example, the Windows user was deleted), and no other Windows account has sysadmin. Recovery codes, detach/attach and backups then fail. A member of the server's local Administrators group can restore sysadmin access by starting SQL Server in single-user mode.

### Symptoms

The site may encounter several issues such as:

* Unable to generate a new recovery code.
* Unable to apply the original recovery code.
* Unable to detach/attach databases.
* Unable to create backups although Gallagher Services are running on the Gallagher Server.

![Command Centre message "Database call unsuccessful." shown over the Bin folder beside CCFTRecoveryCode](https://328339335-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6bM8WhlBE9BYizPWJaPN%2Fuploads%2Fgit-blob-c7dcb6f78d33f13e80f24fe12f68eb0a5811fb46%2FSECHUB-TS-SQL-SYSADMIN-04-recovery-code-database-call-unsuccessful.png?alt=media)

![Command Centre Service Manager message "Database detach failed": the server principal is not able to access the database "CCFTCentral" under the current security context](https://328339335-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6bM8WhlBE9BYizPWJaPN%2Fuploads%2Fgit-blob-cba19a31f7514b76ee435998a4c678106074dd95%2FSECHUB-TS-SQL-SYSADMIN-05-database-detach-failed.png?alt=media)

The same message, "Database call unsuccessful.", has a different cause on [Database Call Unsuccessful on vEL8.10.1284](https://help.security.gallagher.com/knowledge-hub/products/cc-software/troubleshoot/command-centre-errors/command-centre-errors-database-call-unsuccessful.md).

### Cause

When a new Gallagher Command Centre Software is installed on a server machine with the default settings, the current login Windows user account is added to the sysadmin role for the Gallagher SQL Server instance.

![Command Prompt whoami showing the Windows account that is logged in](https://328339335-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6bM8WhlBE9BYizPWJaPN%2Fuploads%2Fgit-blob-a455b0a4846ac34361d4403e845dd7b49e9d8db0%2FSECHUB-TS-SQL-SYSADMIN-01-whoami-current-account.png?alt=media)

![SQL Server Management Studio Login Properties, Server Roles page, with sysadmin ticked for that Windows account on the GALLAGHER instance](https://328339335-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6bM8WhlBE9BYizPWJaPN%2Fuploads%2Fgit-blob-c7a4cdfc56d8cf4a61d85f50df0829d44f5d75d3%2FSECHUB-TS-SQL-SYSADMIN-02-current-account-sysadmin-role.png?alt=media)

If that Windows user account is ever lost for any reason (for example, the Windows user was deleted) and there is no other Windows account with the sysadmin role, the issues above follow.

![SQL Server Management Studio logged in as another Windows account: under Security, Logins only BUILTIN\Users and sa are listed](https://328339335-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6bM8WhlBE9BYizPWJaPN%2Fuploads%2Fgit-blob-c092fa8412c795481f9d89d11bb026fb0fb83459%2FSECHUB-TS-SQL-SYSADMIN-03-other-account-no-sysadmin.png?alt=media)

### Fix

SQL Server provides a disaster recovery method for members of the server's local Administrators group: start the instance in single-user mode and add the Windows account to the sysadmin role.

**Prerequisite:** the Windows user account should be a local administrator of the server.

{% hint style="info" %}
The Gallagher SQL instance name could be different if the site installed the SQL Server instance manually. Check the Gallagher SQL Server instance name in **Services → FT Command Centre Service → Dependencies**.
{% endhint %}

![FT Command Centre Service Properties, Dependencies tab, showing Remote Procedure Call (RPC) and SQL Server (GALLAGHER)](https://328339335-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6bM8WhlBE9BYizPWJaPN%2Fuploads%2Fgit-blob-26a38df2b0862c6c435261ad14f0fa04cd4c2129%2FSECHUB-TS-SQL-DEPENDENCY-01-ft-command-centre-service-dependencies.png?alt=media)

1. Stop Gallagher Services using the **CCFTServiceManager** utility or the Windows **Services** tool.

   ![Windows Services listing the FT Bootstrap Protocol, FT Command Centre, FT Controller and FTCAPI Router services](https://328339335-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6bM8WhlBE9BYizPWJaPN%2Fuploads%2Fgit-blob-22e89348686e862cf06edbe59ebc908e78b81f34%2FSECHUB-TS-SQL-SYSADMIN-06-gallagher-services.png?alt=media)
2. Open **SQL Server Configuration Manager**.

   ![SQL Server Configuration Manager (Local) with SQL Server Services in the left pane](https://328339335-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6bM8WhlBE9BYizPWJaPN%2Fuploads%2Fgit-blob-3f7452c2edee862a8dbffd368879a11e991bd0b5%2FSECHUB-TS-SQL-SYSADMIN-07-sql-server-configuration-manager.png?alt=media)
3. Go to **SQL Server Services** and open **Properties** of **SQL Server (GALLAGHER)**.

   ![SQL Server Services with the right-click menu open on SQL Server (GALLAGHER) and Properties pointed out](https://328339335-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6bM8WhlBE9BYizPWJaPN%2Fuploads%2Fgit-blob-b08c44ca527290768916b7fb7245176a19fe03a3%2FSECHUB-TS-SQL-SYSADMIN-08-sql-server-service-properties.png?alt=media)
4. Click the **Startup Parameters** tab, type **`-m`** in **Specify a startup parameter** and click the **Add** button. Click the **OK** button.

   ![SQL Server (GALLAGHER) Properties, Startup Parameters tab, with -m typed in Specify a startup parameter and the Add button highlighted](https://328339335-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6bM8WhlBE9BYizPWJaPN%2Fuploads%2Fgit-blob-b2cf64d2f87570905663ff9419a88a80a80f86a6%2FSECHUB-TS-SQL-SYSADMIN-09-startup-parameter-m.png?alt=media)
5. A warning pops up: click the **OK** button.

   ![Warning: any changes made will be saved; however, they will not take effect until the service is stopped and restarted](https://328339335-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6bM8WhlBE9BYizPWJaPN%2Fuploads%2Fgit-blob-52d91eaf9c414144a12d4bad16e302bf25e6094b%2FSECHUB-TS-SQL-SYSADMIN-10-restart-warning.png?alt=media)
6. Restart the SQL Server instance. It will start in **single-user mode**.

   ![SQL Server Services right-click menu on SQL Server (GALLAGHER) with Restart pointed out](https://328339335-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6bM8WhlBE9BYizPWJaPN%2Fuploads%2Fgit-blob-382fe36f3a6dbdc0df7f51a9756ae0f9893c5046%2FSECHUB-TS-SQL-SYSADMIN-11-restart-sql-server.png?alt=media)
7. Open the Command Prompt (CMD) **as administrator** and copy and paste the following command lines:

   ```
   SET var=%USERDOMAIN%\%USERNAME%
   sqlcmd -S .\GALLAGHER -q "EXEC sp_addsrvrolemember '$(var)', 'sysadmin'"
   quit
   ```

   ![Command Prompt running SET var, the sqlcmd sp\_addsrvrolemember command against .\GALLAGHER, and quit](https://328339335-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6bM8WhlBE9BYizPWJaPN%2Fuploads%2Fgit-blob-b37781e537977f9adf319ce12e1d7806dfc2faa9%2FSECHUB-TS-SQL-SYSADMIN-12-sqlcmd-add-sysadmin.png?alt=media)
8. Open **SQL Server Management Studio** and connect to the instance using **Windows Authentication**.

   ![Connect to Server dialog: Database Engine, the GALLAGHER instance, Windows Authentication](https://328339335-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6bM8WhlBE9BYizPWJaPN%2Fuploads%2Fgit-blob-8b7fa6cd0ba6bd9c0dbb567d586b0058acda18cd%2FSECHUB-TS-SQL-SYSADMIN-13-ssms-connect-windows-authentication.png?alt=media)
9. Open the **Login Properties** of the Windows account in **Security → Logins** and verify the **sysadmin** checkbox is enabled.

   ![Login Properties, Server Roles page, with sysadmin ticked for the new Windows account](https://328339335-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6bM8WhlBE9BYizPWJaPN%2Fuploads%2Fgit-blob-dd761f831473b5d24d69763f5c7f90a69cee8f43%2FSECHUB-TS-SQL-SYSADMIN-14-new-account-sysadmin-role.png?alt=media)
10. You have now added the sysadmin role to the Windows account.
11. Go back to **SQL Server Configuration Manager → SQL Server Services** and open **Properties** of **SQL Server (GALLAGHER)** (as in step 3).
12. Select **`-m`** in **Existing parameters** on the **Startup Parameters** tab, click **Remove**, then click **OK**.

    ![Startup Parameters tab with -m selected in Existing parameters and the Remove and OK buttons pointed out](https://328339335-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6bM8WhlBE9BYizPWJaPN%2Fuploads%2Fgit-blob-461455d1f1926e74428a5b3576f8b9b0803506cb%2FSECHUB-TS-SQL-SYSADMIN-15-remove-startup-parameter.png?alt=media)
13. A warning pops up: click the **OK** button (as in step 5).
14. Restart the SQL Server instance (as in step 6). It will start in **multi-user mode**.
15. Start Gallagher Services using the **CCFTServiceManager** utility or the Windows **Services** tool.


---

# 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/troubleshoot/command-centre-errors/sql-sysadmin-access-is-lost.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.
