Creating databases
You can use Db2 Admin Tool to help formulate your CREATE DATABASE statements to create new Db2 databases.
Procedure
To create databases:
-
On the DB2 Administration Menu
(ADB2) panel, specify option
2, and press Enter.
The Execute SQL Statements (ADB22) panel is displayed, as shown in the following figure:
Figure 1. Execute SQL Statements (ADB22) panel DB2 Admin -------------------- Execute SQL Statements ------------------- 01:36 Option ===> 1 - Edit/run SQL statements DB2 System: DD1A 2 - Run or Explain SQL statements DB2 SQL ID: ADM001 3 - Build SQL SELECT, INSERT, UPDATE or DELETE prototype 4 - Create/drop/label/comment on objects 5 - Grant/revoke privileges on objects
- Specify option 4, and press Enter.
-
Specify option CD, and press Enter.
The Create Database (ADB26CD) panel is displayed, as shown in the following figure.
Figure 2. Create Database (ADB26CD) panel DB2 Admin --------------------- DD1A Create Database -------------------- 09:25 Command ===> CREATE DATABASE . . . . . (required database name. ? to look up existing) STOGROUP . . . . . > (optional: default is SYSDEFLT. ? to look up) BUFFERPOOL . . . . (optional: default is defined during installation) INDEXBP . . . . . (optional: default is defined during installation) CCSID . . . . . . (optional: ASCII/EBCDIC/UNICODE) AS WORKFILE . . . (Yes/No, only for data sharing environments) FOR MEMBER . . . (optional: default is current connected member)
-
Specify values for the following required parameters. Optionally, specify values for any of the
other parameters:
- Required parameters
-
- DATABASE
- A database name for the new database, or enter a question mark (?) to look up existing database names using Databases (ADB21D) panel.
- Optional parameters
-
- STOGROUP
- The name of a storage group in which you want the new database to belong.
- BUFFERPOOL
- INDEXBP
- The names of buffer pools to use as defined at installation time.
- CCSID
- One of the following formats: ASCII, EBCDIC, or UNICODE.
- AS WORKFILE
- The work file name for data sharing environments.
- AS TEMP
- Indicates whether to create a database for declared temporary tables.
- FOR MEMBER
- A different member in which to place the new database.
-
Follow the instructions on the Statement Execution Prompt
(ADB2PSTM) panel panel (if enabled), as shown in
the following figure, to complete and run the SQL statement for creating the new
database.
Figure 3. The Statement Execution Prompt (ADB2PSTM) panel) – Creating a new database DB2 Admin --------------- DD1A Statement Execution Prompt --------------- 18:10 Option ===> DB2 Admin is about to execute the statement below. You have asked to be prompted before DB2 Admin executes this type of statement. What do you want to do now: 1 - Execute the statement 2 - Edit the statement 3 - Create a batch job with the statement 4 - Add the statement to the work statement list CAN - Cancel Work statement list dsn ===> Work statement list name ===> Action ===> A (Append or Replace) More: + Statement that is about to be executed (first 28 lines): CREATE DATABASE "DBTEST01"