oracle的SYSAUX表空间满了怎么处理

清理SYSAUX表空间:

  1. 创建临时表,保存近8天的数据
sql 复制代码
create table test.ash_bak_20220119 as select * from sys.WRH$_ACTIVE_SESSION_HISTORY where SAMPLE_TIME>=sysdate-9;
SQL> select count(*)  from test.ash_bak_20220119;
  COUNT(*)
----------
     12648

1 row selected.
  1. 禁用AWR
sql 复制代码
exec dbms_workload_repository.modify_snapshot_settings(interval => 0);
  1. truncate WRH$_ACTIVE_SESSION_HISTORY
sql 复制代码
TRUNCATE TABLE sys.WRH$_ACTIVE_SESSION_HISTORY;
  1. truncate 完成后,重建 WRH$_ACTIVE_SESSION_HISTORY表的索引,并从备份表恢复数据
sql 复制代码
insert into sys.WRH$_ACTIVE_SESSION_HISTORY select * from test.ash_bak_20220119;
commit;
  1. 查看索引状态(USABLE是未失效,UNUSABLE是失效)
sql 复制代码
set line 300 pages 200
col owner for a20
col index_name for a30
select index_owner,
index_name,
partition_name,
status,
tablespace_name,
last_analyzed
from dba_ind_partitions
where index_name in (select index_name
from dba_indexes
where table_name in ('WRH$_ACTIVE_SESSION_HISTORY')
and table_owner = 'SYS');

INDEX_OWNER		       INDEX_NAME		      PARTITION_NAME		     STATUS   TABLESPACE_NAME		     LAST_ANAL
------------------------------ ------------------------------ ------------------------------ -------- ------------------------------ ---------
SYS			       WRH$_ACTIVE_SESSION_HISTORY_PK WRH$_ACTIVE_3552434506_0	     USABLE   SYSAUX			     04-DEC-21
SYS			       WRH$_ACTIVE_SESSION_HISTORY_PK WRH$_ACTIVE_SES_MXDB_MXSN      USABLE   SYSAUX			     07-FEB-20
  1. 如果索引失效重建索引(测试的时候是没有失效的,索引为本地索引)
sql 复制代码
ALTER INDEX SYS.WRH$_ACTIVE_SESSION_HISTORY_PK REBUILD PARTITION WRH$_ACTIVE_3552434506_0 tablespace SYSAUX;
ALTER INDEX SYS.WRH$_ACTIVE_SESSION_HISTORY_PK REBUILD PARTITION WRH$_ACTIVE_SES_MXDB_MXSN tablespace SYSAUX;
  1. 启动AWR
sql 复制代码
exec dbms_workload_repository.modify_snapshot_settings(interval => 60);
  1. 测试awr和ash可能正常生成
    ---手动生成snapshot
sql 复制代码
exec dbms_workload_repository.create_snapshot;
@?/rdbms/admin/awrrpt
@?/rdbms/admin/ashrpt
  1. 删除备份表
sql 复制代码
drop table test.ash_bak_20220119 purge;
相关推荐
这个DBA有点耶12 小时前
MVCC深入:Read View、版本链与快照读——InnoDB并发控制的内核
数据库·mysql·架构
DBA_G12 小时前
从地面到云霄:GBase数据库在民航三大场景的落地实践
数据库
自由能燃气设备13 小时前
商用全预混低氮冷凝锅炉免费方案vs付费方案对比+选型避坑指南
大数据·数据库·人工智能
科创致远13 小时前
科创致远 ESOP 系统核心效能与实战价值展示
大数据·数据库·人工智能·精益工程
漂着的圆木14 小时前
Agent 功能参与度:Copilot 怎么算
sql·数据分析·agent·githubcopilot·度量
geovindu14 小时前
sql: Transaction & Concurrency Patterns using postgresql 18
postgresql·数据库开发·数据库架构
2601_9622186114 小时前
万象生鲜系统称重自动多退少补算法解决生鲜非标品痛点
大数据·数据库·人工智能·python·算法
张洛闻Eren15 小时前
k8s云原生【第十课】:水平 Pod 自动扩缩容
运维·数据库·云原生·kubernetes·github
于平安15 小时前
MySQL-触发器
数据库·mysql
白远山15 小时前
上海24小时自助健身房解决方案实战指南与经验分享
java·数据库·架构·需求分析