SYSAUX表空间如何清理

############################################################
操作方案
############################################################
TABLESPACE_NAME SUM_SPACE(M) USED_SPACE(M) USED_RATE(%) FREE_SPACE(M) REA_USED_RATE(%) REA_FREE_SPACE(M)
-------------------- ------------ ------------- ------------ ------------- ---------------- -----------------
SYSAUX 8192 8153 99.53 39
UNDOTBS2 32768 32576 99.41 192
UNDOTBS1 32768 32524 99.26 244
T_BPM 116736 112216 96.13 4520
T_IEFUSER 57344 53036 92.49 4308
TS_RPT_TMP 2048 1822 88.97 226
TS_RPT_BASE 200704 165287 82.35 35417
T_WMSUSERN 565248 457070 80.86 108178
IS_RPT_BASE 32768 25790 78.71 6978
TS_PMS_OUTSTD 256 174 67.97 82
T_PRECISE 5120 3394 66.29 1726
TS_IEF_BASE 16384 10856 66.26 5528
IS_IEF_TDD 4096 2642 64.5 1454
TS_WMS_DATA 20480 13195 64.43 7285
T_SSOUSER 14336 8746 61.01 5590
IS_PMS_BASE 1024 598 58.4 426
TS_SSO_LOGDATA 5120 2946 57.54 2174
TS_IEF_CBT 16384 9286 56.68 7098
TS_PMS_BASE 4096 2162 52.78 1934
TS_IEF_HISTORY 8192 4122 50.32 4070
IS_IEF_BASE 1024 430 41.99 594
IS_PMS_HISTORY 2048 824 40.23 1224
IS_SSO_LOGDATA 4096 1618 39.5 2478
IS_SSO_BASE 2048 746 36.43 1302
IS_CMS_HISTORY 256 86 33.59 170
TS_SSO_BASE 1024 302 29.49 722
IS_IEF_CBT 24576 7222 29.39 17354
T_CMSUSER 2048 304 14.84 1744
SYSTEM 8192 729 8.9 7463
TS_CMS_HISTORY 1024 82 8.01 942
IS_PMS_OUTSTD 256 2 .78 254
USERS 1024 6 .62 1018
T_JDTEST 1024 2 .2 1022
T_SJJH 2048 2 .1 2046

1. 创建临时表,保存近8天的数据
create table bak_ash_tab tablespace T_WMSUSERN as select * from WRH$_ACTIVE_SESSION_HISTORY where SAMPLE_TIME>=sysdate-9;

2. 禁用AWR
exec dbms_workload_repository.modify_snapshot_settings(interval => 0);

3. truncate WRH$_ACTIVE_SESSION_HISTORY
TRUNCATE TABLE WRH$_ACTIVE_SESSION_HISTORY;

4. truncate 完成后,重建 WRH$_ACTIVE_SESSION_HISTORY表的索引,并从备份表恢复数据
insert into WRH$_ACTIVE_SESSION_HISTORY select * from bak_ash_tab;
commit;

5. 查看索引状态
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');

6. 启动AWR
exec dbms_workload_repository.modify_snapshot_settings(interval => 30);

7. 测试awr和ash可能正常生成
---手动生成snapshot
exec dbms_workload_repository.create_snapshot;
@?/rdbms/admin/awrrpt
@?/rdbms/admin/ashrpt

8. 删除备份表
drop table bak_ash_tab purge;

22:17:15 SQL> !ora tsfree

TABLESPACE_NAME SUM_SPACE(M) USED_SPACE(M) USED_RATE(%) FREE_SPACE(M) REA_USED_RATE(%) REA_FREE_SPACE(M)
-------------------- ------------ ------------- ------------ ------------- ---------------- -----------------
UNDOTBS1 32768 32763 99.98 5
UNDOTBS2 32768 32576 99.41 192
T_BPM 116736 112216 96.13 4520
T_IEFUSER 57344 53036 92.49 4308
TS_RPT_TMP 2048 1822 88.97 226
TS_RPT_BASE 200704 165287 82.35 35417
T_WMSUSERN 565248 457070 80.86 108178
IS_RPT_BASE 32768 25790 78.71 6978
TS_PMS_OUTSTD 256 174 67.97 82
T_PRECISE 5120 3394 66.29 1726
TS_IEF_BASE 16384 10856 66.26 5528
SYSAUX 8192 5288 64.55 2904
IS_IEF_TDD 4096 2642 64.5 1454
TS_WMS_DATA 20480 13195 64.43 7285
T_SSOUSER 14336 8746 61.01 5590
IS_PMS_BASE 1024 598 58.4 426
TS_SSO_LOGDATA 5120 2946 57.54 2174
TS_IEF_CBT 16384 9286 56.68 7098
TS_PMS_BASE 4096 2162 52.78 1934
TS_IEF_HISTORY 8192 4122 50.32 4070
IS_IEF_BASE 1024 430 41.99 594
IS_PMS_HISTORY 2048 824 40.23 1224
IS_SSO_LOGDATA 4096 1618 39.5 2478
IS_SSO_BASE 2048 746 36.43 1302
IS_CMS_HISTORY 256 86 33.59 170
TS_SSO_BASE 1024 302 29.49 722
IS_IEF_CBT 24576 7222 29.39 17354
T_CMSUSER 2048 304 14.84 1744
SYSTEM 8192 729 8.9 7463
TS_CMS_HISTORY 1024 82 8.01 942
IS_PMS_OUTSTD 256 2 .78 254
USERS 1024 6 .62 1018
T_JDTEST 1024 2 .2 1022
T_SJJH 2048 2 .1 2046

上一篇:Oracle10g以上sysaux表空间的维护和清理


下一篇:Mybatis实现数据的增删改查(CRUD)