--先查询DBName_Log在sys.database_files里的名称,此处暂用XXX代替
USE DBName
GO
SELECT file_id, name FROM sys.database_files;
GO
--真正的收缩语句。Sql Server 2008要先将模式改为简单模式,收缩后再改回完全模式。
SE [master]
GO
ALTER DATABASE DBName SET RECOVERY SIMPLE WITH NO_WAIT
GO
ALTER DATABASE DBName SET RECOVERY SIMPLE
GO
USE DBName
GO
DBCC SHRINKFILE (N‘XXX‘ , 11, TRUNCATEONLY)
GO
USE [master]
GO
ALTER DATABASE DBName SET RECOVERY FULL WITH NO_WAIT
GO
ALTER DATABASE DBName SET RECOVERY FULL
GO
时间: 2024-10-26 13:43:48