

LDF file attachment, without it a NEW log file will be created in the default location. N' MSSQL\DATA\AdventureWorks2012_DATA01.mdf' (FILENAME = 'E:\MSSQL\LOGS\AdventureWorks2012_LOG01.ldf') CREATE DATABASE AdventureWorks2012 ON (FILENAME = 'D:\MSSQL\DATA\AdventureWorks2012_DATA01.mdf') RESTORE DATABASE AdventureWorks2012 FROM DISK 'D:\AdventureWorks2012.BAK' GO In above Query you need to keep in mind about. ldf file or move to a different location. Although it is much easier to restore database using SSMS as stated in many answers. You can you do this by detaching the database first and then move the files or rename the files.ĮXEC sp_detach_db = 'AdventureWorks2012' Now rename the. Rename your log file or move your log file to different location. GO and then restore to the earlier nights good backup. RESTORE VERIFYONLY FROM DISK = H:\Backups\AdventureWorks2012.BAK These are the steps that I took to resolve the issue.Īnd there are lot of allocations errors and database has been corrupted.įix1: Restore the Previous nights good backup can fix this.īefore you restore make sure you have good backup it can be verified by running the below. Otherwise, restore from backup if the problem results in a failure during Startup.

If this error occurred during replication, re-create the publication. This error may indicate data corruption or that the log file (.ldf) does not match the data file (.mdf). The log scan number (87817:27:0) passed to log scan in database 'AdventureWorks2012' is not valid. I have got this error message earlier this morning and all my user database backups failed due to this.
