sqlserver2008 收缩日志秘籍

时间:2022-01-18 07:13:32

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'HH91Full_Log' , 11,TRUNCATEONLY) 

 

GO


 --'这里的DNName_Log 如果不知道在sys.database_files里是什么名字的话,可以用以下注释的语句进行查询


USE Dbname


GO


SELECT file_id,  name FROM sys.database_files;


GO

USE [master]

GO

ALTER DATABASE Dbname SET RECOVERY FULL WITH NO_WAIT

GO

ALTER DATABASE Dbname SET RECOVERY FULL --还原为完全模式

GO