When attempting to attach a company database to SQL Server using SQL
Server Management Studio you receive error 9003 with a message similar
to this:
The log scan number %S_LSN passed to log scan in database '%.*ls' is not valid. This error may indicate data corruption or that the log file (.ldf) does not match the data file (.mdf). If this error occurred during replication, re-create the publication. Otherwise, restore from backup if the problem results in a failure during startup.
This can be caused when the database log file (.ldf) corrupt. SQL
Server cannot attach a database file (.mdf) with a matching corrupt log
file.
The best solution is to restore from a recent backup. However, if a
recent backup is not available then you can delete the corrupted log
file and then attach the database. SQL Server will then re-create the
log file.
Note: It's possible that data loss will occur if you delete the log
file so only perform this process if you don't have a recent backup.
To delete the log file