Useful SQL command to reduce the size of the database

2018-02-06 · 1 min read

今日想和大家分享一個 幾有用的TSQL Command, 去 Release 返一些SQL Server 佔用的空間
Transaction logDatabase file

-- select database
USE Production;

-- Change the recovery mode to SIMPLE, to clear the transaction log
ALTER DATABASE Production SET RECOVERY SIMPLE ;

-- shrink database to release space
DBCC SHRINKDATABASE (Production, 1);

Hope you find it useful