RedHatEnterpriseLinux5.4 or manually install DB2V9.7

Source: Internet
Author: User
Tags db2 client db2 installation
For DB2 installation in Linux (RedHatEnterpriseLinux5.4), you can use the GUI or manually install it. First, we will introduce the simplest installation method. 1. Download DB29.7expressC from the IBM Website: file name db2exc_9720.lnx_x86.tar.gz ,. 2.decompress and unpackage #gzip-ddb2exc_971_lnx_x86.tar. g in Linux

DB2 installation in Linux (RedHat Enterprise Linux 5.4) _ graphic interface

You can use the graphical interface or manually install the tool. First, we will introduce the simplest installation method.

1. Download DB2 9.7 express C from the IBM Website: file name db2exc_9720.lnx_x86.tar.gz ,.

2. decompress and unpackage in LINUX
# Gzip-d db2exc_9720.lnx_x86.tar.gz
# Tar-xvf db2exc_971_LNX_x86.tar

3. Go to the relevant directory and run the installation file.
# Xhost +
# Cd expc
#./Db2setup
Allow all users to use the xwindows interface first.
Find the db2setup file in the current directory and execute it.
If the permission is insufficient, run chmod + x db2setup first.

4. Install the SDK Based on the graphic interface
You can select the installation location or content.
In the process, you need to set the names and passwords of the three DB2 users and record them. Note that DB2 does not have its own user management system, so these users are actually LINUX users.
Complete the installation.

5. Verify that the installation is successful.
[Root @ bogon expc] # su-db2inst1
[Db2inst1 @ bogon ~] $ Db2 create database test
DB20000I The create database command completed successfully.
[Db2inst1 @ bogon ~] $
Db2inst1 is one of the three users created during the installation process, and is the administrator user of the instance.
If the database is successfully created, the installation is successful.

For more initial configurations, see Manual installation of DB2.

######################################## ################

Manual installation steps for DB2 for linux

Step 1 download db2 data packets
The latest version is 9.7. Download the free Express C version from the IBM website.
Db2exc_971_lnx_x86.tar.gzand the language package db2exc_nlpack_971_lnx_x86.tar.gz (optional ).

Step 2 upload the Installation File
Upload the downloaded package ftp to the LINUX machine to be installed

Step 3: Release db2exc_9720.lnx_x86.tar.gz
# Gzip-d db2exc_9720.lnx_x86.tar.gz
# Tar-xvf db2exc_971_LNX_x86.tar

Step 4 install
After the package is decompressed, the directory named expc is displayed. Find the db2_install and db2setup files. The former is manual installation, and the latter is graphical interface installation.
# Cd expc
#./Db2_install
After setting the installation directory, wait patiently for the installation task to complete.
The default installation path is/opt/ibm/db2/V9.7, which can be checked.


Step 5 register license
This step is not required for this installation.
For enterprise edition and other versions, you must register a license to use it.
For V8.1 ESE, the license registration file is:/opt/DB2_V81_PE_LNX_32_NLV/db2/license/db2ese. lic. Otherwise, you need to find db2ese. lic by yourself,
Based on actual conditions
#/Opt/IBM/db2/V8.1/adm/db2licm-a/opt/334_ESE_LNX26_32_NLV/db2/license/db2ese. lic
If the prompt is:
DBI1402I License added successfully.
DBI1426I This product is now licensed for use as specified in
The License Acceptance and License Information
Documents pertaining to the licensed copy of this
Product. USE OF THE PRODUCT CONSTITUTES ACCEPTANCE
THE TERMS OF THE IBM LICENSE ACCEPTANCE AND LICENSE
Information documents, LOCATED IN THE FOLLOWING
DIRECTORY:/opt/IBM/db2/V8.1/license/zh_CN.utf8
Indicates registration successful

Step 6: create user groups and users required for running DB2
Note that DB2 does not have an independent user management system. You must use OS users to provide security authentication. Therefore, you must create LINUX users and groups here.
# Groupadd-g 901 db2grp
# Groupadd-g 902 db2fgrp
# Groupadd-g 903 db2agrp # useradd-g db2grp-u 801-d/home/db2inst1-m-s/bin/sh db2inst1
# Useradd-g db2fgrp-u 802-d/home/db2fenc-m-s/bin/sh db2fenc
# Useradd-g db2agrp-u 803-d/home/db2das-m-s/bin/sh db2das
The Default User Name here is:
DAS user dasusr1 group name: dasadm1
User db2inst1 group name for instance management: db2iadm1
Protected user db2fenc1 group name: db2fadm1
However, DB2 users can name it at will.

