标签:sql server
--先查询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
本文出自 “StaticLight” 博客,请务必保留此出处http://simonshow.blog.51cto.com/2966511/1760894
标签:sql server
原文地址:http://simonshow.blog.51cto.com/2966511/1760894