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;
相关推荐
代码or搬砖15 小时前
RBAC(权限认证)小例子
java·数据库·spring boot
神仙别闹15 小时前
基于QT(C++)实现学本科教务系统(URP系统)
数据库·c++·qt
2301_7683502315 小时前
MySQL为什么选择InnoDB作为存储引擎
java·数据库·mysql
上海蓝色星球15 小时前
迈向智慧电网新纪元:上海蓝色星球数字孪生变电主子站系统
运维·数据库
是大芒果15 小时前
数据库表设计
数据库
哥哥还在IT中15 小时前
MySQL order by 如何优化
数据库·mysql
积跬步,慕至千里16 小时前
postgre数据库大批量快速导出方法总结
数据库·postgres
帅大大的架构之路16 小时前
mysql批量插入数据如何更快
数据库·mysql
Amber_3717 小时前
mysql 死锁场景 INSERT ... ON DUPLICATE KEY UPDATE
数据库·mysql
VX:Fegn089518 小时前
计算机毕业设计|基于springboot + vue敬老院管理系统(源码+数据库+文档)
数据库·vue.js·spring boot·后端·课程设计