Storage Groups (Stogroups)

Restriction: This topic applies to Windows environments only.

On a mainframe system, Storage Groups (Stogroups) provide a means of specifying the physical DASD volume where data will be stored. The XDB Server provides an analogous function by allowing you to associate a drive and pathname with a stogroup name.

You can define one or more stogroups in each location as needed. Later, when you create a database or table space in a location that has one or more stogroups defined, you can specify a stogroup to be used for storing the database or table(s). Thus, you can specifically define the physical location (on what volume-- disk drive and directory) of each database or table space.

Note: Use of stogroups is optional. Once you define a location directory, subdirectory paths for other objects are created automatically as needed when you create the objects (for example, CREATE DATABASE). The XDB System Catalog keeps track of where objects are stored for each location and database.

To use stogroups to their full advantage, you must create the path(s) on your operating system. Then use the CREATE STOGROUP command to specify the drive and path name to be associated with a stogroup name. Lastly, modify two columns in the SYSIBM.SYSVOLUMES table to define the path to the XDB Server. (It is also possible to define a stogroup without assigning a path in SYSIBM.SYSVOLUMES. This provides compatibility with mainframe DB2 in terms of maintaining the stogroup-related entries in system tables but allows the XDB Server database software to use its default path creation and naming routines.)

If you do not specify a path in SYSIBM.SYSVOLUMES and/or you do not specify stogroups for your table spaces, the XDB Server will create a subdirectory under the location name directory to store your database files when you create the database. A typical database path created by the XDB Server could be :\XDB\LOCAT1\DBNAME\ (Windows) or /xdb/locat1/dbname/ (UNIX).

Note: The XDB SYSIBM.SYSVOLUMES table contains two columns that are not included in the analogous DB2 table. These columns are XDBPRIMEVOLPATH and XDBVOLPATH.

See the SQL Reference for detailed information regarding the storage structure and naming conventions that apply when creating various table and database objects, with and without stogroups.

Example

The following CREATE commands will create two storage groups (named STOR1 and STOR2) on two separate disk volumes (named MINE and YOURS). The UPDATE commands will then define the disk drive and directory for each of the named volumes.

Windows:

CREATE STOGROUP stor1 VOLUMES (mine) VCAT xdb;
CREATE STOGROUP stor2 VOLUMES (yours) VCAT xdb;
UPDATE SYSIBM.SYSVOLUMES
    SET XdbPrimeVolPath = "y", 
        XdbVolPath = "d:\stor1\"  
    WHERE Volid = "mine";
UPDATE SYSIBM.SYSVOLUMES
    SET XdbPrimeVolPath = "y", 
        XdbVolPath = "e:\stor2\"
    WHERE Volid = "yours";

Before you can create databases or table spaces in these stogroups, you must create the two directories (d:\stor1 and e:\stor2).

UNIX:

CREATE STOGROUP stor1 VOLUMES (mine) VCAT xdb;
CREATE STOGROUP stor2 VOLUMES (yours) VCAT xdb;
UPDATE SYSIBM.SYSVOLUMES
    SET XdbPrimeVolPath = "y" , 
        XdbVolPath = "/stor1/"
  WHERE Volid = "mine";
UPDATE SYSIBM.SYSVOLUMES
    SET XdbPrimeVolPath = "y" , 
        XdbVolPath = "/stor2/"
  WHERE Volid = "yours";

Before you can create databases or table spaces in these stogroups, you must create the two directories (/stor1/ and /stor2/).

Note: The VCAT parameter is required only when running in DB2 compatible mode. It is checked for syntax only, and recorded in the appropriate system table.

To complete this example, you would use CREATE commands such as the following to specify storage locations for objects you create:

CREATE DATABASE xyz stogroup STOR1;

or

CREATE TABLESPACE abc IN xyz 
    USING STOGROUP stor1;