How to reclaim the disk space size of the database after upgrade or migration in case of exponential size increase?

How to reclaim the disk space size of the database after upgrade or migration in case of exponential size increase?

book

Article ID: KB0070203

calendar_today

Updated On:

Products Versions
Spotfire Server All supported versions

Description

When upgrading or migrating to Spotfire 12 and above versions, it has been noted that the database size may significantly increase, especially due to Large Objects (LOBs) occupying space.

Environment

All supported operating systems

Resolution

To address this issue, we suggest working with your DBAs to reclaim space by using shrink. Another option would be to address fragmentation and organize the LOBs, or consider moving them to another tablespace to optimize data storage. Before making any changes, it's crucial to validate the query syntax with your DBA.

Note: Always back up your database before making any modifications.

The following options and SQL queries are available for an Oracle database:
1) To shrink the space used by the LOBs:
   ALTER TABLE LIB_DATA MODIFY LOB(DATA) (SHRINK SPACE);

2) Another option could be moving LOBs to another tablespace:
   SQL> ALTER TABLE TEST MOVE LOB(TEST_NAME) STORE AS (TABLESPACE EXAMPLE);
   Also:
   ALTER TABLE LIB_DATA MOVE LOB(DATA) STORE AS (TABLESPACE SPOTFIRE_DATA_LOB) PARALLEL 16;

3) Another method to consider is using the DBMS_REDEFINITION package. More details can be found at https://support.oracle.com/epmos/faces/DocContentDisplay?id=1394613.1.

For Postgres, similar commands such as vacuumlo and vacuum full can be used to achieve the result. For more information, please refer to the following Postgres documents:
https://www.postgresql.org/docs/current/routine-vacuuming.html
https://postgresql.org/docs/current/sql-vacuum.html
https://www.postgresql.org/docs/current/vacuumlo.html

Issue/Introduction

This article provides more information on how to reclaim disk space for the database after an increase in size after migration or upgrade of Spotfire. This is not an issue, but depending on the database there may be a lot of space that can be reclaimed via a shrink or addressing fragmentation of the databases.

Additional Information

Routine Database Maintenance Tasks for PostgreSQL - Routine Vacuuming:

https://www.postgresql.org/docs/current/routine-vacuuming.html
https://postgresql.org/docs/current/sql-vacuum.html
https://www.postgresql.org/docs/current/vacuumlo.html