How to create a DB2 tablespace TABSPAC1 in the database DBSPAC1?

DB2DatabaseBig Data Analytics

A tablespace is a collection of data files which resides inside a DB2 database. It is used to organize the data logically. Any DB2 database contains at least one tablespace and in the real world scenario there are multiple tablespaces within a database which are allocated for different business units. In order to create a new tablespace, we have to provide the command as below−

CREATE TABLESPACE TABSPA1
   IN DBSPAC1
   USING STOGROUP STG1
   PRIQTY 50
   SECQTY 50
   BUFFERPOOL BP02
   ERASE NO

The CREATE AND TABLESPACE are the reserved words which are followed by the name of tablespace we want to create. In this case it is TABSPA1.

IN is a reserved word is followed by the name of the database in which we want to create this tablespace. The database is DBSPAC1 in this case.

USING STOGROUP are the reserved words which are accompanied by the name of the storage group to be used for this tablespace.

The PRIQTY and SECQTY are parameters which describe the storage space in KB for primary and secondary allocation respectively.

The BUFFERPOOL parameter is used to give the name of bufferpool which has to be used for this tablespace.

The ERASE parameter specifies that data within the tablespace needs to be removed or not when the tablespace is deleted.

raja
Updated on 12-Sep-2020 14:27:21

Advertisements