DUMP TRANSACTION TOPPower_NET WITH NO_LOG
go
BACKUP LOG TOPPower_NET WITH NO_LOG
go
DBCC SHRINKDATABASE(TOPPower_NET)
go
USE [master]
GO
ALTER DATABASE TOPPower_NET SET RECOVERY SIMPLE WITH NO_WAIT
GO
ALTER DATABASE TOPPower_NET SET RECOVERY SIMPLE --简单模式
GO
USE TOPPower_NET
GO
DBCC SHRINKFILE (N'TOPPower_NET_Log' , 1, TRUNCATEONLY)
GO
USE [master]
GO
ALTER DATABASE TOPPower_NET SET RECOVERY FULL WITH NO_WAIT
GO
ALTER DATABASE TOPPower_NET SET RECOVERY FULL --还原为完全模式
GO
创建清理日志的存储过程的方法
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
CREATE PROCEDURE [dbo].[clearlog]
AS
SET NOCOUNT ON
ALTER DATABASE TOPPower_NET SET RECOVERY SIMPLE WITH NO_WAIT
ALTER DATABASE TOPPower_NET SET RECOVERY SIMPLE --简单模式
DBCC SHRINKFILE (N'TOPPower_NET_Log' , 1, TRUNCATEONLY)
ALTER DATABASE TOPPower_NET SET RECOVERY FULL WITH NO_WAIT
ALTER DATABASE TOPPower_NET SET RECOVERY FULL --还原为完全模式