共计 1413 个字符,预计需要花费 4 分钟才能阅读完成。
问题现象:SYSTEM 表空间使用率超 99%,前期设计时 SYSTEM 表空间是 10G 固定大小不允许自动扩展。
1. 查询 SYSTEM 表空间的使用率
set linesize 200
col TABLESPACE_NAME for a25
col SUM_SPACE(M) for a20
col USED_SPACE(M) for a20
col USED_RATE(%) for a20
col FREE_SPACE(M) for a20
SELECT D.TABLESPACE_NAME,
SPACE || ‘M’ “SUM_SPACE(M)”,
BLOCKS “SUM_BLOCKS”,
SPACE – NVL (FREE_SPACE, 0) || ‘M’ “USED_SPACE(M)”,
ROUND ((1 – NVL (FREE_SPACE, 0) / SPACE) * 100, 2) || ‘%’
“USED_RATE(%)”,
FREE_SPACE || ‘M’ “FREE_SPACE(M)”
FROM (SELECT TABLESPACE_NAME,
ROUND (SUM (BYTES) / (1024 * 1024), 2) SPACE,
SUM (BLOCKS) BLOCKS
FROM DBA_DATA_FILES
GROUP BY TABLESPACE_NAME) D,
(SELECT TABLESPACE_NAME,
ROUND (SUM (BYTES) / (1024 * 1024), 2) FREE_SPACE
FROM DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME) F
WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME(+)
AND D.TABLESPACE_NAME = ‘SYSTEM’;
2. 查询 SYSTEM 表空间中各个段占用空间情况
SELECT OWNER, SEGMENT_NAME, SEGMENT_TYPE, SUM(BYTES)/1024/1024
FROM DBA_SEGMENTS
WHERE TABLESPACE_NAME = ‘SYSTEM’
GROUP BY OWNER, SEGMENT_NAME, SEGMENT_TYPE
ORDER BY 4;
3. 截断占用空间最大的 AUD$ 表 (需要和 DBA 确认后操作)
truncate table AUD$;
4. 查询 AUD$ 表的表空间
SELECT OWNER, TABLE_NAME, TABLESPACE_NAME
FROM DBA_TABLES
WHERE TABLE_NAME = ‘AUD$’
AND OWNER = ‘SYS’;
5. 更改 AUD$ 表的表空间为其他表空间 (选做)
BEGIN
DBMS_AUDIT_MGMT.SET_AUDIT_TRAIL_LOCATION(
AUDIT_TRAIL_TYPE => DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD,
AUDIT_TRAIL_LOCATION_VALUE => ‘&AUD_TBS_NAME’);
END;
/
更多 Oracle 相关信息见 Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12
本文永久更新链接地址 :http://www.linuxidc.com/Linux/2018-01/150538.htm