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