压缩ms sql server log

log常常被爆满,可以使用下面方法压缩:

 

Insus.NET 会建一个ms sql job来自动执行它。

USE [master]
GO
ALTER DATABASE [DB_Name] SET RECOVERY SIMPLE WITH NO_WAIT
GO
ALTER DATABASE [DB_Name] SET RECOVERY SIMPLE   
GO
USE [DB_Name]
GO
DBCC SHRINKFILE (N'DB_Name_log' , 100, TRUNCATEONLY)
GO
USE [master]
GO
ALTER DATABASE [DB_Name] SET RECOVERY FULL WITH NO_WAIT
GO
ALTER DATABASE [DB_Name] SET RECOVERY FULL 
GO
Source Code

 

posted @ 2022-02-14 09:59  Insus.NET  阅读(882)  评论(0编辑  收藏  举报