The following article describes how to create a second DB2 instance in the command line status in the DB2 database under the linux operating system, the following describes the actual operation steps for creating a DB2 instance. We hope this will help you in your future study.
In DB2 in linux, create the second DB2 instance DB2inst2 in the command line state
This entire process was the first time that DB2 was required to do it. At that time, the DB2 installation file was not found, so I searched for some information on the Internet and then found it myself, if any omission or error occurs, please do not hesitate to inform us.
It is best to use the DB2 Installation File to create the second instance, which is convenient and will not cause errors. The following is a stupid method ~)
First, the original DB2 information of the system,
Installation Directory:/opt/IBM/DB2/V8.1
DB2inst1 instance Directory:/home/DB2inst1
Create a DB2inst2 instance:
1. First create the instance directory:
(View the available disk space before creation to make sure the remaining space is sufficient. Run the command df-k ))
- cd /home
- mkdir DB2inst2
2. Create instance users and groups for the DB2inst2 instance:
Create group:
- groupadd DB2inst25 O:
Create user DB2inst2, Set User main directory, set primaryGroup to DB2grp1: useradd -- help to view parameters) useradd-m-d/home/DB2inst2-s/bin/bash-g DB2grp1-G DB2inst2 DB2inst2
If you do not know your password, run passwd-d DB2inst2 under the root user to delete the password of DB2inst2, and then return the passwd: Success in plaintext.
Then, under DB2inst2, run passwd to change the password. First, enter the current password: Success)
3. Create an instance
Create DB2 instance DB2inst2:
- ./DB2icrt -u DB2inst2 DB2inst2
4. create databases and tables
Create a database gpending:
If the database directory you want to create is your own directory, You need to first create that directory and set the owener of the directory to DB2inst2)
Database creation command:
- DB2 create db gpending on /home/DB2inst2/pending using codeset UTF-8 territory US
(In the database directory/home/DB2inst2/pending in this command,/pending is the directory set by the user. Therefore, you need to modify the permission chown-R DB2inst2: DB2grp1 pending)
Then run DB2
Go to the DB2 command line and connect to gpending to return the database connection information.
Database Server = DB2/LINUX 8.2.7
SQL authorization id = DB2INST2
Local Database alias = GPENDING
The local connection to the database is successful.
The table creation statement is not described.
DB2 command list tables for all
All tables can be returned, including the created tables)