You're restarting SQL Server after a crash, or maybe attaching a database from a backup, and you get ERROR_TRANSACTIONMANAGER_RECOVERY_NAME_COLLISION (0x00001A40). The server won't start. You check the error log and see something like 'Two databases have the same log file name'. This happens most frequently when somebody copies a database file (.mdf) and log file (.ldf) from another server without renaming the log file first. The transaction manager sees a duplicate name—same database ID collision in the log stream—and refuses to run recovery because it can't tell the two apart.
Root Cause
Every SQL Server database has a unique database ID inside the log file header. When two databases try to use the same log file name (the physical file name on disk, like C:\Data\MyDB_log.ldf), the recovery process sees that the log sequence numbers conflict. It's like two people showing up with the same passport number. The system panics, throws 0x1A40, and stops. This isn't a permissions issue or a corrupted disk—it's a naming collision inside the transaction manager's internal tables.
The Fix
- Identify the two databases. You need the names of both databases that share the log file name. Run this query in SQL Server Management Studio (SSMS) on a working instance:
Look for two entries whereSELECT name, physical_name FROM sys.master_files WHERE type_desc = 'LOG';physical_nameis identical. That's your problem pair. - Take one database offline. You can't rename a log file while the database is online. Right-click the duplicate database in SSMS, choose Tasks → Take Offline. If the server won't start at all, you'll need to start it in single-user mode with
NET START MSSQLSERVER /ffrom command prompt. Then connect withsqlcmdand run:
ALTER DATABASE [YourDB] SET OFFLINE; - Rename the physical log file. Navigate to the folder where the .ldf files live. Right-click the log file of the offline database, rename it (e.g.,
MyDB_log.ldf→MyDB_log_new.ldf). Keep the same extension. SQL Server doesn't care what the filename is, as long as it's unique. - Update SQL Server's metadata. Still connected to the server, run:
Replace the path with your actual path. After this, SQL Server knows the file moved.ALTER DATABASE [YourDB] MODIFY FILE (NAME = YourDB_log, FILENAME = 'C:\Data\MyDB_log_new.ldf'); - Bring the database back online. Run:
Recovery should complete without the collision error. The server will start normally now.ALTER DATABASE [YourDB] SET ONLINE;
If It Still Fails
Sometimes the error persists because the transaction manager has a cached reference. Force a full restart of the SQL Server service after the rename. If that doesn't work, check for a third database that also has the same log file name—rare but possible when someone bulk-attaches databases from a script. Also verify the file path is correct in step 4—typos are common. If you still get 0x1A40, you can detach the problem database, delete the old .ldf file, and re-attach it. SQL Server will create a fresh log file with a unique name. That's the nuclear option, but it works 100% of the time.