Troubleshooting Guide: SQL Server Error 5090 – Change Tracking Cannot Be Modified for System Databases
Why This Error Happens
This error occurs because SQL Server explicitly restricts Change Tracking configuration changes on system databases such as master, model, msdb, and tempdb. The engine enforces this restriction at a core level to protect internal metadata and prevent instability in system catalogs, regardless of the permissions or server role assigned to the executing login. This is a designed behavioral guardrail in SQL Server 2025, not a bug, corruption issue, or permissions gap—meaning no amount of elevated access will bypass it.
Step-by-Step Resolution Guide
Step 1: Identify the Target Database in Your Script
- Open the T-SQL script or application code that triggered the
ALTER DATABASE ... SET CHANGE_TRACKINGcommand. - Check the database name referenced in the error message placeholder (
%.*ls) to confirm it is indeed a system database (master,model,msdb, ortempdb). - Use the following query to confirm database type:
SELECT name, database_id, is_change_tracking_on
FROM sys.databases
WHERE name = 'YourDatabaseName';
Step 2: Redirect Change Tracking to a User Database
- Determine the actual business/user database that requires change tracking (e.g.,
SalesDB,InventoryDB). - Run the enable command against the correct user database instead:
ALTER DATABASE SalesDB
SET CHANGE_TRACKING = ON
(CHANGE_RETENTION = 7 DAYS, AUTO_CLEANUP = ON);
- Ensure the database compatibility level is at least 90 or higher before enabling.
Step 3: Audit Automated Scripts or Deployment Pipelines
- Review SSDT projects, DACPAC deployments, or PowerShell/DevOps pipelines (common in Windows Server 2025 CI/CD setups) that may be looping through all databases in
sys.databases. - Add an exclusion filter in your scripts to skip system databases:
WHERE database_id > 4
- Update any SQL Agent Jobs or Maintenance Plans that blindly apply change tracking settings instance-wide.
Step 4: Restart the SQL Server Service (If Configuration Cache is Suspected)
- In rare cases involving cached metadata on Windows Server 2025, restart the SQL Server service via SQL Server Configuration Manager.
- Navigate to
Services > SQL Server (MSSQLSERVER)and select Restart to clear any stale session configurations.
Alternative or Verification Steps
- Verify the fix: Run
SELECT * FROM sys.change_tracking_databases;to confirm that only the intended user database appears in the output, and that the system database was never altered. - Alternative workaround: If you specifically need to track internal system changes for auditing purposes, use SQL Server Audit or Extended Events instead of Change Tracking, as these features are supported on system databases and are purpose-built for engine-level monitoring.