How to delete an oversized SQL SERVER .LOG file
Sometimes, a .LOG file from a database is too large despite a SHRINK, here is how to delete the .LOG file and start with a new, much smaller .LOG file
-- 1) Detach the database
-- 2) Rename the .LOG or .LDF file with the .OLD extension
-- 3) Execute this line and change the database name as it was and the path of the .MDF file (note that the name may be different from the file name)
exec sp_attach_single_file_db 'GroupWtlib','C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\GroupWtlib.mdf'
-- 4) A message appears that it cannot find the LOG file but it will create a new one by default
-- File activation failure. The physical file name "C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\GroupWtlib_log.ldf" may be incorrect.
-- New log file 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\GroupWtlib_log.ldf' was created.
-- 5) Delete your .OLD file
Aucun commentaire pour le moment.