Zoomed Image

Backup and Recovery

xAssets Configuration Guide
Deployment and Administration

Backup and Recovery

This page explains what to back up in an xAssets deployment, how to configure automated backups, and how to recover from data loss. A reliable backup strategy is essential for protecting your asset management data.

What to Back Up

An xAssets deployment consists of three components that must be backed up together to ensure a complete and consistent restore:

Component Location Contains
Database SQL Server or MariaDB All asset records, user accounts, configuration data, queries, forms, menus, transformations, discovery data, and audit history
CustomerData folder File system (typically C:\xam7\CustomerData\{dbname}\) XDML configuration files (forms, queries, menus, transforms), XCS scripts, AMSX scripts, HTML templates, and uploaded files
CustomerDataPrivate folder File system (typically C:\xam7\CustomerDataPrivate\{dbname}\) Credential packs, settings files, SSL certificates, and other sensitive configuration that should not be in the web-accessible CustomerData folder

Warning: Backing up the database alone is not sufficient. The CustomerData and CustomerDataPrivate folders contain configuration files that are essential for the application to function. A database restore without the matching file system will result in missing forms, queries, and other configuration.

Built-in Backup System

xAssets includes a built-in backup system that runs as a scheduled AMSX transformation via the batch service. This system can back up all three components automatically.

How Built-in Backups Work

The built-in backup system creates timestamped backup files in a designated backups folder:

  1. Database backups -- full database backups (.bak files) are created daily, with transaction log backups every 15 minutes (when using SQL Server Full recovery model).
  2. File backups -- the CustomerData and CustomerDataPrivate folders are zipped into timestamped .zip files. Full file backups are created alongside full database backups; incremental file backups (containing only changed files) are created alongside log backups.
  3. Cleanup -- old backup files are automatically deleted after a configurable retention period (default: 2 days).

Configuring Built-in Backups

The backup system is configured through Special Options in the xAssets database:

Special Option Default Description
BackupRetainDays 2 Number of days to retain backup files before automatic deletion
BackupTransformation (none) The transformation ID of the AMSX script that triggers the backup

To enable automated backups:

  1. Create an AMSX transformation containing the single command Backup.
  2. Schedule this transformation to run every 15 minutes via Admin > Batch > Schedules.
  3. Set the BackupTransformation Special Option to the transformation ID.
  4. Ensure the backups folder exists and the IIS application pool identity has read/write access to it.

Tip: The backup system validates the integrity of its backup chain on every cycle. If it detects a broken chain (missing or corrupt files), it automatically triggers a new full backup to establish a clean starting point.

SQL Server Backup Strategies

If you prefer to manage database backups outside of the xAssets built-in system, use standard SQL Server backup tools:

Full Backups

Schedule full database backups at least once daily using SQL Server Agent, a maintenance plan, or a third-party backup tool. A typical schedule is a nightly full backup during off-peak hours.

BACKUP DATABASE [YourDatabaseName]
TO DISK = 'D:\Backups\YourDatabaseName_Full.bak'
WITH INIT, COMPRESSION;

Transaction Log Backups

If your database uses the Full recovery model, schedule transaction log backups every 15-30 minutes to minimise data loss in the event of a failure:

BACKUP LOG [YourDatabaseName]
TO DISK = 'D:\Backups\YourDatabaseName_Log.trn'
WITH COMPRESSION;

Differential Backups

For large databases, consider adding differential backups between full backups to reduce restore time:

BACKUP DATABASE [YourDatabaseName]
TO DISK = 'D:\Backups\YourDatabaseName_Diff.bak'
WITH DIFFERENTIAL, COMPRESSION;

File System Backups

Back up the CustomerData and CustomerDataPrivate folders using your standard file backup solution (Windows Server Backup, third-party agents, or the built-in xAssets backup system).

Key considerations:

  • Consistency -- ideally, file backups should be taken at approximately the same time as database backups to ensure the configuration files match the database state.
  • Exclusions -- the following subfolders within CustomerData can optionally be excluded from backups to save space, as they contain data that can be regenerated: pcafiles, uploads, discovery, pcanalyser, crystal, demodata, demodatasource, help, reports, reportview, scanner, userfiles.
  • Sensitive data -- the CustomerDataPrivate folder contains credential packs and should be backed up securely with appropriate access controls.

Recovery Procedures

Restoring the Database

  1. Stop the xAssets application pool in IIS to prevent user access during the restore.
  2. Restore the full database backup using SQL Server Management Studio or T-SQL:
    RESTORE DATABASE [YourDatabaseName]
    FROM DISK = 'D:\Backups\YourDatabaseName_Full.bak'
    WITH REPLACE, RECOVERY;
    
  3. If transaction log backups are available, apply them in sequence to recover to the most recent point:
    RESTORE LOG [YourDatabaseName]
    FROM DISK = 'D:\Backups\YourDatabaseName_Log_1.trn'
    WITH NORECOVERY;
    -- Repeat for each log backup in sequence
    RESTORE LOG [YourDatabaseName]
    FROM DISK = 'D:\Backups\YourDatabaseName_Log_N.trn'
    WITH RECOVERY;
    
  4. Restart the IIS application pool.
  5. Log in to xAssets and verify data integrity.

Restoring Files

  1. Stop the xAssets application pool in IIS.
  2. Restore the CustomerData and CustomerDataPrivate folders from your file backup to their original locations.
  3. Restart the IIS application pool.
  4. Verify that forms, queries, and menus load correctly.

Warning: When restoring files, ensure the restored files match the restored database. Restoring files from a different point in time than the database can cause configuration mismatches.

Testing Backups

Regularly test your backup and recovery procedures:

  1. Restore to a test environment -- restore both the database and files to a separate server to verify the backup is complete and functional.
  2. Verify application startup -- confirm that xAssets starts correctly, users can log in, and key data is present.
  3. Check configuration -- open several forms, queries, and dashboards to confirm all configuration loaded correctly.
  4. Document the process -- record the time taken and any issues encountered so recovery expectations are realistic.

Tip: Schedule a backup test at least quarterly. The worst time to discover a backup problem is during an actual recovery.