查询状态语句:

SELECT name,log_reuse_wait_desc FROM sys.databases where name='hrsystem';

SQL Server2008收缩日志文件-LMLPHP

收缩日志文件:

USE [master]
GO
ALTER DATABASE hrsystem SET RECOVERY SIMPLE WITH NO_WAIT
GO
ALTER DATABASE hrsystem SET RECOVERY SIMPLE
GO
USE hrsystem 
DBCC SHRINKFILE (N'NewStock_Log' , 0,TRUNCATEONLY)
GO
USE [master]
GO
ALTER DATABASE hrsystem SET RECOVERY FULL WITH NO_WAIT
GO
ALTER DATABASE hrsystem SET RECOVERY FULL
GO

注:DBCC为日志文件逻辑名称

SQL Server2008收缩日志文件-LMLPHP

状态变更:

EXEC sp_removedbreplication hrsystem

05-28 14:49