oracle11g aud$ Maintenance

Source: Internet
Author: User

The system table space usage is 85%, and the aud$ table used to record audit records takes up a lot of space.

After the backup truncate off aud$, the problem is temporarily resolved. Remember oracle11.2 can move aud$ to normal table empty

Room So I tried it and it was OK.

1. Check system table space usage

  1. Sql*plus:release 11.2.0.3.0 Production on Mon Mar 11:21:18
  2. Copyright (c) 1982, Oracle.  All rights reserved.
  3. Connected to :
  4. Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-64bit Production
  5. With the partitioning, Data Mining and Real application testing Options
  6. sql> Select
  7. 2 b.tablespace_name "table space",
  8. 3 b.bytes/1024/1024 "size M",
  9. 4 (b.bytes-sum (NVL (a.bytes,0)))/1024/1024 "used M",
  10. 5 substr ((b.bytes-sum (NVL (a.bytes,0))/(b.bytes) *100,1,5) "Utilization"
  11. 6 from dba_free_space a,dba_data_files b
  12. 7 where a.file_id=b.file_id
  13. 8 and b.tablespace_name=' SYSTEM '
  14. 9 GROUP by B.tablespace_name,b.file_name,b.bytes
  15. Ten order by B.tablespace_name;
  16. Table space size m using m utilization
  17. ------------------- ---------- ----------- ----------
  18. SYSTEM 4096 3485.9375 85.10

2. From Dba_segments, find the large object occupying the top 10 in the system table space.

[SQL]View Plaincopy
  1. Sql> Col segment_name for A15;
  2. Sql> SELECT *
  3. 2 from (SELECT segment_name, SUM (BYTES)/1024/1024 MB
  4. 3 from dba_segments
  5. 4 WHERE tablespace_name = ' SYSTEM '
  6. 5 GROUP by segment_name
  7. 6 ORDER by 2 DESC)
  8. 7 WHERE ROWNUM < 10;
  9. Find out the aud$ occupy a lot of space.

3. Prepare Truncate aud$ table

[SQL]View Plaincopy
  1. Sql> Show Parameter Audit_trail
  2. NAME TYPE VALUE
  3. --------------- ----------- ---------
  4. Audit_trail string DB
  5. <span style="Color:rgb (255, 0, 0); >--truncate aud$ table requires relevant permissions. </span>
  6. sql> truncate table aud$;
  7. Table truncated

4.truncate Check System tablespace usage and find usage reduced from 85% to 29.44%

[SQL]View Plaincopy
  1. sql> ANALYZE TABLE aud$ COMPUTE STATISTICS;
  2. Table analyzed.
  3. sql> Select
  4. 2 b.tablespace_name "table space",
  5. 3 b.bytes/1024/1024 "size M",
  6. 4 (b.bytes-sum (NVL (a.bytes,0)))/1024/1024 "used M",
  7. 5 substr ((b.bytes-sum (NVL (a.bytes,0))/(b.bytes) *100,1,5) "Utilization"
  8. 6 from dba_free_space a,dba_data_files b
  9. 7 where a.file_id=b.file_id
  10. 8 and b.tablespace_name=' SYSTEM '
  11. 9 GROUP by B.tablespace_name,b.file_name,b.bytes
  12. Ten order by B.tablespace_name;
  13. Table space size m using m utilization
  14. ---------------- ---------- ----------   ----------
  15. SYSTEM 4096 1206 29.44



5. To avoid the effect of full system table space on the data, migrate the aud$ from the system table space to the normal tablespace aud_file.

[SQL]View Plaincopy
    1. sql> BEGIN
    2. 2 dbms_audit_mgmt. Set_audit_trail_location (
    3. 3 Audit_trail_type = Dbms_audit_mgmt. AUDIT_TRAIL_AUD_STD,
    4. 4 Audit_trail_location_value = ' aud_file ');
    5. 5 END;
    6. 6/
    7. Sql> Col owner for A5;
    8. Sql> SELECT OWNER, table_name, Tablespace_name
    9. 2 from dba_tables
    10. 3 WHERE table_name = ' aud$ '
    11. 4 and OWNER = ' SYS ';
    12. OWNER table_name Tablespace_name
    13. ----- ------------------------------ ------------------------------
    14. SYS aud$ TD_FILB

oracle11g aud$ Maintenance

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.