Creating Db2 databases
You can create a Db2 database by defining a database at the current server.
About this task
Creating a set of objects in a specific database has the following advantages.
- You can start and stop an entire database as a unit. You can display the status of all objects in the database by using a single command that names only the database. Therefore, place a set of related tables into the same database. (The same database holds all indexes on those tables.)
- If you want to improve concurrency and memory use, keep the number of tables in a single database relatively small (maximum of 20 tables). For example, with fewer tables, Db2 performs a reorganization in a shorter length of time.
- Having separate databases allows data definitions to run concurrently and also uses less space for control blocks.
A Db2 database name must not be the same as the name of any other Db2 database.
Procedure
To create a database, use one of the following approaches:
Example
The following example CREATE DATABASE statement creates a database named MYDB:
CREATE DATABASE MYDB
STOGROUP MYSTOGRP
BUFFERPOOL BP8K4
INDEXBP BP4;
The STOGROUP, BUFFERPOOL, and INDEXBP clauses that this example shows establish default values. You can override these values on the definitions of the table space or index space.