标签归档:数据库日志

MsSQL 收缩数据库日志

SQL2005

USE [master]
DUMP TRANSACTION [DB_Samples] WITH NO_LOG
BACKUP LOG [DB_Samples] WITH NO_LOG
DBCC SHRINKDATABASE([DB_Samples])

SQL2008

USE [master]
GO
ALTER DATABASE [DB_Samples] SET RECOVERY SIMPLE WITH NO_WAIT
GO
ALTER DATABASE [DB_Samples] SET RECOVERY SIMPLE
GO

USE [DB_Samples]
GO
DBCC SHRINKFILE (N 'DB_Samples_log' , 0, TRUNCATEONLY)
GO

USE [master]
GO
ALTER DATABASE [DB_Samples] SET RECOVERY FULL WITH NO_WAIT
GO
ALTER DATABASE [DB_Samples] SET RECOVERY FULL
GO