SQL Server 清空Log

SELECT name, log_reuse_wait_desc FROM sys.databases 

--if the log_reuse_wait_desc  is replication then remove it

EXEC sp_removedbreplication YourDatabaseName

SELECT name, log_reuse_wait_desc FROM sys.databases 

-- log_reuse_wait_desc  on database should be changed to "nothing" now. if yes do following steps

ALTER DATABASE YourDatabaseName SET RECOVERY SIMPLE

DBCC SHRINKFILE (N'Your Logical Log Name', 0, TRUNCATEONLY)

 --Now My log file size drop from 18GB to 0MB

--after that you should reset you database recovery model to full if you need.

猜你喜欢

转载自woothon.iteye.com/blog/2229379