Setting Up Databases on DB2 using a Shell
Script
Experienced administrators may prefer to use a shell script to create
databases. The default installation illustrated in this guide was based on a DB2
database created using the shell script illustrated below.
Pay particular attention to the end of the shell which contains an
example of how to set up database parameters properly for the new instance
you are creating:
# Set up properly database parameters for new instance
db2 "UPDATE DB CFG FOR MY_DATABASE USING APPLHEAPSZ 4096
STMTHEAP 16000 DBHEAP 4200
LOGFILSIZ 16000 LOGSECOND 12 UTIL_HEAP_SZ 10000 CATALOGCACHE_SZ
96 LOCKLIST 1000 APP_CTL_HEAP_SZ
512 STAT_HEAP_SZ 5022 NUM_IOCLEANERS 2 MAXAPPLS 200"
These values are the minimum recommended values which will allow normal
use of ENOVIAV5VPM at installation. For example, STMTHEAP is set to
16000.
This is the whole shell:
#! /bin/ksh
# HOW TO INIT THE NEW DB2 INSTANCE FOR INSTALL
set -x
MyInstance=DBLCA
MyDbDir=/home/data/db2adm/$MyInstance
# When reinstalling, you first have to drop the database
#db2 drop db $MyInstance
# Add new database on server for PLMDBSetup step
mkdir $MyDbDir
db2 "create db $MyInstance ON '$MyDbDir' COLLATE USING IDENTITY"
# Add new bufferpool for new tbs
db2 connect to $MyInstance
db2 create bufferpool BP8K size 3000 pagesize 8192
db2 create bufferpool BP32K size 3000 pagesize 32768
db2 terminate
# Add new tbs on previously created bufferpool
db2 connect to $MyInstance
db2 "create tablespace ENOTBS pagesize 8K managed by system USING('$MyDbDir/ENOTBS.dbf') bufferpool BP8K"
db2 "create tablespace ENOTBS32 pagesize 32K managed by system
USING('$MyDbDir/ENOTBS.dbf') bufferpool BP32K"
db2 "create tablespace ENOTBS32 pagesize 32K managed by system USING('$MyDbDir/ENOTBS32.dbf') bufferpool BP32K"
# You can also create a tablespace spread over several file
systems by customizing the following
#db2 create tablespace
TBS1_8K pagesize 8K managed by
system
#USING ('/vpmdb_fs1', '/vpmdb_fs2', '/vpmdb_fs3')
#bufferpool VPM_BP1
# Set up properly database parameters for new instance
db2 "UPDATE DB CFG FOR MY_DATABASE USING APPLHEAPSZ 4096
STMTHEAP 16000 DBHEAP 4200
LOGFILSIZ 16000 LOGSECOND 12 UTIL_HEAP_SZ 10000 CATALOGCACHE_SZ
96 LOCKLIST 1000 APP_CTL_HEAP_SZ
512 STAT_HEAP_SZ 5022 NUM_IOCLEANERS 2 MAXAPPLS 200"
db2 terminate
Note about the LOGFILSIZ Parameter
If you use the database configuration parameters documented above,
during an ENOVIAV5VPM installation, the ENOVIA database will be set up correctly,
and the default security mask will be imported. However, if you neglect to
set the LOGFILESIZ parameter correctly, the default security mask
import step may fail.
If a problem with the default mask is detected, the following error
message:
Although commit succeeded, mask was not created - Check Database
configuration
means that the mask was not created, but no problem occurred during the
commit phase. It may be because the database was not created using the
LOGFILSIZ parameter. In this case, update the database configuration using
the correct LOGFILSIZ parameter value and reimport the mask using the
command VPMPeopleUpdate -m as explained in "People, Organization
and Security Tools" in your Enterprise Architecture Administration Guide. |