The error SQL Server Error 909—*"Database cannot be started in this edition"*—means your database file is locked to a higher edition of SQL Server than what’s installed (for example, a Standard Edition trying to run an Enterprise Edition database). Here’s how to resolve it. First, ensure you only need to upgrade the SQL Server instance, not the whole server. If you’re using the wrong edition, you’ll need to install the correct one or migrate the database. No third-party tools or hacks are needed; this always requires direct SQL Server or Windows admin changes.
What You'll Need
- A supported Microsoft SQL Server edition matching your database requirements (e.g., Enterprise, Developer, or Standard).
- Administrator privileges on the Windows server running SQL Server.
- Access to the SQL Server Management Studio (SSMS) or Command Line Interface (SQLCMD).
- The SQL Server installation media (if not already installed).
- Backup of the database (optional but recommended for safety).
Step-by-Step
- Verify the database edition mismatch:
Open
SQL Server Management Studio. Connect to the instance, expand the database, right-click the database, and select Properties. Go to the Compatibility Level tab. Note the database’s edition (e.g., Enterprise) and compare it to the installed SQL Server edition (check viassms> Server Properties > General under Edition). If they differ, proceed to the next step. If not, check the.mdfand.ldffile permissions in the data folder—these may need elevation to allow the wrong edition to start. - Create a backup (if possible) before proceeding: Right-click the database, select Tasks > Back Up. Ensure you have a full backup before altering the database setup. This step is critical to avoid data loss in case of errors.
- Check if the SQL Server instance is running:
If the service is already running, stop it via
services.msc(search for "services" in Windows Start). Then, open an elevated Command Prompt and run:sqlcmd -S YOUR_SERVER_NAME -E -Q "ALTER DATABASE [YourDatabaseName] SET SINGLE_USER WITH RECOVERY"ReplaceYOUR_SERVER_NAMEwith the actual server name. This puts the database in single-user mode, allowing you to inspect or modify it without other connections. - Install the correct SQL Server edition: If the database requires a higher edition than installed (e.g., Enterprise), download the official installer from Microsoft’s website (ensure you match the OS version). Run the installer, selecting the appropriate edition and components. During setup, the installer will guide you through adding the database to the new edition. If prompted, choose Add Databases from Previous Installation (if applicable) and select your existing databases.
- Recreate the database with the correct edition:
If upgrading SQL Server isn’t possible (e.g., the server is already in use), you must recreate the database in the correct edition. This involves:
- Using SSMS, right-click the database > Tasks > Restore > Database. Choose the backup file and restore to a new, empty database (this step does not retain permissions or objects; you’ll need to recreate them later).
- Once restored, attach the original
.mdfand.ldffiles to the new database (rename the files to match the new database name if needed). - Set the compatibility level in the new database to match the original (via Properties > Compatibility Level).
- Reconfigure permissions: If you recreated the database, grant permissions to the correct users. Open SQL Server Management Studio, expand the database, right-click the server > Properties > Security. Assign roles like db_owner to relevant users or groups. Avoid granting excessive rights (e.g., sysadmin) unless necessary.
If That Did Not Work
If the database still won’t start after the above steps, try these advanced checks:- Reinstall SQL Server entirely (last resort). Ensure you select the correct edition during setup, and check Add Databases from Previous Installation if needed.
- Verify the
.mdfand.ldffiles are not corrupted. Open Command Prompt as admin and navigate to the database folder. Check file integrity with:ftype .mdfIf files are corrupt, restore from backup. - Check the Windows Event Viewer for SQL Server-specific errors. Open
eventvwr.msc, navigate to Windows Logs > Application, and filter for "SQL Server". Look for errors related to startup or permission failures.
Common Mistakes
- Skipping the backup: Without a backup, recreating or migrating the database could lead to irreversible data loss. Always take a full backup before altering database structures.
- Incorrect edition mismatch: Ensuring the SQL Server instance matches the database edition is critical. For example, a Standard Edition SQL Server cannot host an Enterprise Edition database. Always verify via
ssms> Server Properties. - Forgetting to set compatibility level: After recreating the database, the
Compatibility Level must align with the database’s requirements (e.g., SQL Server 2016 for a legacy app). This is often overlooked. - Insufficient permissions: The file system must allow the SQL Server service to read/write the
.mdfand.ldffiles. Check ownership viaicaclsin Command Prompt or Windows Explorer. Grant Read & Execute and Modify permissions to the SQL Server service account.
Tips
- Use SQL Server Data Tools (SSDT) for development: If you’re developing databases, use the free SQL Server Data Tools (part of Visual Studio) to create and deploy databases with correct edition compatibility. This avoids manual setup errors.
- Check for third-party dependencies: Some applications (e.g., reporting tools) may rely on specific SQL Server features. Ensure the database version supports these tools before upgrading.
- Monitor SQL Server services: After making changes, restart the SQL Server service via
services.mscto ensure the instance recognizes the new edition. If the service fails to start, check the Event Viewer for startup errors. - Consider cloud migration for future-proofing: If upgrading SQL Server is not an option, migrate the database to a cloud provider (Azure SQL, AWS RDS) that offers flexible edition support. This avoids hardware limitations entirely.
Troubleshooting
- Database won’t start in single-user mode:
If
ALTER DATABASE ... SET SINGLE_USERfails with a permissions error, run the command as an admin and ensure the SQL Server service account has access to the database files. Check file permissions via Windows Explorer oricacls. - The SQL Server service starts but the database doesn’t:
Open a new SSMS instance and attempt to connect. If you get a "Login failed" error, verify the server name and credentials. Use
sqlcmd -S LOCAL -E(with -E for Windows Authentication) to test connectivity. If this fails, check the Event Viewer for authentication or startup errors. - Files are locked by another process:
Use
Process Explorer(from Sysinternals) to see which process holds the.mdflock. If a third-party tool is causing the issue, contact its support team to resolve the lock. - Compatibility level conflicts: If the database was created in SQL Server 2016 but you’re upgrading to 2022, set the compatibility level to 140 (SQL Server 2016) in the database properties.
Frequently Asked Questions
Can I fix this error without reinstalling SQL Server?
Yes, if the database edition mismatch is the sole issue. You can:
- Install the correct SQL Server edition (e.g., Enterprise if needed), or
- Recreate the database in the correct edition using a backup if the server doesn’t support the higher edition.
What if I don’t have a backup?
If you lack a backup, recreating the database from scratch is your only option. This requires dropping the original database and restoring a new one (from a schema or manual SQL script) to the correct edition. This process is irreversible—ensure all critical data is restored from a previous backup.
How do I check if SQL Server is running in the correct edition?
Open SSMS, go to Server Properties > General, and look for the Edition field. Compare it to the database’s Compatibility Level in Properties > Compatibility Level. If they differ, you have an edition mismatch.
Why does the database show "Not Found" after recreating it?
This typically happens if:
- The database name was changed during restore, and the original files are still locked, or
- The
.ldffile is missing or corrupted. Recreate it by restoring the backup or setting it to auto-grow.
ssms > Server Objects > Databases to verify the database exists and check its properties for errors.
Is it safe to set compatibility level to 120 (SQL Server 2014) if the database was created in 2016?
No. To avoid data corruption or application errors, set the compatibility level to match the database’s creation version. Use the version of SQL Server that matches the original creation (e.g., 140 for SQL Server 2016).
Can I use a trial version of SQL Server to fix this?
No. Trial editions are time-limited and may not include all features required by your database. Always use the full, licensed edition (Developer, Standard, or Enterprise) for production environments.