Skip to content

Databases

Afi provides comprehensive backup and recovery support for Azure MS SQL databases, as well as online preview and export for database data and metadata.

Browse

Inside the database backup, you can browse its configuration, schema, and table data.

Configuration

Table data

The database data preview allows you to navigate across data tables and view all cell values for a specific row by clicking on that row:

Schema

Afi saves the database schema as part of the backup, allowing you to browse it as a collection of SQL scripts that describe database tables, constraints, views, procedures, and more.

At the root of the schema browse view, you can find an sql_schema.dacpac file containing the complete description of the database’s data structure in DACPAC format. You can use this file to recreate the database with the same data structure configuration as the original.

To view the contents of a DACPAC file locally, add the .tar extension to the file name and unpack it as an archive:

Scripts under the Schema tab are stored in per-schema folders, with a separate folder for each script type (Tables, Functions, Views, etc.):

View SQL script versions

To view all versions of an SQL script stored by the service, click the three-dot icon in the corresponding row and then select Show backup versions. A dialog will appear, listing every script version along with the backup snapshot times where each version exists.

You can select and download any of the listed versions:

Afi allows to search across SQL scripts backed up as a part of the database schema by script name. The following example shows a search query to find all SQL scripts named SampleTable:

Export

Configuration

You can copy or download a JSON with the Azure configuration of a virtual machine and its SQL server from the backup browse view.

Table data

You can download table data for selected tables in CSV format. Please note that fields with binary data types are not included in the export.

Schema

You can download SQL scripts or entire folders containing scripts by selecting them in the backup browse view and clicking Download:

Recovery

You can restore a database from a backup snapshot, creating a new database in the selected SQL Server.

To restore a database:

  1. Click Recover in the database backup browse view to open the recovery dialog.
  2. Enter a name for the database to be restored.
  3. (Optional) Select the Azure subscription ID, resource group, and location for the new database instance.
  4. Select an SQL Server instance where the new database instance will be created.
  5. Select a secret (login/password pair) that the recovery task will use to connect to the restore destination SQL Server.
  6. Click Recover to initiate the database recovery.

Afi will display the recovery progress on the Activity → Tasks tab and send you an email notification once recovery completes.

Info

When you click on the Subscription, Resource group, Location, or SQL Server field, Afi automatically shows a searchable list of the corresponding entities available on the Azure side.

Create a secret for SQL server access

You can create a secret (login/password pair) for SQL Server access directly in the recovery dialog by entering the login and password that Afi will use to connect to the server. The secret is securely stored on the Afi side in encrypted format and can be reused for future recoveries with that server.

Info

If you don't want to retain the server credentials on the Afi side after the recovery, you can delete the corresponding secret on the Service → Settings → Secrets tab.