Releasing LOB space in DB2 databases

You can release the large object (LOB) storage in the DB2 database.

Pre-requisite:

Plan downtime for upgrading IBM® UrbanCode® Deploy and releasing LOB space.

Procedure:

Release LOB storage for DB2 database using the following steps:
  1. Set the versioned_config.upgrade.enabled=true parameter in the conf/server/installed.properties file.
  2. Restart the IBM UrbanCode Deploy server.
  3. Check on the progress of the conversion:
    select count(*) from vc_persistent_record where persistent_data is not null

    The compression process is complete when the row count reported by the query is 0.

  4. Catalog the IBM UrbanCode Deploy DB2 database:
    db2 catalog tcpip node dbname remote ipAddress server port
    db2 catalog database dbname at node dbname
    For example, enter the following command:
    db2 catalog tcpip node mydb remote 10.134.119.178 server 48408

    You must catalog the database only once on the client system. If you have to catalog a different database, either use a different node and database name (mydb in this example) or uncatalog the cataloged database:

    db2 uncatalog database mydb
    db2 uncatalog node mydb
  5. Connect to the cataloged database:
    db2 connect to mydb user db2inst1 using db2inst1
    Catalog the database every time you start up the DB2 command window.
  6. Check the database size:
    db2 -v "CALL GET_DBSIZE_INFO(?, ?, ?, -2)"
  7. Check how much space each tablespace is using:
    db2 -v "SELECT varchar(tbsp_name, 30) as tbsp_name, decimal(tbsp_free_pages * tbsp_page_size)/1024/1024 as free_space_mb, decimal(tbsp_total_pages * tbsp_page_size)/1024/1024 as total_space_mb FROM TABLE(MON_GET_TABLESPACE('',-2))"
  8. Compress the database table:
    db2 -v "REORG TABLE VC_PERSISTENT_RECORD LONGLOBDATA"
    db2 -v "ALTER TABLESPACE USERSPACE1 LOWER HIGH WATER MARK"
    db2 -v "ALTER TABLESPACE USERSPACE1 REDUCE MAX"
    The preceding example includes the assumption that the vc_persistent_record table is in a tablespace called USERSPACE1. Replace USERSPACE1 with the tablespace name that contains the vc_persistent_record table.
    Note: The ALTER TABLESPACE commands must only be performed if the IBM UrbanCode Deploy is offline.

Post-requisite:

  1. Verify that the space is reduced:
    db2 -v "CALL GET_DBSIZE_INFO(?, ?, ?, -2)"
  2. Set the versioned_config.upgrade.enabled parameter back to false in the conf/server/installed.properties file.
    Note: Starting with v7.3.0.1, the property name experimental.vcUpgrade.enabled has been changed to versioned_config.upgrade.enabled.