Is there a script that I can run against multiple servers to see if the LDF file is corrupt? This is for error: 8985 when you try to shrink the log file. I want to see if multiple servers have a corrupt ldf file.
But you have to run DBCC CHECKDB to detect database corruption, regardless if it's the data or log files. If you want to run it against a group of servers, then you'll need to utilize a Powershell script or similar. Here's a simple one using sqlcmd.exe that can be wrapped into a cmd file.
If your log file is corrupt, my concern is that a backup/restore would retain the corruption. My approach (which would probably be faster to complete) would be: 1. Run a full backup. 2. Detach database. 3. Delete/rename the log file. 4. Attach the database and rebuild the log file. 5. Take a second full backup. To attach the database and rebuild the log file, it's just additional syntax in the CREATE DATABASE statement: CREATE DATABASE [foo] ON (FILENAME=<<Path to data file>>) FOR ATTACH_REBUILD_LOG; This will force SQL Server to rebuild the log file when it attaches the database. The risk in this is losing whatever transactions happen between the completion of the full backup and detaching the database, but it sounds like this will be a minimal risk.