Issue
SQL Databases are marked Suspect. The SQL error log contains "The log scan number () passed to log scan database is not valid"
Product
Struxureware Power Monitoring
Power Monitoring Expert
ION Enterprise
ION EEM
Environment
SQL Server 2005, SQL Server 2008 R2, SQL Server 2012, SQL Server 2014, SQL Server 2016, SQL Server 2017, SQL Server 2019
Cause
This is generally caused by a corrupt LDF file.
Resolution
*Warning: Irreparable database damage can occur. This procedure should only be performed by users familiar with SQL Server Management Studio. Databases should be backed up before performing this procedure.*
To correct this, the databases can be rebuilt using the following script replacing DBName with the database name.
ALTER DATABASE DBName SET EMERGENCY
ALTER DATABASE [DBName] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
go
USE MASTER
go
DBCC CHECKDB (DBName, REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS
go
EXEC sp_resetstatus DBName
** See the attachment containing the SQL script text