基本环境
报错现像
今天处理别的问题查看告警日志偶然发现大量的报错,无法扩展SYSAUX表空间
于是登录系统,查看系统表空间使用情况,发现SYSAUX表空间用满了
查看SYSAUX表空间情况
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;
返回如下:
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;
返回如下:
释放表空间AUD$UNIFIED
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 .TRUE
USE_LAST_ARCH_TIMESTAMP
TRUE
-
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.
-
清理之后会留下清理记录,可通过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%';