Step 7 Add a password
# Passwd db2inst1
Changing password for db2inst1.
New password: [enter a New password]
Re-enter new password: [enter the new password again]
Password changed
After the user is created, run the following command to check whether the user group and user are created successfully.
# More/etc/group | grep db2
# More/etc/passwd | grep db2
If the result contains the three users and groups, the creation is successful. The correct result should be:
# More/etc/group | grep db2
Dialout: x: 16: db2inst1, db2fenc, db2das
Video: x: 33: db2inst1, db2fenc, db2das
Db2grp :! : 901:
Db2fgrp :! : 902:
Db2agrp :! : 903:
# More/etc/passwd | grep db2
Db2inst1: x: 801: 901:/home/db2inst1:/bin/sh
Db2fenc: x: 802: 902:/home/db2fenc:/bin/sh
Db2das: x: 803: 903:/home/db2das:/bin/sh


Step 8: Create an instance.
B1. go to the/opt/ibm/db2/V9.7/instance directory.
# Cd/opt/ibm/db2/V9.7/instance
2. Run the following command:
#./Dascrt-u db2das
#./Db2icrt-u db2inst1 db2inst1
Here, dascrt creates the DB2 adminstration server. Each server has only one such server, which is required for DB2 management (such as the Operation Control Center) and specifies that the management user is db2das.
Db2icrt creates an instance. Its name is generally the same as that of the Management User Name. Here it is db2inst1.
3 Start DB2
Switch to the db2das user and run db2admin to start the DB2 management server.
$ Db2admin start
Switch to the db2inst1 user and run db2start to start the database instance.
$ Db2start


Step 9 configure DB2
1. Set DB2 to start automatically.
Run the following command as the root user:
# Cd/opt/ibm/db2/V9.7/instance
#./Db2iauto-on db2inst1
Set to automatically start db2inst1 when LINUX is started.

2. Configure the network
Switch to the db2inst1 user.
# Su-db2inst1
Modify the service port of DB2 to 50000. The default port is 50000.
$ Db2 update dbm cfg using SVCENAME 50000
DB20000I The update database manager configuration command completed
Successfully.
Modify the DB2 connection mode to TCPIP, and then access the database on the DB2 server through JDBC, ODBC, and other machines installed on the DB2 client to access the database.
$ Db2set DB2COMM = TCPIP
So far, the installation process is complete.

Step 10 create and access the database, install and verify
1. Start and close a database instance
Before doing anything, start the database instance
Switch to the db2inst1 user and run db2start to start the database instance.
$ Db2start
SQL1063N DB2START processing was successful.
If necessary, run the following command to close the database instance.
First, force close all applications on the instance under the user db2inst1.
$ Db2 force applications all
Shut down the database instance.
$ Db2stop
SQL1064N DB2STOP processing was successful.
2. Create a database
$ Su-db2ins1
$ Db2 create database test1
DB20000I The create database command completed successfully.
The database is created successfully.
3. Remote database access
The author installed RHEL5.4 and DB2 on the vmwarevm and installed DB2 ESE for windows V9.7 on the host. After experiment configuration, the host can access the DB2 database on the VM. Run db2cmd on the host and then run:

C: \ Documents ents and Settings \ Administrator> db2 catalog tcpip node bogon remote 192.
168.211.132 server 50000
The DB20000I catalog tcpip node command is successfully completed.
DB21056W does not take effect until the directory cache is refreshed.

C: \ Documents ents and Settings \ Administrator> db2 catalog database test1 as test_1
Node bogon
The DB20000I catalog database Command is successfully completed.
DB21056W does not take effect until the directory cache is refreshed.

C: \ Documents ents and Settings \ Administrator> db2
? Copyright IBM Corporation 1993,2007
DB2 client 9.7.0 command line Processor

You can issue Database Manager commands and SQL statements from a command prompt. For example:
Db2 => connect to sample
Db2 => bind sample. bnd

For general help, enter :?.
For Command help, enter :? Command, where command can be
The first few keywords of the Database Manager Command. For example:
? Catalog database is used to help with the catalog database Command
? CATALOG is used to help all CATALOG commands.

