top of page

DB2 StorageGroups Cheat Sheet

  • Writer: Jha Chandan
    Jha Chandan
  • Sep 4, 2021
  • 1 min read

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.

ree

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


jc_logo.png

Hi, thanks for stopping by!

Welcome to my “Muse & Learn” blog!
Muse a little, learn a lot.✌️

 

Here you’ll find practical SQL queries, troubleshooting tips with fixes, and step-by-step guidance for common database activities. And of course, don’t forget to pause and muse with us along the way. 🙂
 

I share insights on:​​

  • Db2

  • MySQL

  • SQL Server

  • Linux/UNIX/AIX

  • HTML …and more to come!
     

Whether you’re just starting out or looking to sharpen your DBA skills, there’s something here for you.

Let the posts
come to you.

Thanks for submitting!

  • Instagram
  • Facebook
  • X
2020-2025 © TechWithJC

Subscribe to Our Newsletter

Thanks for submitting!

  • Facebook
  • Instagram
  • X

2020-2025 © TechWithJC

bottom of page