为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。 【DM版本】:DM8 【操作系统】:国产系统 【CPU】: 【问题描述】*:由于业务数据量逐渐增大,写入账号所属的表空间达到了1T多,并且该账号数据写入变得极慢(一分钟写入几十条或者几百条)。如果将表空间收缩了是否会提高写入速度,收缩表空间又有什么影响
1,先查询表空间的使用率。 SELECT a.tablespace_name "表空间名称" , total / (1024 * 1024) "表空间大小(M)" , free / (1024 * 1024) "表空间剩余大小(M)" , (total - free) / (1024 * 1024 ) "表空间使用大小(M)" , total / (1024 * 1024 * 1024) "表空间大小(G)" , free / (1024 * 1024 * 1024) "表空间剩余大小(G)" , (total - free) / (1024 * 1024 * 1024) "表空间使用大小(G)", round((total - free) / total, 4) * 100 "使用率 %" FROM ( SELECT tablespace_name, SUM(bytes) free FROM dba_free_space GROUP BY tablespace_name ) a, ( SELECT tablespace_name, SUM(bytes) total FROM dba_data_files GROUP BY tablespace_name ) b WHERE a.tablespace_name = b.tablespace_name; 2,早期的数据库版本,可能是没有缩容表空间的功能,所以必须要确定版本。 3,业务表空间是否有创建多个表空间文件? 4,写入慢的话建议排查磁盘和当前服务器的内存等资源使用情况 5,可以开启慢SQL日志,优化SQL。 https://eco.dameng.com/community/article/9a83bac6d3ea79351e722581f3cc99c8
1,先查询表空间的使用率。
SELECT a.tablespace_name "表空间名称" ,
total / (1024 * 1024) "表空间大小(M)" ,
free / (1024 * 1024) "表空间剩余大小(M)" ,
(total - free) / (1024 * 1024 ) "表空间使用大小(M)" ,
total / (1024 * 1024 * 1024) "表空间大小(G)" ,
free / (1024 * 1024 * 1024) "表空间剩余大小(G)" ,
(total - free) / (1024 * 1024 * 1024) "表空间使用大小(G)",
round((total - free) / total, 4) * 100 "使用率 %"
FROM ( SELECT tablespace_name,
SUM(bytes) free
FROM dba_free_space
GROUP BY tablespace_name ) a, ( SELECT tablespace_name,
SUM(bytes) total
FROM dba_data_files
GROUP BY tablespace_name ) b
WHERE a.tablespace_name = b.tablespace_name;
2,早期的数据库版本,可能是没有缩容表空间的功能,所以必须要确定版本。
3,业务表空间是否有创建多个表空间文件?
4,写入慢的话建议排查磁盘和当前服务器的内存等资源使用情况
5,可以开启慢SQL日志,优化SQL。
https://eco.dameng.com/community/article/9a83bac6d3ea79351e722581f3cc99c8