SqlServer 收缩数据库文件和日志文件

--收缩数据库日志文件 logALTER DATABASE weilaixueyuan_test SET RECOVERY SIMPLE --将“恢复模式”设置为“简单”
GO
USE weilaixueyuan_test
GO
DBCC SHRINKFILE (N'weilaixueyuan_test_log' , 1, TRUNCATEONLY)--收缩日志文件大小到1M
GO
USE weilaixueyuan_test
GO
ALTER DATABASE weilaixueyuan_test SET RECOVERY FULL WITH NO_WAIT ----将“恢复模式”设置为“完整”
GO
ALTER DATABASE weilaixueyuan_test SET RECOVERY FULL
GO

 

--收缩数据库文件MDF

ALTER DATABASE [weilaixueyuan_test] SET RECOVERY SIMPLE --将“恢复模式”设置为“简单”DBCC SHRINKDATABASE([weilaixueyuan_test], 0) --收缩数据库ALTER DATABASE [weilaixueyuan_test] SET RECOVERY FULL ----将“恢复模式”设置为“完整”

posted @ 2021-07-28 15:24  King、Wang  阅读(526)  评论(0编辑  收藏  举报