Hi, you can get a problem when migrating to v-next of db2 docker image. you should considere not to create a database via ibm scripts using the environment variable but instead use your own script to create a database.
in your new docker file you should at first create the directory /var/custom and place your create sripts there. the entrypoint script will do all its stuff and as a last step execute the scripts in that folder in alphabetic order. be aware that these scripts get executed as root, all db2 command will have to be execute as in your example with su - ${DB2INSTANCE?} -c "db2 xxxxxx"
example for a docker file:
FROM ibmcom/db2:11.5.0.0a
RUN mkdir -p /var/custom
COPY custom/* /var/custom/
RUN chmod a+x /var/custom/*.sh
------------------------------
Markus Fraune
------------------------------
Original Message:
Sent: Wed March 25, 2020 02:51 AM
From: YATHENDRA PRASAD
Subject: DB2 CREATE DATABASE WITH PAGESIZE
Hi @SangGyu Jeong ,
Thanks for the reply . Yes we would be able to create the database once the container is up and running. We had requirement to create database with pagesize option on the fly . So this the approach i followed. I did copy the db2_common_functions from the location "/var/db2_setup/include/db2_common_functions" and add modified the create database method in the script to adpot the page size change . Created an new dockerfile and extented the db2 docker image to copy the modified db2_common_functions . Here is the snippet for the docker file
FROM ibmcom/db2:11.5.0.0a
USER root
COPY db2_common_functions /var/db2_setup/include/db2_common_functions
create_db()
{
dbname=$1
echo "(*) Creating database $dbname ... "
if su - ${DB2INSTANCE?} -c "db2 create db ${dbname?} collate using system pagesize 32768"; then
su - ${DB2INSTANCE?} -c "db2 activate db ${dbname?}"
fi
}
Thanks
------------------------------
YATHENDRA PRASAD
Original Message:
Sent: Sat March 21, 2020 11:23 PM
From: SangGyu Jeong
Subject: DB2 CREATE DATABASE WITH PAGESIZE
@YATHENDRA PRASAD
Hello. I have no problem creating a 32KB page size database with docker images.
[root@db2 db2]# docker run -itd --name mydb2 --privileged=true -p 50005:50005 -e LICENSE=accept -e DB2INST1_PASSWORD=db2inst1 ibmcom/db218e8d22b5b5a291de45fd798ca9e4b3a8d485c5da76d4b5e721546032c52a92e[root@db2 db2]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEdocker.io/ibmcom/informix-developer-database latest 690e3d99d746 4 months ago 920 MBdocker.io/rakudo-star latest 91fe3ad6db91 7 months ago 369 MBdocker.io/ibmcom/db2 latest 66a976f94954 8 months ago 2.96 GB[root@db2 db2]# docker exec -ti mydb2 bash -c "su - db2inst1"Last login: Sun Mar 22 03:15:46 UTC 2020 on console[db2inst1@18e8d22b5b5a ~]$ db2levelDB21085I This instance or install (instance name, where applicable:"db2inst1") uses "64" bits and DB2 code release "SQL11050" with levelidentifier "0601010F".Informational tokens are "DB2 v11.5.0.0", "s1906101300", "DYN1906101300AMD64",and Fix Pack "0".Product is installed at "/opt/ibm/db2/V11.5".[db2inst1@18e8d22b5b5a ~]$ db2 list db directorySQL1031N The database directory cannot be found on the indicated file system.SQLSTATE=58031[db2inst1@18e8d22b5b5a ~]$ db2pd -Database Member 0 -- Active -- Up 0 days 00:00:01 -- Date 2020-03-22-03.16.00.690065[db2inst1@18e8d22b5b5a ~]$ db2 "create database testdb collate using system pagesize 32768"DB20000I The CREATE DATABASE command completed successfully.[db2inst1@18e8d22b5b5a ~]$ db2 list db directory System Database Directory Number of entries in the directory = 1Database 1 entry: Database alias = TESTDB Database name = TESTDB Local database directory = /database/data Database release level = 15.00 Comment = Directory entry type = Indirect Catalog database partition number = 0 Alternate server hostname = Alternate server port number =[db2inst1@18e8d22b5b5a ~]$ db2 get db cfg for testdb | grep -i page Database code page = 1208 Database page size = 32768 Multi-page file allocation enabled = YES Changed pages threshold (CHNGPGS_THRESH) = 80 Number of asynchronous page cleaners (NUM_IOCLEANERS) = AUTOMATIC(4) Default prefetch size (pages) (DFT_PREFETCH_SZ) = AUTOMATIC Track modified pages (TRACKMOD) = NO Default tablespace extentsize (pages) (DFT_EXTENT_SZ) = 32 Target for oldest page in LBP (PAGE_AGE_TRGT_MCR) = 240 Log pages during index build (LOGINDEXBUILD) = OFF
------------------------------
SangGyu Jeong
Software Engineer
Infrasoft
Seoul Korea, Republic of
Original Message:
Sent: Wed March 18, 2020 07:41 AM
From: YATHENDRA PRASAD
Subject: DB2 CREATE DATABASE WITH PAGESIZE
Hi ,
Is there any provision to create database with pagesize with db2 docker image . I am using in my deployment and running it as a pod . So i would like my deployment to create database with the pagesize option .
CREATE DATABASE TESTDB COLLATE USING SYSTEM PAGESIZE 32768
------------------------------
YATHENDRA PRASAD
------------------------------
#Db2