sys@> select occupant_name,occupant_desc,space_usage_kbytes from v$sysaux_occupants;
OCCUPANT_NAME OCCUPANT_DESC SPACE_USAGE_KBYTES ---------------------------------------------------------------- ---------------------------------------------------------------- ------------------ LOGMNR LogMiner 13696 LOGSTDBY Logical Standby 1408 SMON_SCN_TIME Transaction Layer - SCN to TIME mapping 3328 PL/SCOPE PL/SQL Identifier Collection 1600 STREAMS Oracle Streams 1024 AUDIT_TABLES DB audit tables 320 XDB XDB 129984 AO Analytical Workspace Object Table 39104 XSOQHIST OLAP API History Tables 39104 XSAMD OLAP Catalog 5248 SM/AWR Server Manageability - Automatic Workload Repository 30022848 SM/ADVISOR Server Manageability - Advisor Framework 189312 SM/OPTSTAT Server Manageability - Optimizer Statistics History 1424768 SM/OTHER Server Manageability - Other Components 12416 STATSPACK Statspack Repository 0 SDO Oracle Spatial 76032 WM Workspace Manager 3584 ORDIM Oracle Multimedia ORDSYS Components 448 ORDIM/ORDDATA Oracle Multimedia ORDDATA Components 13888 ORDIM/ORDPLUGINS Oracle Multimedia ORDPLUGINS Components 0 ORDIM/SI_INFORMTN_SCHEMA Oracle Multimedia SI_INFORMTN_SCHEMA Components 0 EM Enterprise Manager Repository 47168 TEXT Oracle Text 3712 ULTRASEARCH Oracle Ultra Search 0 ULTRASEARCH_DEMO_USER Oracle Ultra Search Demo User 0 EXPRESSION_FILTER Expression Filter System 3712 EM_MONITORING_USER Enterprise Manager Monitoring User 1408 TSM Oracle Transparent Session Migration User 0 SQL_MANAGEMENT_BASE SQL Management Base Schema 1728 AUTO_TASK Automated Maintenance Tasks 384 JOB_SCHEDULER Unified Job Scheduler 14528
很明显的看到绝大部分是AWR占用了
通过语句可以查看是哪些表占用的表空间最大
1 2 3 4
col segment_name for a50 col partition_name for a30 col segment_type for a30 select * from (select segment_name,PARTITION_NAME,segment_type,bytes/1024/1024 from dba_segments where tablespace_name='SYSAUX' order by 4 desc) where rownum>=10;
sys@TFDW1> SELECT snap_id, begin_interval_time, end_interval_time FROM SYS.WRM$_SNAPSHOT WHERE snap_id = ( SELECT MIN (snap_id) FROM SYS.WRM$_SNAPSHOT) UNION SELECT snap_id, begin_interval_time, end_interval_time FROM SYS.WRM$_SNAPSHOT WHERE snap_id = ( SELECT MAX (snap_id) FROM SYS.WRM$_SNAPSHOT) /
BEGIN dbms_workload_repository.drop_snapshot_range(low_snap_id => 16873, high_snap_id=>17083); END; /
这语句执行了很长时间都没反应,最终放弃。采用另外一个办法
1 2 3
SQL> connect / as sysdba SQL> @?/rdbms/admin/catnoawr.sql SQL> @?/rdbms/admin/catawrtb.sql
其实就是把awr相关的对象重建了一遍,如果觉得风险大可以通过truncate的方式
1 2 3 4 5 6
select distinct 'truncate table '||segment_name||';',s.bytes/1024/1024 from dba_segments s where s.segment_name like 'WRH$%' and segment_type in ('TABLE PARTITION', 'TABLE') and s.bytes/1024/1024>100 order by s.bytes/1024/1024/1024 desc;