> ## Documentation Index
> Fetch the complete documentation index at: https://syteca.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Moving the MS SQL Database

> Relocate the MS SQL Server database to another drive on the same computer, or migrate it to a new computer entirely, including databases signed with a certificate.

<Warning>
  **NOT AVAILABLE IN SAAS.**
</Warning>

Syteca supports moving the MS SQL Server database either to another location on the same computer, or to a different computer entirely.

## Move the database on the same computer

<Steps>
  <Step title="Stop the Application Server">
    Right-click the **Syteca Server** tray icon and select **Stop**, or stop the **EkranServer** service via Task Manager.
  </Step>

  <Step title="Detach the databases in SQL Management Studio">
    Log in as an administrator. For each Syteca database (default names `EkranActivityDB` and `EKRANManagementDatabase`), right-click it and select **Tasks > Detach**.
  </Step>

  <Step title="Locate the database files">
    Navigate to the current storage location, by default:

    ```text theme={"system"}
    C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA
    ```
  </Step>

  <Step title="Move the files">
    Move these files (and their corresponding `_log` files) to the new location:

    * `EkranActivityDB`, `EkranActivityDB_log`
    * `EKRANManagementDatabase`, `EKRANManagementDatabase_log`
  </Step>

  <Step title="Re-attach the databases">
    In SQL Management Studio, right-click **Databases**, select **Attach**, click **Add**, and select each moved database file.
  </Step>

  <Step title="Restart the Application Server">
    Start the **EkranServer** service again.
  </Step>
</Steps>

## Move the database to another computer

<Steps>
  <Step title="Stop the Application Server">
    Right-click the **Syteca Server** tray icon and select **Stop**, or stop the **EkranServer** service via Task Manager.
  </Step>

  <Step title="Detach the databases">
    In SQL Management Studio, right-click each Syteca database and select **Tasks > Detach**.
  </Step>

  <Step title="Copy the database files">
    From the default location `C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA`, copy:

    * `EkranActivityDB` and `EkranActivityDB_log`
    * `EKRANManagementDatabase` and `EKRANManagementDatabase_log`
    * `EkranUbaDatabase`
    * Any archived databases

    <Note>
      If binary data is stored in a shared or local folder rather than the database itself, copy that too.
    </Note>
  </Step>

  <Step title="Transfer the files to the new computer">
    Upload the copied files to a suitable location on the new SQL Server computer.
  </Step>

  <Step title="Attach the databases on the new computer">
    Log in to SQL Management Studio on the new computer, right-click **Databases**, select **Attach**, click **Add**, and select each uploaded database file.
  </Step>

  <Step title="Uninstall the Application Server on the original computer">
    See [Uninstalling the Application Server](/docs/administration/deployment/uninstall-application-server).
  </Step>

  <Step title="Reinstall the Application Server">
    <Tabs>
      <Tab title="Reinstalling on the original computer">
        Select the MS SQL Server database type and configure the connection to the database that was moved.
      </Tab>

      <Tab title="Installing on the new database computer">
        [Back up the master certificate](/docs/administration/security/master-certificate#export-the-master-certificate) on the original computer and import it on the new one **before** installing the Application Server there. Then reinstall every Client, and contact the [Syteca Support team](https://www.syteca.com/en/support/contact-support) to update the HWID associated with your serial keys.
      </Tab>
    </Tabs>
  </Step>

  <Step title="Restart the Application Server">
    Start the **EkranServer** service.
  </Step>
</Steps>

## Move a database signed with a certificate

If [monitoring data is signed with a certificate](/docs/administration/deployment/database-management#set-up-certificate-signing-for-monitoring-data-validation), moving the database to another computer takes three steps:

<Steps>
  <Step title="Export and import the master certificate">
    [Export the master certificate](/docs/administration/security/master-certificate#export-the-master-certificate) on the original Application Server computer, copy it to the new computer, and [import it there](/docs/administration/security/master-certificate#import-the-master-certificate).
  </Step>

  <Step title="Move the database">
    Follow [Move the database to another computer](#move-the-database-to-another-computer) above.
  </Step>

  <Step title="Re-enable certificate signing">
    Install the Application Server on the new computer, then [enable signing with the imported certificate](/docs/administration/deployment/database-management#2-enable-signing-with-the-certificate).
  </Step>
</Steps>

## Related

<CardGroup cols={2}>
  <Card title="Moving the PostgreSQL Database" icon="database" href="/docs/administration/database/moving-postgresql-database">
    The equivalent procedure for PostgreSQL deployments.
  </Card>

  <Card title="Database management" icon="database" href="/docs/administration/deployment/database-management">
    Archive, cleanup, and validation settings.
  </Card>

  <Card title="Master certificate" icon="key" href="/docs/administration/security/master-certificate">
    Back up, export, and import the master certificate.
  </Card>

  <Card title="Migration of the Application Server" icon="server" href="/docs/administration/deployment/migrate-application-server">
    Move the Application Server itself to a new computer.
  </Card>
</CardGroup>
