近期二开遇到因账套占用空间太大,导致本地恢复时内存空间不够,以下一顿操作之后确实腾出些空间,仅供参考:
一、清除日志文件(.ldf文件)
可参考此链接:https://vip.kingdee.com/article/539760166212810240?productLineId=1&lang=zh-CN
二、清理占用内存较大临时表
1.查询占用内存较大表名
select * from (
SELECT
t.NAME AS 'Table',
s.Name AS 'Schema',
CAST(ROUND((SUM(a.total_pages) * 8) / 1024.0, 2) AS NUMERIC(10, 2)) AS 'SizeInMB'
FROM sys.tables t
INNER JOIN sys.indexes i ON i.object_id = t.object_id
INNER JOIN sys.partitions p ON p.object_id = t.object_id AND p.index_id = i.index_id
INNER JOIN sys.allocation_units a ON a.container_id = p.partition_id
LEFT OUTER JOIN sys.schemas s ON t.schema_id = s.schema_id
WHERE t.NAME NOT LIKE 'dt%'
GROUP BY t.Name, s.Name
--ORDER BY SUM(a.total_pages) DESC
)ta
where SizeInMB >0 and ([table] like '%tep%' or [table] like '%temp%' or [table] like '%bak%' or [table] like '%bk%')
order by SizeInMB desc
2.清理临时表释放内存空间
根据上一步查询出占用内存较大的临时表名,依次清除
--参考样例:清理上机操作记录(本地开发账套适用)
--truncate table T_BAS_OPERATELOGBK_S
--truncate table T_BAS_OPERATELOGBK
--truncate table T_BAS_OPERATELOG_S
--truncate table T_BAS_OPERATELOG
推荐阅读