Search This Blog

Saturday, August 28, 2021

MSSQL: Decrease/Reduce the size of sql server log file

 

USE Your_Database_Name;
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE Your_Database_Name
SET RECOVERY SIMPLE; GO DBCC SHRINKFILE (Your_Database_Name_Log, 1); -- Will resize log file to 1 MB.
GO ALTER DATABASE Your_Database_Name -- Reset the database recovery model.
SET RECOVERY FULL; GO

Friday, August 6, 2021

MSSQL: The log scan number (85:368:1) passed to log scan in database 'model' 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 start up.

 


 First: Go to this path C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\Binn\Templates


Second: Copy and paste the database/file named model.mdf and modellog.ldf to this path C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA



Now, problem will be resolved !