How do I decrease the size of my sql server log file?

前端 未结 6 876
梦谈多话
梦谈多话 2020-12-04 13:08

So I have been neglecting to do any backups of my fogbugz database, and now the fogbugz ldf file is over 2 and half gigs. Thats been built up over the six months we\'ve been

6条回答
  •  难免孤独
    2020-12-04 14:03

    This is one of the best suggestion in which is done using query. Good for those who has a lot of databases just like me. Can run it using a script.

    https://medium.com/@bharatdwarkani/shrinking-sql-server-db-log-file-size-sql-server-db-maintenance-7ddb0c331668

    USE DatabaseName;
    GO
    -- Truncate the log by changing the database recovery model to SIMPLE.
    ALTER DATABASE DatabaseName
    SET RECOVERY SIMPLE;
    GO
    -- Shrink the truncated log file to 1 MB.
    DBCC SHRINKFILE (DatabaseName_Log, 1);
    GO
    -- Reset the database recovery model.
    ALTER DATABASE DatabaseName
    SET RECOVERY FULL;
    GO
    

提交回复
热议问题