Replacing all row-organized tables with column-organized tables in a partitioned database environment

Use the db2convert command to convert your row-organized tables into column-organized tables.

Before you begin

Switching to column-organized tables will affect the performance and use of resources of the system. Review the best practices for column-organized tables for recommendations on the memory, cores, and storage to provide for your desired dataset size.

About this task

There are several ways to convert row-organized tables to column-organized tables. One way is to use the db2convert command. If the database is not recoverable, simply run the db2convert command. If it is recoverable, you must run the command, make a backup of the database, and then rerun the command to complete the conversion.

Procedure

To replace all row-organized tables with column-organized tables in a non-recoverable database:

  • Run the db2convert command on the desired database:
    db2convert –d <name_of_database>

To replace all row-organized tables with column-organized tables in a recoverable database:

  • Complete the first part of the conversion by running db2convert with the -stopBeforeSwap parameter, backup the database where you plan to store the converted tables, and then complete the conversion by running the command again:
    db2convert -d <name_of_database> –stopBeforeSwap; 
    
    BACKUP DB <name_of_database> ONLINE TO <destination> ;
    BACKUP DB <name_of_database> TABLESPACE <target_data_table_space> ONLINE TO <destination>;
    
    db2convert -d <name_of_database> –continue;
    Where:
    • –stopBeforeSwap specifies that db2convert stops before it performs the SWAP phase of the ADMIN_MOVE_TABLE procedure and prompts you to complete an online backup operation before continuing.
    • -continue completes the conversion process.