Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

SQL Server Error 1405: Database Already Enabled

· 4 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

SQL Server error 1405, “The database is already enabled for database,” appears when you try to enable a database for a feature (like Change Data Capture, Service Broker, or replication) that is already active on that database. The fix is usually to check the current state and either proceed with the existing configuration or disable and re-enable it if a fresh start is needed. Below is a step-by-step guide to resolve it.

What You'll Need

  • Access to SQL Server Management Studio (SSMS) or a query tool like Azure Data Studio.
  • Permissions to alter the database (typically the db_owner fixed database role or sysadmin server role).
  • The database name and the feature you were enabling (e.g., CDC, Service Broker, or replication).

Step-by-Step

  1. Identify the feature causing the error. The error message alone doesn't specify which feature. Look at the full error text in the SQL Server error log or the application that triggered it. Common culprits: Change Data Capture (CDC), Service Broker, or replication.
  2. Check the current database state. Run a query to see if the feature is already enabled. For CDC, use: SELECT is_cdc_enabled FROM sys.databases WHERE name = 'YourDB'; – if it returns 1, CDC is on. For Service Broker, check is_broker_enabled. For replication, look at sys.databases for is_published or is_merge_published.
  3. If the feature is already enabled, decide what you need. If you just wanted to ensure it's on, you're done – no further action is needed. If you need to reconfigure it (e.g., change CDC capture instances), you may need to disable and re-enable.
  4. To disable and re-enable (if necessary): For CDC, run EXEC sys.sp_cdc_disable_db; then re-enable with EXEC sys.sp_cdc_enable_db;. For Service Broker, use ALTER DATABASE YourDB SET NEW_BROKER; (this resets the broker, but be careful – it can break existing conversations). For replication, you'd need to drop and recreate the publication/subscription.
  5. If the feature is not actually enabled, but the error persists, check for orphaned metadata. Sometimes enabling fails midway, leaving flags. Run DBCC CHECKDB to ensure database integrity, then try the enable again after a restart of SQL Server service.
  6. After making changes, verify the state again with the same query from step 2 to confirm the desired setting.

Common Mistakes

  • Disabling CDC or Service Broker without understanding the impact – this can stop data capture or break applications relying on it.
  • Running the disable command on a production database without a maintenance window, causing downtime.
  • Assuming the error always means the feature is on – sometimes the flag is set but the feature is broken, so always verify with queries.
  • Using ALTER DATABASE SET NEW_BROKER on a database that uses Service Broker for messaging – this drops all existing conversations and can cause application errors.

Tips

  • Always back up the database before disabling/enabling features, especially in production.
  • Use a transaction in a test environment first to see the effect of disable/enable commands.
  • Check the SQL Server error log for more details – the error often comes with a stack trace that pinpoints the feature.
  • If you're enabling CDC, remember that enabling it on a database requires sysadmin privileges, not just db_owner.
  • For Service Broker, the database must have a master key for encryption; if not, you'll get a different error, but it's worth checking.

Troubleshooting

If the steps above don't resolve the issue:

  • Restart SQL Server service – sometimes the metadata is stale and a restart clears it.
  • Check for blocking sessions – another process might be holding a lock on the database. Use sp_who2 or the Activity Monitor to see.
  • Run DBCC CHECKDB – corruption can cause false flags. If corruption is found, restore from a clean backup.
  • Look for pending transactions – if a previous enable/disable was interrupted, use sys.dm_tran_active_transactions to see if something is stuck.
  • If all else fails, drop and recreate the database – but only as a last resort and after backing up all data. This will remove all features and let you start fresh.

Frequently Asked Questions

Can I ignore error 1405 if the database is already enabled?

Yes, if the feature is already active and you don't need to change anything, you can ignore it. The error is informational in that case.

Will disabling CDC delete my capture instances?

Yes, running sp_cdc_disable_db removes all capture instances and their associated jobs. You'll need to recreate them.

Does error 1405 affect other databases?

No, the error is specific to the database you're trying to enable. Other databases are unaffected.

Can I enable CDC on a database that is already enabled for Service Broker?

Yes, CDC and Service Broker are independent features. Error 1405 only occurs when you try to enable the same feature twice.

What if I get error 1405 when trying to enable replication?

This usually means the database is already published. Check the publication properties and either use the existing publication or drop it if you need a fresh setup.

Do I need to restart SQL Server after disabling/enabling?

Usually not, but if you encounter odd behavior, a restart can clear cached metadata.