One or more files do not match the primary file of the database – Error 5173

01 March,2013 by Jack Vamvas

A SQL Server Instance  was shut down suddenly. When the SQL Server recovery a number of databases were in a RECOVERY_PENDING state.

The error messages in the SQL Server Error Log were :

--An example error message
Log file 'F:\MSSQLSERVER\MSSQL$MYINST\Data\db1_log.LDF' does not match the primary file.  It may be from a different database or the log may have been rebuilt previously.
Error: 5173, Severity: 16, State: 1.
One or more files do not match the primary file of the database. If you are attempting to attach a database, retry the operation with the correct files.  If this is an existing database, the file may be corrupted and should be restored from a backup.


RECOVERY_PENDING means “Recovery of the file has been postponed. The file was online or did not exist before being changed to RECOVERY_PENDING by a partial restore”

Main reasons for database stuck in RECOVERY_PENDING after a sudden shutdown

1) Log is missing

2) Log is corrupt

3) Drive not online

Possible actions

1)      If the drive is available and online – try a SQL Server restart , as the drive may have been unavailable during restart

2)      If  the restart doesn’t solve the problem  , then RESTORE from a valid BACKUP

3)      A Workaround  For Error: 5173, Severity: 16, State: 1 try :

a)       Detach the database

b)       Delete the LDF file

c)       Reattach the database again

 Read More

 SQL Database Status with sys.databases - SQL Server DBA

SQL Server Database Status,monitoring and Restores

SQL Server Database SUSPECT state - SQL Server DBA

Author: Jack Vamvas (


Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.


Post a comment on One or more files do not match the primary file of the database – Error 5173 | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer