Chapter 5. Deploying pre-configured databases 219
Because the storage layouts on the UNIX system and Windows are different, the
file reference syntax of the DB2 table space definition is different for Windows
and UNIX. See Example 5-3. Note that the only difference is the reference to the
storage system. If you are deploying the pre-configured database from a
UNIX-based system to a Windows-based system or vise versa, make sure that
the DDL is modified.
Example 5-3 Table space creation on Windows versus Linux/UNIX
// Windows syntax:
CREATE REGULAR TABLESPACE ITSO1 PAGESIZE 4 K MANAGED BY DATABASE USING ( FILE
'c:\db2ts\itsodb\itso1.ts' 50M) AUTORESIZE YES BUFFERPOOL ITSO_BP;
// Linux/UNIX syntax:
CREATE REGULAR TABLESPACE ITSO1 PAGESIZE 4 K MANAGED BY DATABASE USING ( FILE
'/work/db2ts/itsodb/itso1.ts' 50M) AUTORESIZE YES BUFFERPOOL ITSO_BP;
If automatic storage managed table spaces are used, the path is automatically
assigned by DB2 based on the database path, no additional change is required.
Database objects
Database objects refers to the tables, indexes, stored procedures, and so on;
that is, all the objects containing business logic and business information. All
database objects can be created with a DDL statement.
In Example 5-4 the DDL statement used to create the Department table in the
ITSODB sample database is listed.
Example 5-4 DDL statement for creating the Department table
-- DDL Statements for table
CREATE TABLE "ITSO"."DEPARTMENT" (
"DEPTNO" CHAR(3) NOT NULL ,
"DEPTNAME" VARCHAR(36) NOT NULL ,
"MGRNO" CHAR(6) ,
"ADMRDEPT" CHAR(3) NOT NULL ,
"LOCATION" CHAR(16) )
IN "ITSO1" ;
-- DDL Statements for primary key
ALTER TABLE "ITSO"."DEPARTMENT"
Note: For table objects it is also possible to have them created by the DB2
Import utility. Because the Import utility can create table objects only, we do
not discuss it here. Instead, we describe the Import utility in 5.4, “Populating
the database” on page 232.