DB2: Storagegroups Cheat Sheet

Listing storagegroups

db2 select * from syscat.stogroups

Creating a storagegroup

db2 create stogroup  on ‘path’

Creating tablespace with stogroup

db2 create tablespace <tablespace_name>  using stogroup <stogroup_name> 

Altering a storagegroup

db2 alter stogroup  add ‘location’, ‘location’ 

Dropping folder path of storagegroup

db2 alter stogroup  drop ‘/path’ 

Rebalancing a tablespace

db2 alter tablspace <ts_name> rebalance   

Renaming a storagegroup

db2 rename stogroup <old_stg_name> to <new_stg_name>   

Dropping a storage group

Step 1: Before dropping any storagegroup, you can assign some different storagegroup for tablespaces.

db2 alter tablspace <ts_name> using stogroup <another sto_group_name>  

Step 2: Drop the existing stogroup

db2 drop stogorup <stogroup_name>   

Leave a Reply

Your email address will not be published. Required fields are marked *