-- 查詢資料庫使用空間
sp_spaceused
-- 查詢 Data file 各個使用狀況
SELECT name ,size/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS int)/128.0 AS AvailableSpaceInMB
FROM sys.database_files;
-- SQL SERVER 2008 後採用的命令
-- Set to SIMPLE mode
ALTER DATABASE [DATA_BASE_NAME] SET RECOVERY SIMPLE;
-- Shrink the db to 10 MB
DBCC SHRINKFILE ('DATA_FILE', 10);
-- Set back to FULL (optional depending on backup method used)
ALTER DATABASE [DATA_BASE_NAME] SET RECOVERY FULL;
沒有留言:
張貼留言