清理SQLSERVER日志

GO

--在查询结果中获得日志文件名

select * from sysfiles

--DB日志
USE  [DataBaseName];
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE [DataBaseName]
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE ( [LOGFileName] , 1);
GO
-- Reset the database recovery model.
ALTER DATABASE [DataBaseName]
SET RECOVERY FULL;

你可能感兴趣的:(sqlserver)