Explanation : Error: 5125, Severity: 24, State: 2
Posted by blakhani on December 4, 2014
While playing with log shipping and backup restore, one of my database gone bad and was not coming online. I checked ERRORLOG and found below messages.
2014-11-20 22:16:59.37 spid51s Error: 5125, Severity: 24, State: 2.
2014-11-20 22:16:59.37 spid51s File ‘C:\SQLServerData\MyTestLogShippping.ndf’ appears to have been truncated by the operating system. Expected size is 19325 KB but actual size is 0 KB.
The error message is pretty clear and takes away blame from SQL Server. I checked the size of MyTestLogShippping.ndf and it was indeed zero KB. In my case, I was copying the file over the network and something might have gone wrong during that. It is clear that SQL Server checked for “expected” size and “actual” size during recovery of database and if there is a mismatch, above error is logged.
What can be done to fix the issue? Well, restore from backup is option to get out from this situation. Or, if you can get back the original copy of the problematic file (which is close to impossible) then use that for recovery.
If its frequent on your environment then you may need to check if you have some third party tool which is doing disk defragmentation.
hope this helps.