How to find and remove table fragmentation in Oracle Database?

How to find and remove table fragmentation in Oracle Database?

Steps To Check and Remove Fragmentation: STEP 1: First Gather table statistics Step 2: Check table size from dba_segments STEP 3: Check actual table size, fragmented size and percentage of fragmentation in a table. STEP 4: Check the indexes on the table STEP 5: Remove fragmentation by moving tables

What are the different types of table fragmentation?

There are several types of table fragmentation, most commonly the “honeycomb” fragmentation and the “bubble” fragmentation, where it is more difficult to reclaim wasted disk space. Note that you can remove bubble fragmentation by using locally-managed tablespaces, and see these notes on Oracle data file fragmentation.

What happens when you delete data from a table in Oracle?

Ideally once we delete the data from the table, the free space should be released or reused but additionally oracle acquire new blocks to accommodate the new rows for insertion which causes hole into the table.

How does table fragmentation affect file system utilization?

Tablespace fragmentation occurs if a tablespace contains a large number of small free space areas that cannot be reused due to their size. Tablespace fragmentation is mainly a DMTS problem. Due to the AUTOALLOCATE and UNIFORM assignment strategies, fragmentation effects rarely occur in LMTS. File system space utilization

What kind of fragmentation happens in a tablespace?

Tablespaces are dynamic assets. Like other dynamic assets such as disks, they can become fragmented. This fragmentation occurs due to the creation and deletion of tables and the dynamic extension of tables. Fragmentation can be of two general types, honey-comb and swiss-cheese.

What’s the best way to defragment an oracle table?

– CTAS (or “alter table xxx move”): This will defragment the table by copying the rows into their pristine state. You can also use dbms_redefinition to defragment an Oracle table. – Data Pump export/import: Here we drop and re-create the table, unfragmented.

Is it possible to export a table to another table?

Alter table move (to another tablespace, or same tablespace) and rebuild indexes. You obviously need extra space in tablespace to use it. Using ONLINE keyword in Enterprise edition you have no lock and DML are still possible. Export and import the table. Needless to say the downtime is big and is difficult to get on a production database.