High Table space usage in SYSAUX

Source: Internet
Author: User

In general, DBA should focus on the SYSTEM, SYSAUX, UNDO, TEMP, and SYSTEM tablespaces in addition to the tablespace where business data is stored, the size of the UNDO and TEMP tablespaces is determined by the business conditions of the database. If you do not configure the SYSAUX tablespaces by default, they will expand over time! The SYSAUX tablespace is an auxiliary tablespace of the system tablespace. It mainly stores EM-related content and table statistics, AWR snapshots, and audit information. In my opinion, if your SYSAUX tablespace is larger than 2 GB, so let him lose weight!

I. Use the following statements to query table space usage
 
 
  1. SELECT * FROM ( 
  2. SELECT D.TABLESPACE_NAME, 
  3.         SPACE || 'M' "SUM_SPACE(M)", 
  4.         BLOCKS "SUM_BLOCKS", 
  5.         SPACE - NVL (FREE_SPACE, 0) || 'M' "USED_SPACE(M)", 
  6.         ROUND ( (1 - NVL (FREE_SPACE, 0) / SPACE) * 100, 2) || '%' 
  7.            "USED_RATE(%)", 
  8.         FREE_SPACE || 'M' "FREE_SPACE(M)" 
  9.    FROM (  SELECT TABLESPACE_NAME, 
  10.                   ROUND (SUM (BYTES) / (1024 * 1024), 2) SPACE, 
  11.                   SUM (BLOCKS) BLOCKS 
  12.              FROM DBA_DATA_FILES 
  13.          GROUP BY TABLESPACE_NAME) D, 
  14.         (  SELECT TABLESPACE_NAME, 
  15.                   ROUND (SUM (BYTES) / (1024 * 1024), 2) FREE_SPACE 
  16.              FROM DBA_FREE_SPACE 
  17.          GROUP BY TABLESPACE_NAME) F 
  18.   WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME(+) 
  19.  UNION ALL                                                           
  20.  SELECT D.TABLESPACE_NAME, 
  21.         SPACE || 'M' "SUM_SPACE(M)", 
  22.         BLOCKS SUM_BLOCKS, 
  23.         USED_SPACE || 'M' "USED_SPACE(M)", 
  24.         ROUND (NVL (USED_SPACE, 0) / SPACE * 100, 2) || '%' "USED_RATE(%)", 
  25.         NVL (FREE_SPACE, 0) || 'M' "FREE_SPACE(M)" 
  26.    FROM (  SELECT TABLESPACE_NAME, 
  27.                   ROUND (SUM (BYTES) / (1024 * 1024), 2) SPACE, 
  28.                   SUM (BLOCKS) BLOCKS 
  29.              FROM DBA_TEMP_FILES 
  30.          GROUP BY TABLESPACE_NAME) D, 
  31.         (  SELECT TABLESPACE_NAME, 
  32.                   ROUND (SUM (BYTES_USED) / (1024 * 1024), 2) USED_SPACE, 
  33.                   ROUND (SUM (BYTES_FREE) / (1024 * 1024), 2) FREE_SPACE 
  34.              FROM V$TEMP_SPACE_HEADER 
  35.          GROUP BY TABLESPACE_NAME) F 
  36.   WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME(+) 
  37.  ORDER BY 1)  
  38.  WHERE TABLESPACE_NAME IN ('SYSAUX','SYSTEM','UNDOTBS1','TEMP'); 
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131229/1R5593234-0.jpg "border =" 0 "alt =" "/> 2: query the proportion of each category project in the SYSAUX tablespace to the bucket, obviously, AWR snapshots occupy about 2 GB of space and the statistical information is about mb. At the same time, the database disables audit audit_trail, so the audit table aud $ does not occupy space.
 
 
  1. SELECT occupant_name "Item", 
  2.        space_usage_kbytes / 1048576 "Space Used (GB)", 
  3.        schema_name "Schema", 
  4.        move_procedure "Move Procedure" 
  5.   FROM v$sysaux_occupants 
  6. ORDER BY 1 
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131229/1R5593L9-1.jpg "border =" 0 "alt =" "/>

3. Modify the retention time of statistical information. The default value is 31 days. Here, the value is changed to 7 days. Expired statistical information is automatically deleted.

 
 
  1. SQL> select dbms_stats.get_stats_history_retention from dual; 
  2.  
  3. GET_STATS_HISTORY_RETENTION 
  4. --------------------------- 
  5.                          31 
  6.  
  7. SQL> exec dbms_stats.alter_stats_history_retention(7);       
  8. PL/SQL procedure successfully completed. 
  9.  
  10. SQL> select dbms_stats.get_stats_history_retention from dual; 
  11.  
  12. GET_STATS_HISTORY_RETENTION 
  13. --------------------------- 
  14.                           7 

4. Change the AWR snapshot retention period to 7 days (7*24*60). The snapshot is collected every hour. You can also view and modify the snapshot on the EM page.

 
 
  1. SQL> begin 
  2.          dbms_workload_repository.modify_snapshot_settings ( 
  3.             interval => 60, 
  4.             retention => 10080, 
  5.             topnsql => 100 
  6.           ); 
  7. end; 

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131229/1R5592138-2.jpg "border =" 0 "alt =" "/>

5. Delete the AWR snapshot and view the SYSAUX tablespace usage again. The tablespace usage is reduced to 38.42%.

 
 
  1. Select min (snap_id), max (snap_id) from dba_hist_snapshot; // query the minimum and maximum snapshot IDS
  2.  
  3. Begin
  4. Dbms_workload_repository.drop_snapshot_range (
  5. Low_snap_id => 10758,
  6. High_snap_id => 10900,
  7. Dbid => 387090299 );
  8. End;

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131229/1R55a919-3.jpg "border =" 0 "alt =" "/>

Thank you for sharing your reference! Http://jhdba.wordpress.com/2009/05/19/purging-statistics-from-the-sysaux-tablespace/

This article is from the "Bo Yue" blog and will not be reproduced!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.