--先设置数据库为单机模式(数据库名字右键属性---选项---恢复模式选择简单--确定)
DBCC SHRINKDATABASE (test, 10); --收缩数据库---test为数据库名字
-----------------收缩日志-------------------
USE test;
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE test
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (ChaoRan_Log, 1);
GO
-- Reset the database recovery model.
ALTER DATABASE test
SET RECOVERY FULL;
GO