Install DB2 and create a database - database configuration/design tasks

If you are tasked with installing and configuring the database, here is a list of steps to be taken:

  1. Install the IBM® DB2® Universal Server on your database server.
  2. Create a DB2 database entity: dbname
    To create the database entity in DB2, use the graphical tool provided by IBM called "DB2 Data Studio", or from the command line, use the db2 command interpreter in a DB2 operating system user session (db2inst). Consider creating your database with the correct database locale (codeset and territory), for example:
    $ db2
    ...
    db2 => CREATE DATABASE dbname
              AUTOMATIC STORAGE YES
              USING CODESET UTF-8 TERRITORY EN_US
    DB20000I  The CREATE DATABASE command completed successfully.
  3. Connect to the new created database with the DB2 administrator user. Open a database connect in the DB2 Data Studio, or use the db2 command interpreter as in the following example:
    db2 => connect to dbname
    
       Database Connection Information
    
     Database server        = DB2/LINUX 10.1.0
     SQL authorization ID   = DB2INST
     Local database alias   = dbname
  4. Declare a database user dedicated to your application: the application administrator. This user will manage the database schema of the application (all tables will be owned by it).
    Create the user with the DB2 Data Studio, or use the db2 command interpreter as follows:
    db2 => GRANT CONNECT ON DATABASE TO USER appadmin
    DB20000I  The SQL command completed successfully.
  5. Give all requested database administrator privileges to the application administrator.
    Grant the privileges to the new created user in the DB2 Data Studio, or use the db2 command interpreter as follows:
    db2 => GRANT CREATETAB ON DATABASE TO USER appadmin
    DB20000I  The SQL command completed successfully.
  6. If you plan to use temporary table emulation, you must setup the database for DB2 global temporary tables (create a user temporary tablespace and grant privileges to all users). See Temporary tables.
  7. Connect as the application administrator: Open a new database connect in the DB2 Data Studio, or use the db2 command interpreter as follows:
    db2 => connect to dbname user appadmin using password
    
       Database Connection Information
    
     Database server        = DB2/LINUX 10.1.0
     SQL authorization ID   = DB2INST
     Local database alias   = dbname
  8. Create the application tables with CREATE TABLE statements. Convert Informix® data types to DB2 data types. See issue Data Type Conversion Table for more details.
  9. If you plan to use SERIAL column emulation, you must prepare the database. See SERIAL data types.