8.3.1.3 Creating the script for OS2DB.sh
Create a file OS2DB.sh:
cd /root/ECMContainers/Container-PIT/install-scripts/config-files/DB2/
Insert the code as follows to the shell script file:
# Licensed Materials – Property of IBM
# (c) Copyright IBM Corp.
2017,2018 All Rights Reserved.
echo Usage: $0
“
<database_name>
“
exit 1
echo Invalid DB name
“
$arg1
“
: Must be 8 characters or less.
echo DB creation would fail.
Exiting…
Close any outstanding connection:
db2 CONNECT RESET
USING CODESET UTF-8 TERRITORY US
Increase the application heap size:
UPDATE DATABASE CONFIGURATION FOR ${P8DBNAME} USING APPLHEAPSZ 2560;
UPDATE DATABASE CONFIGURATION FOR ${P8DBNAME} USING STMTHEAP 8192;
— Drop unnecessary default tablespaces
— REVOKE USE OF TABLESPACE USERSPACE1 FROM PUBLIC;
— Create default buffer pool size
CREATE Bufferpool FNCEDEFAULTBP IMMEDIATE SIZE -1 PAGESIZE 32 K;
CREATE Bufferpool FNPEDEFAULTBP IMMEDIATE SIZE -1 PAGESIZE 32 K;
db2 CONNECT RESET
db2 deactivate database $P8DBNAME
STORAGE EXTENTSIZE 16 OVERHEAD 10.5
PREFETCHSIZE 16 TRANSFERRATE 0.14
STORAGE EXTENTSIZE 16 OVERHEAD 10.5
PREFETCHSIZE 16 TRANSFERRATE 0.14
STORAGE EXTENTSIZE 16 OVERHEAD 10.5
PREFETCHSIZE 16 TRANSFERRATE 0.14
STORAGE EXTENTSIZE 16 OVERHEAD 10.5
PREFETCHSIZE 16 TRANSFERRATE 0.14
DROPPED TABLE RECOVERY ON;
STORAGE EXTENTSIZE 16 OVERHEAD 10.5
PREFETCHSIZE 16 TRANSFERRATE 0.14
#– Grant USER access to tablespaces
echo Grant user $DB2USER access to tablespace
#db2 -v GRANT CREATETAB,CONNECT ON DATABASE TO user $DB2USER;
#db2 -v GRANT SECADM, DBADM ON DATABASE TO user $DB2USER;
#db2 -v GRANT USE OF TABLESPACE ${P8DBNAME}_TBS TO user $DB2USER;
#db2 -v GRANT USE OF TABLESPACE USERTEMP1 TO user $DB2USER;
#db2 -v GRANT USE OF TABLESPACE VWDATA_TS2 TO user $DB2USER;
#db2 -v GRANT USE OF TABLESPACE VWINDEX_TS2 TO user $DB2USER;
#db2 -v GRANT USE OF TABLESPACE VWBLOB_TS2 TO user $DB2USER;
db2 update db cfg for ${P8DBNAME} using LOCKTIMEOUT 30
db2 update db cfg for ${P8DBNAME} using LOGBUFSZ 212
db2 update db cfg for ${P8DBNAME} using LOGFILSIZ 6000
db2 update db cfg for ${P8DBNAME} using APPLHEAPSZ 2560
db2 update db cfg for ${P8DBNAME} using LOGPRIMARY 10