But first, I'll create the db2inst1 user (Db2 Instance user).
# Create the dba group groupadd dba # Create the db2inst1 user and assign it to the Dba group. /usr/sbin/useradd -d /home/db2inst1 -g dba -s /bin/bash db2inst1
As root we execute the db2icrt command to create the instance.
cd /opt/ibm/db2/V11.5/instance [email protected]: /opt/ibm/db2/V11.5/instance> $ ./db2icrt -u db2inst1 db2inst1 DBI1446I The db2icrt command is running. DB2 installation is being initialized. Total number of tasks to be performed: 4 Total estimated time for all tasks to be performed: 309 second(s) Task #1 start Description: Setting default global profile registry variables Estimated time 1 second(s) Task #1 end Task #2 start Description: Initializing instance list Estimated time 5 second(s) Task #2 end Task #3 start Description: Configuring DB2 instances Estimated time 300 second(s) Task #3 end Task #4 start Description: Updating global profile registry Estimated time 3 second(s) Task #4 end The execution completed successfully. For more information see the DB2 installation log at "/tmp/db2icrt.log.95716". DBI1070I Program db2icrt completed successfully.
and that's it. The instance has been created successfully.
Now, we can su to the Db2 instance user (db2inst1) and execute db2level to see the Db2 version (v11.5 fp0).
$ su - db2inst1 [email protected]: /home/db2inst1> $ db2level DB21085I This instance or install (instance name, where applicable: "db2inst1") uses "64" bits and DB2 code release "SQL11050" with level identifier "0601010F". Informational tokens are "DB2 v188.8.131.52", "s1906101300", "DYN1906101300AMD64", and Fix Pack "0". Product is installed at "/opt/ibm/db2/V11.5".
and we can create the SAMPLE database.
[email protected]: /home/db2inst1> $ db2sampl Starting the DB2 instance... Creating database "SAMPLE"... Connecting to database "SAMPLE"... Creating tables and data in schema "DB2INST1"... Creating tables with XML columns and XML data in schema "DB2INST1"... Stopping the DB2 instance... 'db2sampl' processing complete.
and once created, we can start the db2 instance and connect to the database.
[email protected]: /home/db2inst1> $ db2start 02/20/2020 16:42:08 0 0 SQL1063N DB2START processing was successful. SQL1063N DB2START processing was successful. [email protected]: /home/db2inst1> $ db2 connect to sample Database Connection Information Database server = DB2/LINUXX8664 184.108.40.206 SQL authorization ID = DB2INST1 Local database alias = SAMPLE