In linux, how does one implement a DB2 instance in the command line state in DB2? (1)

Source: Internet
Author: User
Tags db2 installation

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 ))

 
 
  1. cd /home  
  2. mkdir DB2inst2  

2. Create instance users and groups for the DB2inst2 instance:

Create group:

 
 
  1. 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:

 
 
  1. ./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:

 
 
  1. 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)


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.