USE [master]
ALTER DATABASE [要清理的库] SET RECOVERY SIMPLE WITH NO_WAIT --设置为简单模式,只有在简单模式下才可以删除 ALTER DATABASE [要清理的库] SET RECOVERY SIMPLE GO USE [要清理的库] DECLARE @logname VARCHAR(150) SELECT @logname = NAME FROM sys.database_files WHERE NAME LIKE'%log' DBCC SHRINKFILE(@logname,11,TRUNCATEONLY) GO
USE [master]
ALTER DATABASE [要清理的库] SET RECOVERY FULL WITH NO_WAIT --删除完毕之后,恢复为完整模式 ALTER DATABASE [要清理的库] SET RECOVERY FULL GO
标签:文件,SET,RECOVERY,DATABASE,清理,Server,日志,ALTER From: https://www.cnblogs.com/xiaobaidejiucuoben/p/17040385.html