Introduction to DB2 for z/OS
Previous topic | Next topic | Contents | Glossary | Contact z/OS | PDF


Creation of databases

Introduction to DB2 for z/OS

When you define a DB2® database, you name an eventual collection of tables, associated indexes, and the table spaces in which they are to reside.

When you decide whether to define a new database for a new set of objects or use an existing database, consider the following facts:

  • 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.

To create a database, use the CREATE DATABASE statement. A name for a database is an unqualified identifier of up to eight characters. A DB2 database name must not be the same as the name of any other DB2 database.

Start of changeIn new-function mode, if you do not specify the IN clause on the CREATE TABLE statement, DB2 implicitly creates a database. The following list shows the names for an implicit database: End of change

Start of change

DSN00001, DSN00002, DSN00003, ..., DSN10000

End of change
Example: The following example shows a valid database name:
Object
Name
Database
MYDB
This CREATE DATABASE statement creates the database 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.





Copyright IBM Corporation 1990, 2010