Described below is the process on creating tables for application
schedulers from DB2 databases, using data definition language (DDL) or structured
query language (SQL) files.
Why and when to perform this task
Follow these steps to create a DB2 table.Steps for this task
- Open a DB2 command-line window.
- Verify that you have administrator rights for the database system.
- Create the table space and schema.
- Analyze the results of your experiences during development and
system testing. The size of your database depends on many factors. If possible,
distribute table space containers across different logical disks, and implement
an appropriate security policy. Consider the performance implications of your
choices for buffer pools and log file settings.
- Using a text editor, edit the following scripts according to
the instruction at the top of each file.
Note: When setting the
table prefix, capitalize all characters.
%WAS_HOME%\Scheduler\createTablespaceDB2.ddl, %WAS_HOME%\Scheduler\createSchemaDB2.ddl, %WAS_HOME%\Scheduler\dropSchemaDB2.ddl, and %WAS_HOME%\Scheduler\dropTablespaceDB2.ddl.
- Verify that you are attached to the correct instance. Check
the environment variable DB2INSTANCE.
- To connect to the database, scheddb, for example, and enter
the command:
db2 connect to scheddb
- Create the table space. Enter the following command:
db2 -tf createTablespaceDB2.ddl
Verify
that the script output contains no errors. If there were any errors, you can
drop the table space using the following script:
dropTablespaceDB2.ddl
- To create the schema (tables and indices), in the DB2 command
line processor, enter the command db2 -tf createSchemaDB2.ddl. Verify that
the script output contains no errors. If there were any errors, you can use
the following file to drop the schema:
dropSchemaDB2.ddl
- Verify that the DB2_RR_TO_RS DB2 flag is set to YES to avoid
deadlocks. Restart the DB2 instance to activate the change, if needed.
Result
The DB2 tables and schema for the scheduler exist.
What to do next