Skip to main content

๐Ÿ‘ฉโ€๐Ÿ’ป ๆŸฅ่ฉขๅ ็”จ็กฌ็ขŸ

-- ๆชข่ฆ–็›ฎๅ‰่ณ‡ๆ–™ๅบซๆ‰€็”จ็š„็ฉบ้–“๏ผŒไฝ†ไธไธ€ๅฎš่ƒฝๅๆ˜ ๅฏฆ้š›ๅฏ็”จ็š„็ฃ็ขŸ็ฉบ้–“ใ€‚ 
EXEC sp_spaceused
GO
-- ่ฆๆฑ‚ๆŽƒๆ่ณ‡ๆ–™ๅบซไธญ็š„ๅ…จ้ƒจ็š„่ณ‡ๆ–™้ ๅพŒ๏ผŒๅ†ๆชข่ฆ–็›ฎๅ‰่ณ‡ๆ–™ๅบซๆ‰€็”จ็š„็ฉบ้–“
EXEC sp_spaceused @updateusage = N'TRUE';
GO
SET NOCOUNT ON 
DECLARE @tDBSize TABLE
(DBName SYSNAME DEFAULT(DB_NAME()),
Fileid INT, FileGroup INT, TotalExtents INT,
UsedExtents INT, Name SYSNAME, FileName NVARCHAR(4000))
INSERT @tDBSize(Fileid,FileGroup,TotalExtents,UsedExtents,Name,FileName)
EXEC ('DBCC showfilestats')
SELECT DBName N'่ณ‡ๆ–™ๅบซ',Name N'่ณ‡ๆ–™ๆช”ๆกˆ',
TotalExtents*64.0/1024 N'่ณ‡ๆ–™ๆช”ๆกˆไฝฟ็”จ็กฌ็ขŸ็ฉบ้–“(MB)',
UsedExtents*64.0/1024 N'่ณ‡ๆ–™ๅฏฆ้š›ไฝฟ็”จ็ฉบ้–“(MB)', FileName N'ๅฏฆ้ซ”ๆช”ๆกˆ่ทฏๅพ‘'
FROM @tDBSize
GO