Metasys stores alarms, trends, audit trails, and configuration data in SQL Server Express databases. Proper backup and maintenance prevents data loss and avoids the 10 GB Express edition size limit that can bring a system to a halt.
Metasys uses multiple databases:
| Database | Contents | Growth Rate |
|---|---|---|
| ADSAlarmDatabase | Alarm and event history | High |
| ADSAuditDatabase | User action audit trails | Medium |
| ADSTrendDatabase | Trend sample data | Very High |
| ADSConfigDatabase | System configuration | Low |
| Constraint | Limit | Impact |
|---|---|---|
| Database size | 10 GB per database | System stops logging when reached |
| RAM usage | 1 GB | Slower queries on large datasets |
| CPU cores | 1 socket / 4 cores | Limited concurrent performance |
| SQL Agent | Not available | Cannot use built-in job scheduler |
The built-in Database Manager provides the simplest backup approach:
Default Backup Location:
C:\ProgramData\Johnson Controls\MetasysIII\Backup\
Backup File Format:
ADSAlarmDatabase_YYYY-MM-DD_HHMMSS.bak
SQL Server Express lacks SQL Agent, but you can use Windows Task Scheduler:
Backup Script (backup_metasys.bat):
sqlcmd -S .\INTADSERVER -Q "BACKUP DATABASE [ADSAlarmDatabase] TO DISK='C:\Backups\Alarm_%date:~-4%-%date:~4,2%-%date:~7,2%.bak' WITH COMPRESSION"
sqlcmd -S .\INTADSERVER -Q "BACKUP DATABASE [ADSTrendDatabase] TO DISK='C:\Backups\Trend_%date:~-4%-%date:~4,2%-%date:~7,2%.bak' WITH COMPRESSION"
Schedule this via Task Scheduler to run nightly.
INTADSERVER).bak fileWhen upgrading Metasys to a new version with a newer SQL Server:
Monitor database sizes regularly:
Check Database Size:
sqlcmd -S .\INTADSERVER -Q "SELECT DB_NAME(database_id) AS Name, size*8/1024 AS SizeMB FROM sys.master_files WHERE type = 0"
| Strategy | Method | Impact |
|---|---|---|
| Automatic purge | Configure in Database Manager | Set retention period (e.g., 90 days) |
| Manual purge | Delete records older than date | Immediate space recovery |
| Archive and purge | Backup then purge | Preserves historical data |
Database Manager > Maintenance:
Alarm Retention: 180 days
Trend Retention: 365 days
Audit Retention: 365 days
Purge Schedule: Weekly (Sunday 2:00 AM)
Symptom: Alarms stop logging, trends show gaps
Cause: Database reached 10 GB Express limit
Immediate Fix:
1. Run emergency purge of oldest data
2. Shrink database files
3. Verify logging resumes
Long-term Fix:
- Implement automatic purging
- Reduce trend sample rates where possible
- Consider SQL Server Standard for large sites
Fix:
1. Stop all Metasys services (ADS, OAS, etc.)
2. Close all SQL Management Studio connections
3. Set database to single-user mode if needed
4. Retry the restore
5. Set back to multi-user mode
6. Restart Metasys services
Diagnosis:
DBCC CHECKDB ('ADSAlarmDatabase') WITH NO_INFOMSGS
Repair (last resort):
ALTER DATABASE [ADSAlarmDatabase] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CHECKDB ('ADSAlarmDatabase', REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE [ADSAlarmDatabase] SET MULTI_USER
| Task | Frequency | Method |
|---|---|---|
| Full backup | Daily | Automated script |
| Size monitoring | Weekly | Database Manager or script |
| Purge old records | Monthly | Automatic purge setting |
| Index maintenance | Quarterly | Rebuild indexes |
| Integrity check | Quarterly | DBCC CHECKDB |
| Test restore | Quarterly | Restore to test environment |
A healthy database is the foundation of a reliable Metasys system. Schedule maintenance before the 10 GB limit forces an emergency intervention.