Quantcast
Channel: SCN : Discussion List - SAP on Oracle
Viewing all articles
Browse latest Browse all 1892

reorg'ed table, no change in wasted space

$
0
0

Hi,

 

I need to reorg a table because it is a top in wasted space:

 

SELECT * FROM

(SELECT

    SUBSTR(TABLE_NAME, 1, 21) TABLE_NAME,

    NUM_ROWS,

    AVG_ROW_LEN ROWLEN,

    BLOCKS,

    ROUND((AVG_ROW_LEN + 1) * NUM_ROWS / 1000000, 0) NET_MB,

    ROUND(BLOCKS * (8000 - 23 * INI_TRANS) *

      (1 - PCT_FREE / 100) / 1000000, 0) GROSS_MB,

    ROUND((BLOCKS * (8000 - 23 * INI_TRANS) * (1 - PCT_FREE / 100) -

      (AVG_ROW_LEN + 1) * NUM_ROWS) / 1000000) "WASTED_MB"

  FROM DBA_TABLES

  WHERE

    NUM_ROWS IS NOT NULL AND

    OWNER LIKE 'SAP%' AND

    PARTITIONED = 'NO' AND

    (IOT_TYPE != 'IOT' OR IOT_TYPE IS NULL)

  ORDER BY 7 DESC)

WHERE ROWNUM <=50; 

 

TABLE_NAME                                                        NUM_ROWS     ROWLEN     BLOCKS     NET_MB   GROSS_MB  WASTED_MB

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

EDI40                                                                              63643300       3904   61161993     248527     439100          190573

 

 

I reorged this table to another tablespace with brspace, then reorged it back to PSAPSR3, and the WASTED_MB in this query stayed exactly the same.

 

I did some reading and it seems that the reason is that this table contains a BLOB:

 

SQL> desc sapsr3.EDI40;

Name Null?    Type

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

MANDT NOT NULL VARCHAR2(9)

DOCNUM NOT NULL VARCHAR2(48)

COUNTER NOT NULL VARCHAR2(9)

PAGENO NOT NULL NUMBER(5)

TIMESTMP NOT NULL VARCHAR2(138)

PAGELG NOT NULL NUMBER(5)

VARDATA BLOB


The CLOB column size of this table is 350 GB:

 

SQL> select

  2 l.segment_name,

  3 l.column_name,

  sl.segment_type,

  4 5    sl.bytes as gig

from

  dba_lobs l,

  6 7    8    dba_segments sl

  9  where

10    l.owner = 'SAPSR3' and

11 l.table_name = 'EDI40' and

12 sl.owner=l.owner and

13 sl.segment_name in (l.segment_name, l.index_name)

14  union (

15  select

16 segment_name,

17    null,

18 segment_type,

19 sum(bytes)/(1024*1024) GIG

20  from

21 dba_segments

where

  owner = 'SAPSR3' and

  segment_name = 'EDI40' and

22   23 24   25    segment_type in ('TABLE','TABLE PARTITION')

26  group by

27 segment_name,

  segment_type

);

28   29

 

SEGMENT_NAME COLUMN_NAME SEGMENT_TYPE GIG

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

EDI40                                                        TABLE     348998

SYS_LOB0000368442C00007$$ VARDATA LOBINDEX 65536

SYS_LOB0000368442C00007$$ VARDATA LOBSEGMENT 131072



Refer to SAP note 646681 and in particular, the section regarding reorganization of tables with LONG fields. In short, you must [STOP SAP]; then 1) generate the ddl for these tables, 2) export their contents to a file, 3)drop them, 4)re-create them with the ddl statements, 6) import the data back into them, 7) re-create their indexes and 8) check their statistics.


Is the process the same for BLOB? To reclaim the wasted space in this table, is this what is needed to be done?


Thanks,

Willem




Viewing all articles
Browse latest Browse all 1892

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>