Backup and restore the database

Overview

Sitefinity Cloud provides different database operations out-of-the-box. Automated backups of the database on each environment are created every minute, .bacpac files can be used to export/import a database, and databases can be restored from one environment to another on demand.
For more information about.bacpac files, see Microsoft documentation » BACPAC.

IMPORTANT: Sitefinity Cloud uses Azure SQL Database service. When you make a backup of your database, it is always made using the latest stable Enterprise Edition of SQL server. Keep this in mind when considering compatibility with your local version of SQL server you are restoring the database backup to.

Automated backups

Automated backups of the database on each environment are made every minute. These backups are kept for a period of 35 days, enabling you to restore your website database to a desired point in time within that period. You can request a restoration to a point in time by contacting the Sitefinity support team.

NOTE: Automated backups are not made available for development purposes. They are setup for disaster recovery and emergency data restoration purposes only. If you need a database backup for development purposes refer to the Database backups for development and On-demand database backups sections further in this article. 

Export a database to a BACPAC file

Sitefinity Cloud environment databases are automatically exported to .bacpac files on a weekly basis. You can access these files and use them to restore the database locally for development and testing purposes. Databases can also be exported on demand as described below.

To export a database to a .bacpac file on demand, perform the following:

  1. Login to Sitefinity Cloud Management Portal.
  2. Navigate to Pipelines » All » DB.
  3. In the list of available pipelines, select DB.Export pipeline.
  4. In the upper-right corner, click Run pipeline.
    A dialog box opens.
  5. Expand Stages to run.
  6. Select the environments where to create a database backup.
  7. In the bottom of the dialog, click Use selected stages.
  8. Click Run.

NOTE: To protect sensitive data, use an obfuscated copy of the database.
For more information, see Setup PII data obfuscation.

Import a database from a BACPAC file

You can import a database from a .bacpac file to any environment using the DB.Import pipeline. The input parameter for the pipeline is the URI of the .bacpac file.

To import a database from a .bacpac file, perform the following:

  1. Login to Sitefinity Cloud Management Portal.
  2. Navigate to Pipelines » All » DB.
  3. In the list of available pipelines, select DB.Import pipeline.
  4. In the upper-right corner, click Run pipeline.
    A dialog box opens.
  5. Provide a URI of the .bacpac file.
    The .bacpac file can come from the existing db-backups container or it can be uploaded to the new db-imports container, part of the Database Storage Account. BACPAC files from external Azure Storage Account Containers can also be used, provided the URI contains a valid SAS token.
  6. Select the Target environment.
    You can select any environment, except for Production and Authoring (Content Staging). Importing a database from a .bacpac file can cause downtime on the Target environment. Production and Authoring (Content Staging) are considered production environments, therefore operations that can cause downtime are not allowed by default. If you need to import a .bacpac file to a production environment, submit a request via support case.
  7. Click Run.
    • (Optional) Rollback the DB import, if the application becomes unhealthy 
      The default options is to rollback the database import operation in case the application becomes unhealthy after it. If you want to proceed with the database import regardless of how it affects the application, you can disable this option.
    • (Optional) Persist Sitefinity config values
      The default option is to persist Sitefinity config values on the Target environment. This means that Sitefinity config values, which are stored on the Target database, will NOT be replaced with the ones from the .bacpac file. If you want to override the configurations on the Target environment, you can disable this option when you run the pipeline.

Import a database from a BACPAC file in your local development environment

BACPAC files are stored in a dedicated storage account that you can access. To import a .bacpac file in your local development environment, perform the following:

  1. Install Azure Storage Explorer.
  2. Login with your Sitefinity Cloud Management Portal (Azure DevOps) account.
  3. Browse the blob storage account named after the website you are working on.
  4. Expand the Blob Containers item and select db-backups.
  5. Locate the folder containing database backup for the desired environment.
    AzureStrgExplorerDBBUsFolders
  6. Expand the folder and download the desired .bacpac file(s).
  7. Import the .bacpac file in your local environment SQL server.

Restore the database between environments

Sitefinity Cloud environments have been isolated to create a safe mechanism for deploying and testing code changes, while content editing on the production environment remains uninterrupted. The environments use separate databases. Use this procedure to restore a database from one environment to another.

To restore the database from one environment to another, perform the following:

  1. Login to Sitefinity Cloud Management Portal.
  2. Navigate to Pipelines » All » DB.
  3. In the list of available pipelines, select DB.RestoreBetweenEnvironments pipeline.
  4. In the upper-right corner, click Run pipeline.
    A dialog box opens.
  5. Select the Target environment.
    You can select any environment, except for Production and Authoring (Content Staging). Restoring the database from one environment to another can cause downtime. Production and Authoring (Content Staging) are considered production environments, therefore operations that can cause downtime are not allowed by default. If you need to restore the database from a non-production to a production environment, submit a request via support case.
  6. Click Run.
    • (Optional) Rollback the DB restore, if the application becomes unhealthy
      The default options is to rollback the database restore operation in case the application becomes unhealthy after it. If you want to proceed with the database restore regardless of how it affects the application, you can disable this option. 
    • (Optional) Persist Sitefinity config values
      The default option is to persist Sitefinity config values on the Target environment. This means that Sitefinity config values, which are stored on the Target database, will NOT be replaced with the ones from the Source. If you want to override the configurations on the Target environment, you can disable this option when you run the pipeline.

Was this article helpful?

Next article

Deploy code changes