DB2 V9.7 Linux installation records

Source: Internet
Author: User
Tags db2 client db2 installation

DB2 V9.7 Linux installation record
 
DB2 installation under Linux (RedHat Enterprise Linux 5.4) __ using a graphical interface
 
You can use either a graphical interface or a manual installation. Let's start with the simplest installation method.
 
1. Download the DB2 9.7 express C version from the IBM website: the file name db2exc_971_LNX_x86.tar.gz.
 
2. Decompress and unpack under LINUX
#gzip -d db2exc_971_LNX_x86.tar.gz
 
#tar -xvf db2exc_971_LNX_x86.tar
 
3. Enter 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 permissions are not enough, run chmod +x db2setup first.
 
4. Install according to the graphical interface
You can choose where to install or content.
The name and password of the three DB2 users need to be set and recorded. Note that DB2 does not have its own independent user management system, so these users are actually LINUX users.
Finally complete the installation.
 
5. Verify that the installation was successful.
[root@bogon expc]# su - db2inst1
[db2inst1@bogon ~]$ db2 create database test
DB20000I The CREATE DATABASE command completed successfully.
[db2inst1@bogon ~]$ -www.2cto.com-
Db2inst1 is one of the three users created during the installation process and is the administrator user of the instance.
A successful database creation indicates that the installation was successful.
 
See the DB2 manual installation for more initial configuration.
 
############################################################################# ######
 
DB2 for linux manual installation steps
 
The first step is to download the db2 packet.
The current version is 9.7, download the free Express C version from the IBM website.
Db2exc_971_LNX_x86.tar.gz and the language pack db2exc_nlpack_971_LNX_x86.tar.gz (the latter optional).
 
The second step is to upload the installation file.
Upload the downloaded package ftp to the LINUX machine to be installed.
 
The third step is to unpack db2exc_971_LNX_x86.tar.gz
# gzip -d db2exc_971_LNX_x86.tar.gz
# tar -xvf db2exc_971_LNX_x86.tar
 
The fourth step of installation
After unpacking, there will be a directory named expc, and the db2_install and db2setup files will be found. The former is manually installed and the latter is installed graphically.
#cd expc
#./db2_install
After setting the installation directory, etc., 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 the license
This installation does not require this step.
For the enterprise version and other versions, you need to register a license to use.
For the V8.1 ESE version, the file for registering the license is generally: /opt/DB2_V81_PE_LNX_32_NLV/db2/license/db2ese.lic, otherwise you need to find db2ese.lic yourself.
According to the actual situation
#/opt/IBM/db2/V8.1/adm/db2licm -a /opt/334_ESE_LNX26_32_NLV/db2/license/db2ese.lic
If prompted:
DBI1402I License added successfully. -www.2cto.com-
DBI1426I This product is now licensed for use as specified in
The License Acceptance and License Information
Documents leavinging to the licensed copy of this
Product. USE OF THE PRODUCT CONSTITUTES ACCEPTANCE OF
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 successful registration
 
Step 6 Create the user groups and users required for DB2 to run.
Note that DB2 does not have a separate user management system, you must borrow OS users to provide security authentication, so you need to create LINUX users and groups.
# 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 username here is:
DAS user dasusr1 group name: dasadm1
User who manages the instance db2inst1 Group name: db2iadm1
Protected user db2fenc1 Group name: db2fadm1
But DB2 users can name them arbitrarily.
 
Step 7 Add a password
# passwd db2inst1
Changing password for db2inst1.
New password: [enter new password]
Re-enter new password: [enter new password again]
Password changed -www.2cto.com-
After the creation is complete, run the following command to check whether the user group and user are successfully created.
# more /etc/group |grep db2
# more /etc/passwd |grep db2
If the three users and groups are included in the result, 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
 
The eighth step creates an instance.
B1. Enter the /opt/ibm/db2/V9.7/instance directory
# cd /opt/ibm/db2/V9.7/instance
2. Execute 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 running the Control Center), and specifies that its administrative user is db2das.
The db2icrt creates an instance with the same name as the administrative user name, both of which are db2inst1.
3 Start DB2
Switch to the db2das user and execute db2admin to start the DB2 management server.
$ db2admin start
Switch to the db2inst1 user and execute db2start to start the database instance.
$ db2start
 
Step 9 Configure DB2
1 Set DB2 to start automatically.
Use the root user to execute the following command:
# cd /opt/ibm/db2/V9.7/instance
# ./db2iauto -on db2inst1
The setting starts automatically for db2inst1 when LINUX starts.
 
2 Configuring the network
Switch to the db2inst1 user.
# su - db2inst1
Modify the service port of DB2 to 50000, where the default port is 50000.
$ db2 update dbm cfg using SVCENAME 50000
DB20000I The UPDATE DATABASE MANAGER CONFIGURATION command completed
Successfully. -www.2cto.com-
Modify the DB2 connection mode to TCPIP, and then access the database on the DB2 server through JDBC, ODBC, etc., and other machines that have the DB2 client installed can also access the database.
$ db2set DB2COMM=TCPIP
At this point, the installation process is over.
 
