Storage group


What is Storage Group?


Storage group is the collection of the same type of volumes. In other words, A Storage group is a set of storage objects of the same kind.

A storage group name is used to the group and identifies its volumes and VSAM catalog.

Table Storage Structure

One storage group can contain a maximum of 133 volumes in it.

A stored group can contain databases, table spaces, tables, indexes etc.

An entire database can assign to a storage group.

All volumes of a storage group should have the same device type. However, a single database parts can store in different storage groups.

Data sets in DB2 storage groups are called "DB2-managed data sets".

These DB2 storage groups are not the same as those defined by the DFSMS storage management subsystem (DFSMSsms).

After a DB2 storage group is defined, DB2 stores information about it in the DB2 catalog.

SYSDEFLT is the default storage group that is created while installing DB2.

The system table SYSIBM.SYSSTOGROUP has a row for each storage group.

SYSIBM.SYSVOLUMES has a row for each volume.

While creating table spaces and indexes, we name the storage group from which space is allocated.

Suppose you are authorized and do not take specific steps to manage your own storage. In that case, you can still define tables, indexes, table spaces, and databases.

Create Storage Group -


Storage groups can be created by using CREATE STOGROUP statement.

To create the storage group, the user must have the SYSADM or SYSCTRL authority.

Syntax -


CREATE STOGROUP Stroage-grp-name
	VOLUMES (Volume-1, Volume-2,... volume-n)
	VCAT Vcat-name
	[DATACLAS dataclass-name
	MGMTCLAS mgntclass-name
	STORCLAS storageclass-name]
	[NO KEY LABEL/KEY LABEL key-label-name];

Storage-grp-name -

  • Storage-grp-name represents the storage group name.
  • Storage-grp-name can contain up to 128 characters.

VOLUMES (Volume-1, Volume-2,... volume-n) -

  • VOLUMES specifies to the system what are all the volumes used to create a storage group.
  • Volumes information should specify while defining a storage group.
  • Volume serial numbers can contain a maximum of 6 characters.
  • Storage groups can have more than one volume.
  • If the Volumes clause is ignored, the volumes will be selected using SMS (Storage Management System).

VCAT Vcat-name -

  • It uses to identify the system integrated catalog facility for the storage group.
  • Vcat-name should be 8-characters and can also use more than eight characters.
  • An alias name should declare for the same Vcat-name if the name is more than 8-characters.
  • Vcat-name details can be stored in SYSIBM.SYSSTOGROUP.

DATACLAS dataclass-name -

  • DATACLAS uses to identify the SMS data class name to associate with the DB2 storage group.
  • The dataclass-name should be from 1-8 characters in length.
  • DATACLAS should not be specified more than once.

MGMTCLAS mgntclass-name -

  • MGMTCLAS uses to identifies the SMS management class name to associate with the Db2 storage group.
  • The mgntclass-name should be from 1-8 characters in length.
  • MGMTCLAS should not be specified more than once.

STORCLAS storageclass-name -

  • STORCLAS uses to identifies the SMS storage class name to associate with the Db2 storage group.
  • The storageclass-name should be from 1-8 characters in length.
  • STORCLAS should not be specified more than once.

Examples -


Scenario1 - Create a storage group with mandatory parameters.

CREATE STOGROUP SGDBAGJ 
    VOLUMES (DBADM2) 
    VCAT DSNA10; 

In the above case, SGDBAGJ storage group is created with volumes DBADM2 and catalog DSNA10.

Scenario2 - Create a storage group with mandatory parameters.

Code -


 CREATE STOGROUP SGDBAGJ 
       VOLUMES (DBADM2); 

In the above case, SGDBAGJ storage group is created with volumes DBADM2.

Scenario3 - Create a storage group on multiple volumes.

Code -

 CREATE STOGROUP SGDBAGJ 
     VOLUMES (DBADM1, DBADM2) 
       VCAT DSNA10;

In the above case, SGDBAGJ storage group is created with volumes DBADM1, DBADM2.

Scenario4 - Create a storage group with key label.

Code -


  CREATE STOGROUP SGDBAGJ
    VOLUMES (DBADM1, DBADM2) VCAT DSNA10
       KEY LABEL GJKLABEL;

In the above case, SGDBAGJ storage group is created with key label GJKLABEL.

Alter Storage Group -


Suppose if any storage group is created with missing or wrong parameters, then it is good to alter it rather than deleting and recreating it.

DB2 supports altering the storage group.

ALTER STOGROUP statement used to alter the storage group.

To alter the storage group, the user must have the SYSADM or SYSCTRL authority.

Syntax -



ALTER STOGROUP Stroage-grp-name
	ADD VOLUMES (Volume-1, Volume-2,... volume-n)
	REMOVE VOLUMES (Volume-1, Volume-2,... volume-n)
	[DATACLAS dataclass-name
	MGMTCLAS mgntclass-name
	STORCLAS storageclass-name]
	[NO KEY LABEL/KEY LABEL key-label-name];

Examples -


Scenario1 - Alter storage group to add volumes.

Code -


   CREATE STOGROUP SGDBAGJ 
     ADD VOLUMES (DBADM3, DBADM4); 

Scenario2 - Alter storage group to remove volumes.

Code -


  CREATE STOGROUP SGDBAGJ 
     REMOVE VOLUMES (DBADM2, DBADM3); 

Scenario3 - Alter storage group to remove a key label.

Code -


   CREATE STOGROUP SGDBAGJ 
      NO KEY LABEL;

Scenario4 - Alter storage group to add a key label.

Code -


 CREATE STOGROUP SGDBAGJ
    KEY LABEL GJKLABEL;

Drop Storage Group -


Suppose if any storage group is created mistakenly, it is good to delete it to save the memory.

DB2 supports deleting the storage group.

DROP STOGROUP statement used to delete the storage group.

To delete the storage group, the user must have the SYSADM or SYSCTRL authority.

Syntax -


DROP STOGROUP Stroage-grp-name;

Examples -


Scenario1 - drop storage group.

Code -


 DROP STOGROUP SGDBAGJ;