DB2 StorageGroups Cheat Sheet
Db2 StorageGroup is a set of Storage paths to store database table or objects. You can assign the tablespaces to the storage group. When you create a database, all the tablespaces take default storagegorup. The default storage group for a database is ‘IBMSTOGROUP’. When you create a new database, the default storage group is active, if you pass the “AUTOMATIC STOGROUP NO” parameter at the end of “CREATE DATABASE” command. The database does not have any default storage groups.
In this blogpost you will see and learn Db2 StorageGroups related syntaxes and methods which help you using Db2 database product.
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>
That's all in this post. If you liked this blog and interested in knowing more about IBM Db2. Please Like, Follow, Share & Subscribe to www.ImJhaChandan.com.
Comments