Friday, January 8, 2021

System Tablespace Growing Fast

System Tablespace Growing Fast


Current size is 44GB in my Prod Database.

select sum(bytes)/1024/1024/1024  "GB", TABLESPACE_NAME from dba_data_files group by TABLESPACE_NAME order by 1;


                      GB    TABLESPACE_NAME
------------------------ ------------------------------
                       44     SYSTEM


Free Size is 500 MB only.

SQL> select sum(bytes)/1024/1024 from dba_free_space
  2  where TABLESPACE_NAME='SYSTEM';

SUM(BYTES)/1024/1024
--------------------
             561.625


Now Let me see who consuming  More space.

SQL> column segment_name format a30
set numf 999,999,999,999,999,999

select * from
(select segment_name, bytes from dba_segments where tablespace_name = 'SYSTEM' order by bytes desc)
where rownum < 26;

SEGMENT_NAME                                      BYTES
------------------------------ ------------------------
AUD$                                     32,827,768,832  =====> 32 GB too Much space Consume.
SOURCE$                                   3,489,660,928
IDL_UB1$                                  1,902,116,864
I_SOURCE1                                 1,412,431,872
IDL_UB2$                                    752,877,568
ARGUMENT$                                   738,197,504
C_OBJ#                                      574,619,648
I_ARGUMENT1                                 478,150,656
I_ARGUMENT2                                 377,487,360
VIEW$                                       370,147,328
C_TOID_VERSION#                             291,504,128

SEGMENT_NAME                                      BYTES
------------------------------ ------------------------
I_COL2                                      270,532,608
I_COL1                                      234,881,024
IDL_CHAR$                                   218,103,808
I_COL3                                      142,606,336
DEPENDENCY$                                 125,829,120
IDL_SB4$                                    117,440,512
ACCESS$                                     109,051,904
I_DEPENDENCY2                               102,760,448
C_OBJ#_INTCOL#                              100,663,296
KOTAD$                                       87,031,808
HIST_HEAD$                                   83,886,080

SEGMENT_NAME                                      BYTES
------------------------------ ------------------------
I_DEPENDENCY1                                83,886,080
OBJ$                                         57,671,680
I_ACCESS1                                    55,574,528

25 rows selected.


Lets Reduced size.

create table tmpAud.
 
SQL> sho user
USER is "SYS"
SQL>

create table tmpAud as
select * from sys.aud$
where to_date(trunc(ntimestamp#)) > trunc(sysdate-60);

Table created.

Cleanup and coalesce aud$

SQL>  truncate table sys.aud$;

Table truncated.

-- Repopulate
SQL> insert into sys.aud$ select * from tmpAud;
4407589 rows created.
SQL> commit;
Commit complete.

SQL> drop table tmpAud;
Table dropped.
SQL>

Now Lets Re-Check the space size.

SQL> column segment_name format a30
set numf 999,999,999,999,999,999

select * from
(select segment_name, bytes from dba_segments where tablespace_name = 'SYSTEM' order by bytes desc)
where rownum < 26;

SEGMENT_NAME                                      BYTES
------------------------------ ------------------------
SOURCE$                                   3,489,660,928
IDL_UB1$                                  1,902,116,864
I_SOURCE1                                 1,412,431,872
AUD$                                    897,581,056 ===> We Achieved.



SQL> 
select sum(bytes)/1024/1024/1024 from SM$TS_FREE
where TABLESPACE_NAME='SYSTEM';

SUM(BYTES)/1024/1024/1024
-------------------------
               30.7945557  ====> 30 GB space free. We are good


                                                 ===EOD==

No comments:

Post a Comment