SQL SERVER 2016数据库,50GB+的数据。有大量的增删和插入操作,数据库log文件变得异常的大,而且增长速度特别的快.周五log文件20GB,周一上班就成了200+GB了
因为数据库恢复模式是FULL的。而且备份策略,没周一full,其他每天一次differ。
USE AdventureWorks2012;
GO -- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE AdventureWorks2012 SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (AdventureWorks2012_Log, 1);
GO
-- Reset the database recovery model.
ALTER DATABASE AdventureWorks2012 SET RECOVERY FULL;
GO