Search This Blog

Tuesday, 28 July 2020

Resizeing UNDO Tablespace datafile

UNDO TABLESPACE Before Size :


Tablespace                                Size            Free            Used      Max Ext

 Name                File Count            (MB)            (MB)            (MB)         (MB)     % USED Graph

-------------------- ---------- --------------- --------------- --------------- ------------ ---------- -----------

SYSTEM                        1             .80             .00             .79           32 99.2301829

SYSAUX                        1             .66             .03             .63           32 94.8988971

USERS                         1             .00             .00             .00           32         20 ********

UNDOTBS1                      1            1.00             .96             .03           32 3.06396484 *********





SQL> alter database datafile 'C:\APP\MMUSSAIB\ORADATA\TEST\UNDOTBS01.DBF' resize 2G;



SQL>
set feed off

column "Graph" heading "Graph" format a11

set pages 999

set lines 999

column "tablespace_name" heading "Tablespace | Name" format a20

column "FileCount" heading "File | Count" format 999999

column "Size(MB)" heading "Size | (MB)" format 999,999,999.99

column "Free(MB)" heading "Free | (MB)" format 999,999,999.99

column "Used(MB)" heading "Used | (MB)" format 999,999,999.99

column "Max Ext(MB)" heading "Max Ext | (MB)" format 999,999,999

column "%Free" heading "% | Free" format 999.99

column "%Free Ext" heading "% | Free Ext" format 999.99

column tablespace_name heading "Tablespace | Name" format a20
SELECT
 ts.tablespace_name, "File Count",

   TRUNC("SIZE(MB)", 2) "Size(MB)",

   TRUNC(fr."FREE(MB)", 2) "Free(MB)",

   TRUNC("SIZE(MB)" - "FREE(MB)", 2) "Used(MB)",

   df."MAX_EXT" "Max Ext(MB)",

   100-((fr."FREE(MB)" / df."SIZE(MB)") * 100) "% USED",

   RPAD('*', TRUNC(CEIL((fr."FREE(MB)" / df."SIZE(MB)") * 100)/10), '*')    "Graph"

FROM

   (SELECT tablespace_name,

   SUM (bytes) / (1024 * 1024*1024) "FREE(MB)"

   FROM dba_free_space

    GROUP BY tablespace_name) fr,

(SELECT tablespace_name, SUM(bytes) / (1024 * 1024*1024) "SIZE(MB)", COUNT(*)

"File Count", SUM(maxbytes) / (1024 * 1024*1024) "MAX_EXT"

FROM dba_data_files

GROUP BY tablespace_name) df,

(SELECT tablespace_name

FROM dba_tablespaces) ts

WHERE fr.tablespace_name = df.tablespace_name (+)

AND fr.tablespace_name = ts.tablespace_name (+)

ORDER BY "% USED" desc

/

UNDO TABLESPACE After Increasing Size :


Tablespace                                Size            Free            Used      Max Ext

 Name                File Count            (MB)            (MB)            (MB)         (MB)     % USED Graph

-------------------- ---------- --------------- --------------- --------------- ------------ ---------- -----------

SYSTEM                        1             .80             .00             .79           32 99.2301829

SYSAUX                        1             .66             .03             .63           32 94.8988971

USERS                         1             .00             .00             .00           32         20 ********

UNDOTBS1                      1            2.00            1.96             .03           32 1.53198242 *********

SQL>

No comments:

Post a Comment