A Database is the physical object and it contains the memory area.
Database name is nothing but the logical name to database where the tables are going to store.
Database is a set of structures, and structure can contains tables, table spaces and indexes etc,.
DB2 can control the data by using Database.
Database is a collection of tables and its indexes.
Once the table created in the database, the table will be referred and can be accessed by the Database name.
Same table name can be used or same table can be created in the different databases.
To create the database, user should need DBADM, DBCTRL, or DBMAINT on the Database apart from the authority mentioned in the Storage group.
CREATE DATABASE database-name STOGROUP Storage-grp-name BUFFERPOOL buffer-pool-name INDEXBP index-bp-name
In the above syntax,
Database-name can be the database name that is going to create and the length of the database-name would be 8 characters.
Specifies the storage group used to create the database.
If no storage group specified, the default storage space will be used within the database to create tables and indexes.
The default storage group is SYSDEFLT.
BUFFERPOOL specifies the default buffer pool name used for tables in database.
If the BUFFERPOOL not specified, then the default 4K BUFFERPOOL will be used for the database.
Normally BUFFERPOOL can be multiples of 4K like 4K, 8K, 16K etc,.
INDEXBP specifies the default buffer pool name used for indexes in database.
If the INDEXBP not specified, then the BUFFERPOOL specified will be used for the database.
Normally INDEXBP can be multiples of 4K like 4K, 8K, 16K etc,.
Database details can be stored in SYSIBM.SYSDATABASE
CREATE DATABASE MTH1DB STOGROUP MFTCHP BUFFERPOOL MF INDEXBP MF
SB2 Storage Group DB2 Table Space