Step 10 Create and access the database, install verification
1 Start and shut down the database instance
Before doing anything, first start the database instance
Switch to the db2inst1 user and execute db2start to start the database instance.
$ db2start
SQL1063N DB2START processing was successful.
If necessary, run the following command to close the database instance
First, forcibly close all applications on the instance under the db2inst1 user.
$ db2 force applications all
Close 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 was created successfully.
3 remote access to the database
I installed RHEL5.4 and DB2 on the VMWARE virtual machine. DB2 ESE for windows V9.7 is also installed on the host. After the experiment is configured, the host can access the DB2 database on the virtual machine. The method is to run db2cmd on the host and then run:
 
C:\Documents and Settings\Administrator>db2 catalog tcpip node bogon remote 192.
168.211.132 server 50000
DB20000I CATALOG TCPIP NODE command completed successfully.
DB21056W Directory changes do not take effect until the directory cache is refreshed.
 
C:\Documents and Settings\Administrator>db2 catalog database test1 as test_1 at
Node bogon -www.2cto.com-
DB20000I The CATALOG DATABASE command completed successfully.
DB21056W Directory changes do not take effect until the directory cache is refreshed.
 
C:\Documents and Settings\Administrator>db2
© Copyright IBM Corporation 1993, 2007
Command line processor for DB2 client 9.7.0
 
Database manager commands and SQL statements can be issued from a command prompt. E.g:
Db2 => connect to sample
Db2 => bind sample.bnd
 
For general help, type: ?.
To get help with the command, type: ? command, where command can be
The first few keywords of the database manager command. E.g:
CATALOG DATABASE for help with the CATALOG DATABASE command
• CATALOG is used for help with all CATALOG commands.
 
To exit db2 interaction
Way, type at the command prompt
QUIT. In non-interactive mode, all commands must be prefixed with "db2".
To list the current command option settings, enter LIST COMMAND OPTIONS.
For more detailed help, see the Online Reference Manual.
 
Db2 => !db2set
DB2INSTOWNER=WWW-A448048D8D7
DB2PORTRANGE=60000:60003
DB2INSTPROF=C:\DOCUMENTS AND SETTINGS\ALL USERS\APPLICATION DATA\IBM\DB2\DB2COPY
1
DB2COMM=TCPIP -www.2cto.com-
Db2 => connect to test_1 user db2inst1
Enter the current password for 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 re-install, be sure to uninstall DB2 completely, otherwise DB2 cannot be reinstalled or installed.
Because the uninstallation process is more complicated, I suggest that friends who install the software on the virtual machine should make a snapshot before they can proceed. If the error occurs, the snapshot will be restored and it will be re-applied. To uninstall on the host, it is best to make a backup first, just in case.
For the convenience of operation, several shells can be opened at the same time, belonging to different users, and the following operations are completed.
 
1, the general process of uninstalling DB2 on Linux:
a. Delete all databases. You can use the Control Center or the drop database command to drop a database. The author uninstalled and did not delete the database. The result was that the database with the same name could not be created after reinstallation.
b. Stop the DB2 management server. -www.2cto.com-
c. Stop the DB2 instance.
d. Remove the DB2 management server.
e. Remove the DB2 instance.
f. Remove the DB2 product.
 
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. Stop the DB2 management server with the db2admin stop command.
 
3. Stop the DB2 instance:
You must stop the DB2 instance to uninstall DB2 on Linux.
a. Log in as a user with root privileges.
b. Enter the /opt/ibm/db2/V9.7/bin/db2ilist command to get the names of all DB2 instances on the system.
c. Logout.
d. Log in as the owner of the instance you want to stop.
e. Enter the user's home directory and run the script: sqllib/db2profile
d. Enter the db2 force application all command to stop all database applications.
e. Enter the db2stop command to stop the DB2 database manager. -www.2cto.com-
f. Enter db2 terminate to confirm that the DB2 database manager has stopped.
g. Repeat the above steps for each instance you want to delete.
 
4. Delete the DB2 management server:
The DB2 management server must be removed 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. Logout.
d. Log in as root and remove the DB2 management server by entering the command /opt/ibm/db2 /V9.7/instance/dasdrop.
 
5, delete the DB2 instance:
Once an instance on the system is deleted, all DB2 databases under that instance will be unavailable.
a. Delete the instance by typing /opt/ibm/db2 /V9.7/instance/db2idrop db2instname.
 
6, uninstall DB2 products
Log in as root and find the db2_deinstall command under the root directory of the DB2 version product CD-ROM or the DB2 installation file (usually the tar unpacking file).
Run the db2_deinstall -a command to remove all DB2 products.
You may need to enter the DB2 installation path, here is /opt/ibm/db2/V9.7
You can then also remove DB2 users in Linux, which is not required and you can still use them after reinstalling.
 
The following is a brief description of the English:
Following are the steps to remove DB2 from Unix/Linux:
 
1.Remove DB [first delete the database]
 
(1)su - db2inst1 -www.2cto.com-
(2) db2 list db directory
(3) db2 drop db <db name>
 
2.Remove Instance [Delete Instance]
 
(1)su - root
(2)cd <db2 dir>/instance
(3)./db2ilist
(4)./db2idrop -f <instance name>
 
3.Remove das [delete das]
 
(1)su - root
(2)cd <db2 dir>/instance
(3)./daslist
(4)./dasdrop <das user>
 
4.Uninstall [Uninstall]
 
(1)su - root
(2)cd <db2 dir>/install
(3)./db2_deinstall -a
 
5.Remove user ( db2inst1, db2fenc1, dasusr1) [delete user]
 
Userdel -r <username>
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.