Detailed steps to install DB2 V9.7 (64-bit) on SuSE11

Detailed steps to install DB2 V9.7 (64-bit) on SuSE11

Category: Database Development Technology

2015-05-18 10:18:20

 

Detailed steps to install DB2 V9.7 ( 64 -bit) on SuSE11

 

 

1 Install db2

Copy the installation file db2exc_970_LNX_x86_64.tar of db2 V9.7 to the SUSE desktop, move the location and decompress it

# mv /root/Desktop/db2exc_970_LNX_x86_64.tar.gz /root/software/

#

cd /root/software/

tar -zxvf db2exc_970_LNX_x86_64.tar.gz

# cd expc/

# ls

db2            db2ls           doc             readmefirst.htm

db2_deinstall  db2prereqcheck  installFixPack  readmefirst.txt

db2_install    db2setup        readmefirst

 

Here db2_install is installed with the command line, and db2setup is installed with the interface.

 

# ./db2_install

 

When prompted "Do you want to select another directory for installation? [Yes/No]", select No, and it will be installed in the /opt/ibm/db2/V9.7 directory by default.

 

After a few minutes, you will see a prompt that the DB2 installation is successful.

 

2 Create db2inst1 and db2fenc1 users

#

groupadd db2grp

useradd -d /home/db2inst1 -g db2grp -m db2inst1

groupadd db2fgrp

useradd -d /home/db2fenc1 -g db2fgrp -m db2fenc1

# passwd db2inst1

# passwd db2fenc1

 

If the password input here is too simple, such as 123456, there will be a warning of "invalid password: too simple", but it will not affect the use.

 

3 Create a db2 instance

#

cd /opt/ibm/db2/V9.7/instance/

./db2icrt -u db2fenc1 db2inst1

 

After a few minutes, you will be prompted that the creation was successful

DBI1070I  Program db2icrt completed successfully

 

4 Change user and create database

# su - db2inst1

start the database

~> db2start

Soon you will see the prompt that the database started successfully

DB20000I  The DB2START command completed successfully.

 

Enter the db2 environment

~> db2

db2 =>

 

create database

db2 => create database mydb

After a few minutes, there will be a notification that the creation was successful

DB20000I  The CREATE DATABASE command completed successfully.

 

Connect to the database

db2 => connect to mydb

The connection is successful later

   Database Connection Information

 

 Database server        = DB2/LINUXX8664 9.7.0

 SQL authorization ID   = DB2INST1

 Local database alias   = MYDB

 

5 Create table and insert data

db2 => create table test_table(id integer, name varchar(20))

DB20000I  The SQL command completed successfully.

 

db2 => insert into test_table values(1, 'Zheng')

DB20000I  The SQL command completed successfully.

 

db2 => insert into test_table values(2, 'Lin')

DB20000I  The SQL command completed successfully.

 

db2 => select * from test_table

ID          NAME               

----------- --------------------

          1 Zheng              

          2 Lin                

 

  2 record(s) selected.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324928269&siteId=291194637