To exit the db2 interaction mode, enter
QUIT. In non-interactive mode, all commands must be prefixed with "db2.
To LIST the settings of the current command options, enter list command options.

For more help, see Online Reference Manual.

Db2 =>! Db2set
DB2INSTOWNER = WWW-A448048D8D7
DB2PORTRANGE = 60000: 60003
DB2INSTPROF = C: \ DOCUMENTS ents and settings \ all users \ application data \ IBM \ DB2 \ DB2COPY
1
DB2COMM = TCPIP
Db2 => connect to test_1 user db2inst1
Enter the current password of db2inst1:

Database connection information

Database Server = DB2/LINUX 9.7.1
SQL authorization id = DB2INST1
Local Database alias = TEST_1

Db2 =>
######################################## #############

DB2 for linux uninstall

For some reason, to uninstall DB2 and reinstall it, you must completely uninstall DB2. Otherwise, you cannot reinstall or reinstall the installed DB2.
Because the uninstallation steps are complex, I suggest you install the software on a virtual machine. You should first take a snapshot before proceeding. If an error occurs, the snapshot will be restored and you will be taken again. If you detach an ECS instance from the host, make a backup first, just in case.
For ease of operation, you can open several shells at the same time, which belong to different users and complete the following operations.

1. General process of uninstalling DB2 on linux:
A. Delete all databases. You can use the "control center" or drop database Command to delete a database. I uninstalled the database but did not delete it. The result is that a database with the same name cannot be created after the re-installation.
B. Stop the DB2 management server.
C. Stop the DB2 instance.
D. Remove the DB2 management server.
E. Remove the DB2 instance.
F. Remove DB2 products.

2. Stop the DB2 Management Server:
You must stop the DB2 Management Server to uninstall DB2 on linux.
A. log in as the DB2 management server owner.
B. Run the db2admin stop command to stop the DB2 management server.

3. Stop a DB2 instance:
You must stop the DB2 instance to uninstall DB2 on linux.
A. Log On As a user with root user permissions.
B. Enter the/opt/ibm/db2/V9.7/bin/db2ilist command to obtain the names of all DB2 instances on the system.
C. log out.
D. log in as the owner of the instance to be stopped.
E. Go to the user's home directory and run the Script:. sqllib/db2profile.
D. Run the db2 force application all command to stop all database applications.
E. Enter the db2stop command to stop the DB2 database manager.
F. Enter db2 terminate to confirm that the DB2 database manager is stopped.
G. Repeat the preceding steps for each instance to be deleted.

4. Delete the DB2 Management Server:
You must delete the DB2 Management Server to uninstall DB2.
A. log in as the DB2 management server owner.
B. Go to the user's home directory and run the Script:. das/dasprofile.
C. log out.
D. Log On As the root user and run the/opt/ibm/db2/V9.7/instance/dasdrop command to remove the DB2 management server.

5. delete a DB2 instance:
Once an instance on the system is deleted, all DB2 databases under the instance will be unavailable.
A. Enter/opt/ibm/db2/V9.7/instance/db2idrop db2instname to delete the instance.

6. Uninstall DB2 Products
Log in as root and find the db2_deinstall command under the root directory or DB2 Installation File (usually the tar unpack file) on the DB2 CD-ROM,
Run the db2_deinstall-a command to delete all DB2 products.
You may need to enter the DB2 installation path. Here is/opt/ibm/db2/V9.7.
You can also delete DB2 users in LINUX. This is not required. You can still use them after reinstallation.

The following is a brief description in English:
Following are the steps to remove DB2 from Unix/Linux:

1. Remove DB [delete database first]

(1) su-db2inst1
(2) db2 list db directory
(3) db2 drop db

2. Remove Instance [Delete Instance]

(1) su-root
(2) cd /Instance
(3)./db2ilist
(4)./db2idrop-f

3. Remove das [Delete das]

(1) su-root
(2) cd /Instance
(3)./daslist
(4)./dasdrop

4. Uninstall [Uninstall]

(1) su-root
(2) cd /Install
(3)./db2_deinstall-

5. Remove user (db2inst1, db2fenc1, dasusr1) [delete user]

Userdel-r
Please lookinto the file/etc/passwd before and after you deleted users

######################################## ################

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.