Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SQLServer 清理日志文件
USE [master]
GO
ALTER DATABASE DBNAME SET RECOVERY SIMPLE WITH NO_WAIT
GO
ALTER DATABASE DBNAME SET RECOVERY SIMPLE -- 设置简单模式
GO
USE DBNAME
GO
DBCC SHRINKFILE (N'DBNAME_log' , 2, TRUNCATEONLY) -- 设置压缩后的日志大小为 2M
GO
USE [master]
GO
ALTER DATABASE DBNAME SET RECOVERY FULL WITH NO_WAIT
GO
ALTER DATABASE DBNAME SET RECOVERY FULL -- 还原为完全模式
GO
-- 修改 DBNAME 为要清理的数据库名
# help
https://www.cnblogs.com/IIXS/p/11710759.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.