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:
- Database backups -- full database backups (
.bakfiles) are created daily, with transaction log backups every 15 minutes (when using SQL Server Full recovery model). - File backups -- the CustomerData and CustomerDataPrivate folders are zipped into timestamped
.zipfiles. Full file backups are created alongside full database backups; incremental file backups (containing only changed files) are created alongside log backups. - 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:
- Create an AMSX transformation containing the single command
Backup. - Schedule this transformation to run every 15 minutes via Admin > Batch > Schedules.
- Set the
BackupTransformationSpecial Option to the transformation ID. - 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
- Stop the xAssets application pool in IIS to prevent user access during the restore.
- 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; - 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; - Restart the IIS application pool.
- Log in to xAssets and verify data integrity.
Restoring Files
- Stop the xAssets application pool in IIS.
- Restore the CustomerData and CustomerDataPrivate folders from your file backup to their original locations.
- Restart the IIS application pool.
- 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:
- Restore to a test environment -- restore both the database and files to a separate server to verify the backup is complete and functional.
- Verify application startup -- confirm that xAssets starts correctly, users can log in, and key data is present.
- Check configuration -- open several forms, queries, and dashboards to confirm all configuration loaded correctly.
- 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.
Related Articles
- Failover -- automated backup shipping and standby server configuration
- Upgrading -- backups are essential before upgrading
- System Requirements -- disk space planning for backups