Creating a DB2 database on Linux or UNIX

Geodatabases are collections of tables and procedures in a database. Therefore, a database must be created prior to creating a geodatabase.

For DB2, ArcSDE requires the use of a DB2 global temporary table (DECLARE GLOBAL TEMPORARY TABLE). As per DB2 documentation, you must have SYSADMIN or DBADM privileges or have been granted USE privilege on a USER TEMPORARY table space to declare global temporary tables. A user temporary table space can be created using the DB2 Control Center or from the command line using the CREATE USER TEMPORARY TABLESPACE command. Be sure to create the user temporary table space as a system-managed space (SMS).

TipTip:

Though you should use SMS for user temporary table spaces, you should use database-managed space (DMS) table spaces for storing user data.

There are many options for table space storage. See the DB2 Information Center topic "Automatic storage table spaces" for more information.

The following steps contain an example script to create a DB2 database, create a user temporary table space, and grant the use of all table spaces to PUBLIC.

Steps:
  1. Create a script to create the database.
    NoteNote:

    The name of a database used to store a geodatabase cannot contain special characters.

    The following is an example script. Replace variables such as database name, password names, and container names and paths to match the information needed at your site.

    db2 -tvf <script.clp>
    
    FORCE APPLICATION ALL;
    
    DB2STOP;
    
    DB2START;
    
    CREATE DATABASE mysdedb USING CODESET UTF-8 TERRITORY US COLLATE USING SYSTEM USER TABLESPACE MANAGED BY DATABASE USING (FILE '/db2_data/mysdedb/sdetbsp' 51200);
    
    CONNECT TO mysdedb user db2admin using <your password>;
    
    CREATE REGULAR TABLESPACE regtbs PAGESIZE 4 K MANAGED BY DATABASE USING ( FILE '/db2_data/mysdedb/regtbs' 125000);
    
    CREATE LONG TABLESPACE lobtbs PAGESIZE 4 K MANAGED BY DATABASE USING ( FILE '/db2_data/mysdedb/lobtbs' 51200);
    
    CREATE USER TEMPORARY TABLESPACE sdespace PAGESIZE 4 K MANAGED BY SYSTEM USING ('/db2_data/mysdedb/sdespace' );
    
    GRANT USE OF TABLESPACE regtbs TO PUBLIC;
    
    GRANT USE OF TABLESPACE lobtbs TO PUBLIC;
    
    GRANT USE OF TABLESPACE sdespace TO PUBLIC;
    
    GRANT DBADM ON DATABASE mysdedb TO USER SDE;
    
    UPDATE DATABASE CONFIGURATION FOR mysdedb USING APP_CTL_HEAP_SZ 2048;
    
    UPDATE DATABASE CONFIGURATION FOR mysdedb USING APPLHEAPSZ 2048;
    
    UPDATE DATABASE CONFIGURATION FOR mysdedb USING LOGPRIMARY 10;
    
    FORCE APPLICATION ALL;
    
    DB2STOP FORCE;
    
    DB2START;
  2. Create a user temporary table space as a system-managed space (SMS).

    For example:

    CREATE USER TEMPORARY TABLESPACE sdespace PAGESIZE 4 K MANAGED BY SYSTEM USING ('d:\db2_data\sdespace' );
    
    COMMENT ON TABLESPACE sdespace IS '';
  3. Grant the use of all table spaces to PUBLIC.
    GRANT USE OF TABLESPACE regtbs TO PUBLIC; 

After database creation, you must spatially enable the database. See Spatially enabling a DB2 database for more information.

Related Topics


8/19/2013