Oracle 12.2 暴力处理sysaux空间占满问题

基本环境

数据库:oracle 12.2 RAC

操作系统:unix&solaris 11.3

报错现像

今天处理别的问题查看告警日志偶然发现大量的报错,无法扩展SYSAUX表空间

image.png

于是登录系统,查看系统表空间使用情况,发现SYSAUX表空间用满了

Oracle 12.2 暴力处理sysaux空间占满问题_第1张图片

查看SYSAUX表空间情况

使用SQL检查一下占用,

SELECT occupant_name"Item",round(space_usage_kbytes/1024/1024,3)"Space Used (GB)",schema_name "Schema",move_procedure "MoveProcedure"
FROM v$sysaux_occupants
ORDER BY 2 Desc;

返回如下:

Oracle 12.2 暴力处理sysaux空间占满问题_第2张图片

再检查segment_names查看

select * from (
select segment_name,sum(bytes)/1024/1024 total_mb,tablespace_name from dba_segments where tablespace_name in
('SYSTEM','SYSAUX') group by segment_name,tablespace_name order by 2 desc)
where rownum <=20;

返回如下:

Oracle 12.2 暴力处理sysaux空间占满问题_第3张图片

释放表空间AUD$UNIFIED

需要用到Dbms包来处理

BEGIN
DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL(
audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED,
container => DBMS_AUDIT_MGMT.CONTAINER_CURRENT,
use_last_arch_timestamp => FALSE);
END;
/

use_last_arch_timestamp这个地方有两个选项:

  • USE_LAST_ARCH_TIMESTAMP: Enter either of the following settings:

    • TRUE: Deletes audit records created before the last archive timestamp. To set the archive timestamp, see Step 3: Optionally, Set an Archive Timestamp for Audit Records. The default (and recommended) value is . Oracle recommends that you set to . TRUEUSE_LAST_ARCH_TIMESTAMPTRUE

    • FALSE: Deletes all audit records without considering last archive timestamp. Be careful about using this setting, in case you inadvertently delete audit records that should not have been deleted.

处理完再次查看

Oracle 12.2 暴力处理sysaux空间占满问题_第4张图片

清理之后会留下清理记录,可通过SQL查看

select * from UNIFIED_AUDIT_TRAIL where OBJECT_NAME='DBMS_AUDIT_MGMT' and OBJECT_SCHEMA='SYS' AND SQL_TEXT LIKE '%DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL%';

参考

管理审计跟踪 (oracle.com)

你可能感兴趣的:(数据库记录,oracle,linux,数据库,运维)