This is a mobile optimized page that loads fast, if you want to load the real page, click this text.

Nhờ tư vấn Nguyên nhân và cách khắc phục file MSDBData.mdf dung lượng lớn bất thường

sugarkim


Junior Moderator
Thành viên BQT

sugarkim


Junior Moderator
Thành viên BQT
Mình search thấy câu hỏi này
use msdb
--select count(start_time) from sysmaintplan_logdetail with (nolock) where start_time < '2021-01-01'
--sp_maintplan_delete_log @oldest_time='2021-01-01'
--select * from sysmaintplan_logdetail where start_time < '2019-02-01'
--delete sysmaintplan_logdetail where start_time < '2019-02-01'
SELECT
OBJECT_NAME(i.OBJECT_ID) AS TableName,
i.name AS IndexName,
i.index_id AS IndexID,
8 * SUM(a.used_pages) AS 'Indexsize(KB)'
FROM
sys.indexes AS i
JOIN sys.partitions AS p ON p.OBJECT_ID = i.OBJECT_ID AND p.index_id = i.index_id
JOIN sys.allocation_units AS a ON a.container_id = p.partition_id
WHERE
i.is_primary_key = 0 -- fix for size discrepancy
GROUP BY
i.OBJECT_ID,
i.index_id,
i.name
ORDER BY
(8 * SUM(a.used_pages)) desc
select * from sysmaintplan_logdetail where start_time < '2019-09-01'
Nên kiên nhẫn và xoá từ từ từng tháng.