oracle sysaux扩大,Oracle表空间SYSAUX使用率很高解决方法

本文档详细介绍了当Oracle表空间SYSAUX使用率达到95%以上的告警处理过程。首先,通过SQL查询确认表空间使用情况,然后定位大对象并清理,最后再次检查表空间使用率,确保问题得到解决。涉及的关键操作包括查询对象占用情况、清理快照数据及检查清理效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

详情:

本实例主要针对Oracle表空间饱满问题处理方法做个步骤分享。

一、告警信息

收到zabbix告警信息,表空间 SYSAUX 使用率>95%%,系统表空间sysaux使用率超过了95%。

c85eadc13f88ab7fcd8a4ab7302a9cf1.png

二、处理步骤

1.登录具体数据库做相应的数据库空间使用率查询

set line 200;

set pagesize 20000;

set feedback off;

col tablespace_name for a20;

col c_free_percent for a12;

col c_used_percent for a12;

col m_free_percent for a12;

col m_USED_PERCENT for a12;

select

d.tablespace_name,round(d.MB_current_Bytes,2)

Curr_Size_MB,round(f.free_mb_bytes,2)

Free_Szie_MB,round(d.MB_maxbytes,2)

MAX_Size_MB,round((f.free_mb_bytes/d.MB_current_Bytes)*100,2)

c_free_percent,round((d.MB_current_Bytes-f.free_mb_bytes)/d.MB_current_Bytes,4)*100

|| '%'

c_used_percent,round(((d.MB_maxbytes-d.MB_current_Bytes+f.free_mb_bytes)/d.MB_maxbytes)*100,2)

m_free_percent,round((d.MB_current_Bytes-f.free_mb_bytes)/d.MB_maxbytes,4)*100

|| '%' m_used_percent

from  (select

tablespace_name,sum(bytes/1024/1024)

MB_current_Bytes,sum(maxbytes/1024/1024) MB_maxbytes from dba_data_files

group by tablespace_name ) d,(select

tablespace_name,sum(bytes/1024/1024) free_mb_bytes from dba_free_space

group by tablespace_name) f

where d.tablespace_name=f.tablespace_name

order by c_free_percent ;

ad02381f08e01d3218e94e5e066a26df.png

2.查询表空间对应的对象占用情况

select

OWNER,segment_name,segment_type,PARTITION_NAME,bytes/1024/1024/1024

Size_GB from dba_segments  where tablespace_name='SYSAUX' order by

Size_GB desc

9bd721aa050f8ec72fbad6ed97b45b47.png

3.根据具体大对象做排查,对可以清理的相关数据清理

根据上述SQL查到的大对象主要是

1    SYS    WRH$_LATCH_CHILDREN        WRH$_LATCH__1153813778_29290    TABLE PARTITION    29.927734375

2    SYS    WRH$_LATCH_CHILDREN_PK    WRH$_LATCH__1153813778_29290    INDEX PARTITION    14.984375

3    SYS    WRH$_ACTIVE_SESSION_HISTORY WRH$_ACTIVE_1153813778_29290    TABLE PARTITION    3.6474609375

4    SYS    WRH$_SQLSTAT            WRH$_SQLSTA_1153813778_29290    TABLE PARTITION    1.2529296875

WRH$_LATCH_CHILDREN 表示快照使用的,其中分区1153813778是DBID, 29290是快照ID

查看29290的快照ID是什么时间的

select snap_id, begin_interval_time from sys.dba_hist_snapshot order by snap_id;

select snap_id, begin_interval_time from sys.dba_hist_snapshot where snap_id=29290

2f4ae66aaccd86a1d8d7c837a8dde74c.png

4.清空分区WRH$_LATCH__1153813778_29290

select * from WRH$_LATCH_CHILDREN partition ( WRH$_LATCH__1153813778_29290);

alter table WRH$_LATCH_CHILDREN truncate partition WRH$_LATCH__1153813778_29290;

5.清理后表空间查看

select d.tablespace_name,round(d.MB_current_Bytes,2)

Curr_Size_MB,round(f.free_mb_bytes,2)

Free_Szie_MB,round(d.MB_maxbytes,2)

MAX_Size_MB,round((f.free_mb_bytes/d.MB_current_Bytes)*100,2)

c_free_percent,round((d.MB_current_Bytes-f.free_mb_bytes)/d.MB_current_Bytes,4)*100

|| '%'

c_used_percent,round(((d.MB_maxbytes-d.MB_current_Bytes+f.free_mb_bytes)/d.MB_maxbytes)*100,2)

m_free_percent,round((d.MB_current_Bytes-f.free_mb_bytes)/d.MB_maxbytes,4)*100

|| '%' m_used_percent

from  (select

tablespace_name,sum(bytes/1024/1024)

MB_current_Bytes,sum(maxbytes/1024/1024) MB_maxbytes from dba_data_files

group by tablespace_name ) d,(select

tablespace_name,sum(bytes/1024/1024) free_mb_bytes from dba_free_space

group by tablespace_name) f

where d.tablespace_name=f.tablespace_name  and f.tablespace_name='SYSAUX'order by c_free_percent ;

aa45f62dda4aa4971f909f0a7e5756c1.png

三、脚本附录

1.表空间segment大小查询

select

OWNER,segment_name,PARTITION_NAME,segment_type,bytes/1024/1024/1024

Size_GB from dba_segments  where tablespace_name='SYSAUX' order by

Size_GB desc

2.表空间使用率查询

set line 200;

set pagesize 20000;

set feedback off;

col tablespace_name for a20;

col c_free_percent for a12;

col c_used_percent for a12;

col m_free_percent for a12;

col m_USED_PERCENT for a12;

select

d.tablespace_name,round(d.MB_current_Bytes,2)

Curr_Size_MB,round(f.free_mb_bytes,2)

Free_Szie_MB,round(d.MB_maxbytes,2)

MAX_Size_MB,round((f.free_mb_bytes/d.MB_current_Bytes)*100,2)

c_free_percent,round((d.MB_current_Bytes-f.free_mb_bytes)/d.MB_current_Bytes,4)*100

|| '%'

c_used_percent,round(((d.MB_maxbytes-d.MB_current_Bytes+f.free_mb_bytes)/d.MB_maxbytes)*100,2)

m_free_percent,round((d.MB_current_Bytes-f.free_mb_bytes)/d.MB_maxbytes,4)*100

|| '%' m_used_percentfrom  (select tablespace_name,sum(bytes/1024/1024)

MB_current_Bytes,sum(maxbytes/1024/1024) MB_maxbytes from

dba_data_files group by tablespace_name ) d,(select

tablespace_name,sum(bytes/1024/1024) free_mb_bytes from dba_free_space

group by tablespace_name) fwhere d.tablespace_name=f.tablespace_name

order by c_free_percent ;

3.查看快照ID、查看快照设置信息、设置快照信息

select snap_id, begin_interval_time from sys.dba_hist_snapshot order by snap_id;select * from DBA_HIST_WR_CONTROL;begin

DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS(retention =>43200,interval =>30, topnsql =>'MAXIMUM');

end;

/

cbcac6fc6ea463036073528fd723b720.png

4.统计信息清理

exec dbms_stats.purge_stats(systimestamp -11);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值