Revision History | ||
---|---|---|
Revision 1.2.6 | 2002-09-21 | Revised by: dbs |
Add Mandrake 8.1, SuSE 7.3 install instructions from contributor Mykola Buryak. | ||
Revision 1.2.5 | 2002-07-16 | Revised by: dbs |
Fixed or removed some broken links, added a few new resources. | ||
Revision 1.2.4 | 2001-06-02 | Revised by: dbs |
Running JDK 1.1.8 on Red Hat 7.1 | ||
Revision 1.2.3 | 2001-04-25 | Revised by: dbs |
Red Hat 7.1 install instructions, more DB2 on Debian info, connecting to AS/400 databases, buffer pool memory limits, converted to DocBook XML. | ||
Revision 1.2.1 | 2000-10-25 | Revised by: dbs |
Basic Red Hat 7.0 info, additional Debian instructions. | ||
Revision 1.2 | 2000-09-25 | Revised by: dbs |
IBM JDK 1.3 works! More troubleshooting. | ||
Revision 1.1 | 2000-07-28 | Revised by: dbs |
Documented _SHM_ID_BITS kernel parameter tuning for increasing number of available connections. Added basic indexing. | ||
Revision 1.0 | 2000-07-06 | Revised by: dbs |
Added basic Debian instructions. Corrected some factual, stylistic, and grammatical mistakes. Licensed document under GNU GPL. Submitted document to LDP. | ||
Revision 0.7 | 2000-04-26 | Revised by: dbs |
Based on DB2 V7.1 beta release, wrote install instructions for Caldera 2.4, Red Hat 6.2, SuSE 6.2, SuSE 6.3, and TurboLinux 6.0. |
For Debian and Slackware, I have included very basic installation instructions or links to other resources in Section 5. If you have any other installation success stories, please forward me the details and I'll try to expand the section. As time permits, I plan to try to duplicate and confirm these installation instructions.
If you install DB2 Version 6.1 for Linux and DB2 hangs on the db2start command, see db2start hangs on Linux distributions built with glibc 2.1. I don't include any other DB2 Version 6.1 information in this document. If you plan to install DB2 Version 5.2 on Linux, don't! (Have I emphasized that point enough? All right, I'll stop now.) The Personal Developer's Edition of DB2 Version 7.1 is available as a free (beer) download from IBM, at the DB2 Universal Database download site. Registration is required, and, of course, your copy of DB2 is only free as long as you don't use it in a production environment.
This document is really meant to help you install DB2 Version 7.1 on the previously listed Linux distributions. I've installed DB2 on all of the distributions supported by IBM and noted the prerequisites and quirks for each of them. I don't go into detail about the various features of DB2, or what each installation option means, but I do cover the basics that you need to know to get it installed.
I like my friends at the Linux Documentation Project, so you'll always be able to find the most up-to-date version of this document at the LDP web site.
Dan Scott is the originator and current maintainer of this HOWTO. Please send all suggestions for improvement, criticisms, or more-or-less related questions to me at <dan.scott@REMca.ibm.com> (remove REM in my email address before sending). Please send all spam or hate mail to /dev/null.
Feedback and suggestions for improvement have been provided by Susan Williams, Serge Boivin, Darin McBride, and Xiaoyan Zhao. Ronnie Seagren did an awesome job of editing the original version for style and consistency.
Additional thanks to:
Andika Triwidada for contributing instructions to install DB2 V7.1 on Debian using the rpm utility.
Michael Naughton for braving Red Hat 7 and figuring out the libncurses.so.4 prerequisite.
Christoph Shmitz for resolving license problems with DB2 installed via alien.
Claus Fischer for solving a DB2 on Debian problem with updating instances and contributing cataloging instructions for DB2 on AS/400.
Mykola Buryak <m.b.@gmx.co.uk> for contributing the sections on Mandrake Linux 8.1 and SuSE 7.3.
Prerequisites are what you, your machine, and your distribution require before you will be able to successfully install or use DB2. The required prerequisites come straight from IBM DB2 Universal Database for UNIX Quick Beginnings. The suggested prerequisites come from experience. For your convenience, I've divided them into hardware and software requirements.
Hardware prerequisites
x86 compatible (for example, Intel, AMD, or Cyrix). I've successfully installed DB2 Version 7.1 on a Pentium Pro 200 and a Pentium II 350. Your experiences with other x86 processors would be appreciated.
For application development, I've found 96 MB of RAM is enough to run a small database and test out your applications. Even the Control Center responds acceptably if your processor speed is fast enough. In my case, I was working with a Thinkpad 600 equipped with a Pentium 233 MMX processor and 96 MB of RAM. However, more memory is recommended if you're putting your database into production or running multiple services.
Of course, this depends on the components you install, but for a typical installation of the DB2 Version 7.1 server, the Administration Client, the Application Development Client, the documentation, and the creation of a sample database, you will need about 350 MB of free disk space.
Software prerequisites
2.1.2 or greater. This can be a tough part of Linux to upgrade on its own, so if your current distribution doesn't meet this requirement, I would strongly suggest upgrading your entire distribution. For example, I tried upgrading only the glibc portion of TurboLinux 4.0 from 2.1.1 to 2.1.3 and ran into a whole world of trouble.
DB2 Version 7.1 should work with glibc 2.1.1. IBM sets prerequisites based on the systems with which they tested.
2.2.12 or greater. I've upgraded to both 2.2.19 and 2.4.3 and recompiled the kernel for my own purposes, and DB2 seems to work as well as before.
DB2 Version 7.1 should work with a minimum of kernel 2.2.10. IBM sets prerequisites based on the systems with which they tested.
4.x. For db2setup to work correctly, this version of the library must be available on your system with the following pathname: /usr/lib/libncurses.so.4.
A file or symbolic link by this exact name is mandatory. On most distributions, this is a symbolic link to libstdc++-2.9.0.so, but on several recent distributions this is a symbolic link to libstdc++-2.10.0.so.
![]() | In previous versions of this HOWTO, I stated that the exact version of libstdc++-2.9.0.so was mandatory. I was wrong. |
5.2 or greater. This is a public domain version of the Korn shell that both the DB2 installer and the DB2 commands require. You cannot do anything with DB2 without installing pdksh.
3.0 or greater. DB2 for Linux is distributed as a number of RPM packages, so you won't get far without this piece of software. For information on installing DB2 on distributions without using RPM, see Section 5.
The IBM Developer Kit for Java, 1.1.8 or 1.3, is an optional component, but is required to:
use the DB2 Control Center to administer your databases using a graphical user interface
create or run Java applications, including stored procedures and user-defined functions
As of this writing, the minimum required level of the IBM Developer Kit for Java 1.1.8 is the March 22, 2000 release. You can get the IBM Developer Kit and Runtime Environment for Linux, Java Technology Edition, from the IBM Java Developer Kit downloads web site as follows:
Please note: Other versions of Java, such as the Blackdown or Sun JDKs, have not been tested with DB2 and are not supported by IBM. And no, none of the distributions I have seen so far package the IBM JDK. But do yourself a favour, and get the IBM Developer Kit for Java.
DB2 calls the netscape command when you:
display the online help for the DB2 Control Center
display information using the DB2 Information Center
To use a browser other than Netscape to display online help or information, create a link called netscape to your preferred browser executable. The link must appear in your PATH. For example, to display online help with mozilla, you could create a link in /usr/local/bin with the following command:
bash# ln -s /usr/bin/mozilla-bin /usr/local/bin/netscape |
In the following table:
unknown indicates that I don't know what the default level is, and I haven't installed DB2 on this distribution (your feedback is welcome!)
okay indicates that I don't know what the default level is, but it worked when I installed DB2
** as a prefix indicates that the default level is not acceptable and must be replaced or supplemented with a compatible library
Table 1. Prerequisite levels, by distribution
Distribution | glibc | Linux kernel | libncurses | libstdc++-libc6.1-1.so | pdksh | rpm |
---|---|---|---|---|---|---|
Caldera OpenLinux 2.4 | 2.1.2 | 2.2.14 | okay | 2.9.0 | 5.2.14 | okay |
Debian 2.2 | 2.1.3 | 2.2.17 | okay | 2.10.0 | 5.2.14 | 3.0.3 |
Mandrake Linux 7.2 | 2.1.3 | 2.2.17 | okay (4, 4.2, 5, & 5.1) | 2.9 | 5.2.14 | 3.0.5 |
Mandrake Linux 8.1 | 2.2.4 | 2.4.8 | 5.2 | 2.10 | 5.2.14 | 4.0.3 |
Red Hat 6.2 | 2.1.2 | 2.2.14 | okay | 2.9.0 | 5.2.14 | okay |
Red Hat 7 | 2.1.92 | 2.2.16 | **5.1 | **2.9.6 | 5.2.14 | 4.0 |
Red Hat 7.1 | 2.2.2 | 2.4.2 | **5.2 | **2.9.6 | 5.2.14 | 4.0.2 |
SuSE 6.2 | 2.1.1 | 2.2.10 | unknown | 2.9.0 | 5.2.14 | okay |
SuSE 6.3 | 2.1.2 | 2.2.13 | okay | 2.9.0 | 5.2.14 | okay |
SuSE 7.0 | unknown | 2.2.17 | okay | unknown | 5.2.14 | okay |
SuSE 7.3 | 2.2.4 | 2.4.10 | 4.2, 5.2 | 2.7.2, 2.8, 2.9 | 5.2.14 | 3.0.6 |
TurboLinux 6.0 | 2.1.2 | 2.2.13 | okay | 2.9.0 | 5.2.14 | okay |
This section contains instructions that you must follow before installing DB2.
Preparing for the installation of DB2
bash# rpm -ivh /mnt/cdrom/Packages/RPMS/pdksh-5.2.14-1.i386.rpm |
bash# rpm -e jdk |
Install the IBM Developer Kit for Java. A brief set of installation directions is included in Section 11.
Edit the JAVA_HOME and PATH entries in /etc/config.d/shells/bashrc to remove the references to the JDK from Sun and update them to reflect the IBM Developer Kit for Java. The section that I changed started as:
[ -z "$JAVA_HOME" ]&& [ -d /usr/java ] && ( export JAVA_HOME=/usr/java [ -r $JAVA_HOME/lib/classes.zip ] && export CLASSPATH=$JAVA_HOME/lib/classes.zip ) |
Replace it with the following section to reflect the default locations for the IBM Developer Kit for Java:
[ -z "$JAVA_HOME" ]&& [ -d /usr/jdk118 ] && ( export JAVA_HOME=/usr/jdk118 export PATH=$PATH:$JAVA_HOME/bin [ -r $JAVA_HOME/lib/classes.zip ] && export CLASSPATH=$JAVA_HOME/lib/classes.zip ) |
Follow the instructions in Section 4 the generic section on installing DB2, and go ahead and create the instances. It's probably a good idea at this point to read through Section 3.1.3 to keep in mind the steps that you need to take after installing DB2.
This section contains instructions that you must follow after installing DB2.
Preparing for the installation of DB2
bash# rpm -ivh /mnt/cdrom/Mandrake/RPMS/pdksh-5.2.14-8mdk.i586.rpm |
Otherwise, follow the instructions in Section 4, the generic section on installing DB2 and creating instances.
Preparing for the installation of DB2
bash# rpm ivh /mnt/cdrom/Mandrake/RPMS2/pdksh-5.2.14-12mdk.i586.rpm |
# Sets maximum number of message queues to 128 # Set this to 1024 or higher on production systems kernel.msgmni = 128 |
bash# rpm -ivh IBMJava118-SDK-1.1.8-5.0-i386.rpm |
java -fullversion |
bash# chmod ugo=rwx /home |
You must perform the following steps as a user with root authority.
Removing DB2 on Mandrake Linux 8.1
bash# /usr/IBMdb2/V7.1/instance/db2ilist |
bash# /usr/IBMdb2/V7.1/instance/db2idrop <instanse-name> |
bash# /usr/IBMdb2/V7.1/instance/dasidrop `/usr/IBMdb2/V7.1/instance/dasilist` |
bash# /mnt/cdrom/db72pf5u/db2_deinstall -n |
bash# userdel -r db2inst1 bash# .. bash# userdel -r db2instN bash# userdel -r db2fenc1 bash# .. bash# userdel -r db2fenc2 bash# userdel -r db2as |
Preparing for the installation of DB2
bash# rpm -ivh /mnt/cdrom/RedHat/RPMS/pdksh-5.2.14-2.i386.rpm |
Follow the instructions in Section 4, the generic section on installing DB2 and creating instances.
Preparing for the installation of DB2
bash# rpm -ivh /mnt/cdrom/RedHat/RPMS/pdksh-5.2.14-12.i386.rpm |
bash# rpm -ivh /mnt/cdrom/RedHat/RPMS/compat-egcs-c++-6.2-1.1.2.14.i386.rpm |
bash# rpm -ivh /mnt/cdrom/RedHat/RPMS/compat-libs-6.2-3.i386.rpm |
bash# ln -sf /usr/i386-glibc21-linux/lib/libncurses.so.4.0 /usr/lib/libncurses.so.4 |
# Sets maximum number of message queues to 128 # Set this to 1024 or higher on production systems kernel.msgmni = 128 |
Follow the instructions in Section 4, the generic section on installing DB2 and creating instances.
bash$ export LD_ASSUME_KERNEL=2.2.5 bash$ db2set DB2ENVLIST=LD_ASSUME_KERNEL bash$ db2jstrt 6790 bash$ db2cc 6790 |
With IBM JDK 1.3 (IBMJava2-SDK-1.3-7.0-i386.rpm), the DB2 Control Center started successfully without any workarounds. For instructions on installing the IBM JDK, see Section 11.
bash# userdel -r db2as bash# userdel -r db2fenc1 bash# userdel -r db2inst1 |
Follow the instructions in Section 4, the generic section on installing DB2.
Follow the instructions in Section 4, the generic section on installing DB2.
The purpose of this section is to walk you through a typical install of DB2 Version 7.1 on Linux. The following section, Section 6, tells you how to create both a DB2 Administration Server and a DB2 instance. For in-depth information on the components offered by DB2 Version 7.1, consult the following documents:
For the purposes of this document, I'll assume that you have a copy of DB2 Version 7.1 on CD-ROM. If you download a copy from IBM, just adjust the path /mnt/cdrom in the following instructions to reflect the directory created by the tar command.
![]() | Some distributions disable execute privileges on CD-ROM devices by default. To mount a CD-ROM with execute permissions at mount point /mnt/cdrom, issue the following command as root:
|
db2_deinstall: Use the db2_deinstall command to uninstall the DB2 Version 7.1 packages on your system. For more information, see Section 7.
![]() | The db2setup command provides a terminal-based text menu for your installation and instance creation options. Unfortunately, db2setup on Linux sometimes encounters a few formatting bugs in terminal emulators. Running db2setup from the TTY console works well. Within an X session, the rxvt or xterm terminals work quite well, but gnome-terminal is rather frustrating to use. If the text menu formats incorrectly, press CTRL-L to refresh the menu. |
The following instructions assume that you are using db2setup to install DB2.
To select or deselect a component, highlight the component using the cursor keys and press ENTER.
To change the options for a component, highlight [ Customize... ] and press ENTER.
To install your selected components, highlight [ OK ] on the Install DB2 V7 menu and press ENTER.
![]() | You probably want to install the Control Center. |
Adding one of these components requires about 40 MB of disk space.
![]() | If you plan on developing applications for DB2, install the sample applications. The sample directories in /usr/IBMdb2/V7.1/samples/ contain build scripts (bld***) that include the compile and link options suitable for your own applications. |
![]() | If you are trying to develop applications and you get an error like "That command is not supported in this environment" while trying to precompile a file, it's because you either did not install the Application Development Client, or you installed it after you created an instance and you have not used the db2iupdt command to update the instance. See Section 9.1 for more information on db2iupdt. |
Including the sample applications, this component requires about 10 MB of disk space.
Documentation is installed into the /usr/IBMdb2/V7.1/doc/ directory. For each language that you install, the DB2 installer creates a subdirectory with a five-character name corresponding to the language locale. Issue the db2help command to fire up your Web browser with a page that links to the documentation installed with DB2.
The English HTML (En_US) documentation requires about 90 MB of disk space.
DB2 Version 7.1 is distributed as a set of RPM packages. If you want to install DB2 on a distribution that is not officially supported by IBM, and that distribution satisfies all of the prerequisites specified in Section 2, all that you theoretically need to do is find a way to install those packages on your distribution. The alien utility available from Kite converts RPM packages into formats supported by Debian (dpkg), Stampede (slp), and Slackware (slp).
Susan Williams reported success in installing DB2 Version 7.1 on Debian using the following script as root:
Example 1. Installation script for DB2 Version 7.1 on Debian
#!/bin/bash cd / for f in /mnt/cdrom1/db2/*rpm do alien -d -i -c $f done |
This script installs every DB2 package on the CD-ROM. In a future iteration of this document I plan to provide a description of all of the DB2 packages to help you develop a more selective approach for your installation.
Christoph Shmitz reports that, while he was able to install DB2 Version 7.1 Personal Developer's Edition on Debian 2.2 using alien as described above, DB2 starts in a time-limited trial mode (90 days). While the use of DB2 Version 7.1 Personal Developer's Edition should be unlimited, alien does not automatically install the DB2 license file.
To remove the time limit on DB2 Version 7.1 Personal Developer's Edition, you need to manually install the license file (s000510.personal/db2/license/db2udbpe.lic in the tar archive) using the following command as root:
bash# db2licm -a db2udbpe.lic |
Using alien apparently prevents you from using the db2setup command to create instances. To create a DB2 Administration Server from the command line, issue the /usr/ibmdb2/v7.1/instance/dasicrt command as root. To create a DB2 instance, issue the /usr/ibmdb2/v7.1/instance/db2icrt command as root. To get the correct syntax for either command, use the -h flag.
In the following section, Andika Triwidada describes how to install DB2 on Debian 2.2 using the rpm command. You can check the prerequisite package levels (described in Section 2) installed on your system with the following command:
bash$ dpkg -l|egrep -e '(libc6|libstdc++|pdksh|rpm|zip)'|awk '{print $1,$2,$3}' |
ii libc6 2.1.3-13 ii libstdc++2.9-glibc2.1 2.91.66-4 ii pdksh 5.2.14-1 ii rpm 3.0.3-1 ii unzip 5.40-1 |
If you are missing any of these packages, you can install the package using apt-get:
bash# apt-get install package-name |
Installation Steps
Initialize the RPM database.
bash# rpm --initdb |
Modifiy several files in /bin
bash# mv /bin/sh /bin/sh.bash bash# ln -s /usr/bin/ksh /bin/sh bash# for f in awk basename ksh passwd sort touch; do ln -s /usr/bin/$f /bin/$f; done |
Copy the contents of the following script to create an RPM wrapper called /bin/rpm.
#!/bin/sh # RPM wrapper, force RPM installation without checking any dependencies if [ "$1" = "-ivh" ] then shift /usr/bin/rpm -ivh --nodeps $* else /usr/bin/rpm $* fi |
Make the RPM wrapper executable:
bash# chmod +x /bin/rpm |
Install DB2 using the db2setup command by following the instructions in Section 4.
Create the DB2 administration server and at least one DB2 instance as described in Section 6. To simplify testing, ensure that you create the sample database when you create the DB2 instance.
Testing your DB2 installation
Log on to your Linux server with the DB2 instance user ID. Remember, the default user ID is db2inst1.
Prepare your DB2 environment by running the db2profile script:
bash$ cd ~/sqllib bash$ . ./db2profile |
Run a query against the sample database to test your installation.
bash$ db2 bash$ db2 => connect to sample bash$ db2 => select * from employee |
bash$ db2 => quit |
After you install DB2
Remove the RPM wrapper script by removing, renaming, or linking it directly to /usr/bin/rpm.
bash# rm /bin/rpm |
Change /bin/sh back into a symlink to /usr/bin/bash.
bash# ln -sf /usr/bin/bash /bin/sh |
After installing DB2 with alien, Claus Reiner reported that:
Claus recommends running the following commands as root after installing DB2 with either alien or RPM,
bash# . $INSTANCEHOME/sqllib/db2profile bash# /usr/IBMdb2/V7.1/instance/db2iupdt -e |
creates one or more new user IDs and corresponding home directories
creates a subdirectory in the instance home directory called sqllib
To quote the IBM DB2 Universal Database Version 7.1 Administration Guide definition of an instance:
What this boils down to is that for every DB2 instance, DB2 requires a unique user ID on your Linux workstation. Security for an instance is provided by the normal password authentication process for any Linux user ID. Each instance can contain one or more databases, each of which inherits settings from their instance.
Creating the Administration Server using db2setup
The DB2 Administration Server requires about 3 MB of disk space. The following steps guide you through the process of creating a DB2 Administration Server.
Select [ Create... ].
Select the check box for Create the Administration Server. The Administration Server window is displayed.
Enter a unique user name in the User Name field. You can use an existing user name that is not already in use by a DB2 instance, but it is probably simpler to create a new user for each instance.
Select the Use default UID check box. As far as I can tell, this setting is always right.
Enter a unique group name in the Group Name field. You can use an existing group name if you wish, but creating a new group ensures that you do not inadvertently give permissions to other users on your system.
Select the Use default GID check box. Again, as far as I can tell, this setting is always right.
Ensure that the value of the Home Directory field reflects the home directory of the user ID.
![]() | SuSE users: The prefix for the home directory may default to /usr/lib/db2/. This is almost certainly wrong; the value for a standard SuSE system should be /home/. |
Enter a unique password in the Password and Verify Password fields.
![]() | Enter a new password! If you do not enter a new password in these fields, DB2 assigns the default password ibmdb2, giving crackers a wide-open front door to your system. |
Creating a DB2 instance using db2setup
A DB2 instance requires about 2 MB of disk space. A sample database for a DB2 instance requires about 16 MB of disk space. The following steps guide you through the process of creating a DB2 instance.
Issue the db2setup command as described in Section 4.2.
Select [ Create... ].
Select the Create a DB2 Instance check box. The DB2 Instance window is displayed.
Enter a unique user name in the User Name field. You can use an existing user name that is not already in use by a DB2 instance, but it is probably simpler to create a new user for each instance.
Select the Use default UID check box. As far as I can tell, this setting is always right.
Enter a unique group name in the Group Name field. You can use an existing group name if you wish, but creating a new group ensures that you do not inadvertently give permissions to other users on your system.
Select the Use default GID check box. Again, as far as I can tell, this setting is always right.
Ensure that the value of the Home Directory field reflects the home directory of the user ID.
![]() | SuSE users: The prefix for the home directory may default to /usr/lib/db2/. This is almost certainly wrong; the value for a standard SuSE system should be /home/. |
Enter a unique password in the Password and Verify Password fields.
![]() | Enter a new password! If you do not enter a new password in these fields, DB2 assigns the default password ibmdb2, giving crackers a wide-open front door to your system. |
Select [ Properties... ] to change the properties for the instance.
Under the Authentication Type heading, select the Server Encrypt check box. This greatly improves the security of your system, by telling DB2 to accept encrypted passwords, rather than plain text passwords.
Select the Auto start DB2 Instance at system boot check box if you want to start this DB2 instance every time you reboot your system.
Select the Create a sample database for DB2 Instance check box if you plan to work with the sample applications available with the Application Development Client. To run correctly, most of the sample applications require the specific tables and data of the sample database. If you do not create the sample database now, you can create it later using the db2sampl command.
Select [ OK ] to create the DB2 instance. The Fenced User text window is displayed. Repeat the previous steps for creating a new user and group. Server-side DB2 executables, such as stored procedures and user-defined functions, execute under the permissions of the fenced user ID. By controlling the permissions of the fenced user ID, you control the permissions of the server-side DB2 executables.
Select [ OK ] to create the fenced user.
To remove DB2 from your workstation cleanly, perform the following steps:
bash# /usr/IBMdb2/V7.1/instance/db2ilist |
Drop each instance listed in the previous step with the following command:
bash# /usr/ibmdb2/v7.1/instance/db2idrop instance-name |
Drop the DB2 administration server:
bash# /usr/IBMdb2/V7.1/instance/dasidrop `/usr/IBMdb2/V7.1/instance/dasilist` |
Uninstall all of the DB2 packages on your system using the db2deinstall command on your DB2 CD-ROM:
bash# /mnt/cdrom/db2/db2_deinstall -n |
![]() | This section assumes that you have followed the instructions in Section 11. |
Before you can issue an SQL statement, you have to connect to a database. To connect to a database:
To connect to a database, and have DB2 prompt you for the password:
db2 CONNECT TO database USER userID
To connect to a database using the default user ID:
db2 CONNECT TO database
Once you have connected to a database, you can then issue SQL statements or DB2 commands against that database. For example, to select all of the columns from the EMPLOYEE table in the SAMPLE database, issue the following command:
bash$ db2 "SELECT * FROM employee" |
![]() | You can avoid typing db2 as the prefix for every SQL statement and DB2 command by issuing commands using the Command Line Processor (CLP). To start the CLP, issue the db2 command by itself. DB2 provides the following prompt:
Some users claim that running the CLP within an Emacs shell gives them the best of both worlds: they get command line history, and they don't have to escape commands that contain lots of quotation marks and brackets. |
The following section covers some of the common problems you may encounter when you install DB2.
DB2 issues this error when it can't find the pdksh or ksh shells. This has probably occurred because you did not install the pdksh package for your distribution. See Section 3 for more details on installing the pdksh package for your Linux distribution.
If you did not remove the default DB2 user IDs created by SuSE Linux before installing DB2 (see Section 3.6), the DB2 Create Instance panel places the corresponding user ID in the "User ID" field. This can cause a problem when you change the value of the User Name field to reflect the name of the new instance, because the value of the "User ID" still reflects the original user name.
Ensure that you select the "Use default UID" check box to automatically associate the new user name with its corresponding user ID.
If you did not remove the default DB2 user IDs created by SuSE Linux before installing DB2 (see Section 3.6), the DB2 Create Instance panel places the corresponding group ID in the Group ID field. This can cause a problem when you change the value of the Group Name field to reflect the name of the new instance, because the value of the Group ID still reflects the original group name.
Ensure that you select the "Use default GID" check box to automatically associate the new group name with its corresponding group ID.
If you did not remove the default DB2 user IDs created by SuSE Linux before installing DB2 (see Section 3.6), the default user name already exists and was created in the /usr/lib/db2/ directory. To change the home directory of your new DB2 instance, you must manually specify the location of the new instance. The default home directory is /home/.
bash# /usr/IBMdb2/V7.1/instance/db2iupdt instance-name |
bash# /usr/IBMdb2/V7.1/instance/db2iupdt -e |
When you create an instance, as described in Section 6, DB2 copies selected files from /usr/IBMdb2/V7.1/bin into the $HOME/sqllib/bin directory of the instance. DB2 sets the appropriate permissions on the copies of the files in the instance directory.
DBI1517E An attempt to execute a command in a subprocess failed. Explanation: An error was detected when attempting to execute a command in a subprocess. One of the following problems occurred: o The command does not exist. o Incomplete command search path. o Incorrect access permissions on the command. o System resource problem. |
export PATH=$PATH:/usr/sbin |
DBI1766W Cannot change the secondary group list of "". Explanation: A code, "", is returned when attempting to change the secondary group list of the given user ID. One of the following situations has occurred: o NIS is running. o One or more processes are currently being executed under the given user ID. User Response: You must add the group ID, "", to the secondary group list of the user ID, "", so that the Adminstration Server can function properly. o If there happens to be any process run under the given user ID, terminate all of these processes and follow the instructions above to setup the secondary group list of this user ID. o If you are running this command on an NIS client, try the above instructions to setup the secondary group list of this user ID on your NIS server. |
bash$ db2 connect to sample Database Connection Information Database server = DB2/LINUX 7.1.0 SQL authorization ID = userID Local database alias = SAMPLE |
bash$ db2 CONNECT TO sample USER userID Enter current password for userID: SQL1403N The username and/or password supplied is incorrect. SQLSTATE=08004 |
Hey! I said I wasn't going to include any DB2 Version 6.1 information! Oh well, this is one of the most frequently asked questions about 6.1, so here's a short answer: you need to install a recent DB2 FixPack. The initial release of DB2 Version 6.1 ran into incompatibilities with distributions built on glibc 2.1. For a full description of the problem, and the correct install procedure, refer to IBM Support document 1000814: db2start hangs on Linux distributions built with glibc 2.1.
bash$ db2 connect to sample Database Connection Information Database server = DB2/LINUX 7.1.0 SQL authorization ID = userID Local database alias = SAMPLE |
bash$ db2 CONNECT TO sample USER userID Enter current password for userID: SQL1403N The username and/or password supplied is incorrect. SQLSTATE=08004 |
Check the ownership and permissions on the db2ckpw program. They should look like this:
bash$ ls -al ~/sqllib/security/db2ckpw -rwsr-s--x 1 root build 15989 Oct 17 07:22 sqllib/security/db2ckpw* |
bash# chown root db2ckpw bash# chmod ug+s db2ckpw |
Claus Reiner contributed the following procedure:
Preparing DB2 for AS/400 to accept connections
AS/400 has a special service that must be run and other things that need to be prepared:
CHGUSRPRF USRPRF(user) CCSID(37) |
CHGSYSVAL SYSVAL(QCCSID) VALUE(37) |
Start a service to listen on port 446. To start the service once:
STRTCPSVR SERVER(*DDM) |
CHGDDMTCPA AUTOSTART(*YES) |
Create a NULLID collection by issuing the following SQL statement:
CREATE COLLECTION NULLID |
Possibly create a collection for the user ID to connect with:
CREATE COLLECTION userid |
Preparing DB2 Connect for Linux to connect to an AS/400 database
On the Linux side, you need to perform the following steps:
Catalog the remote node (the AS/400) with OSTYPE OS400:
bash$ db2 CATALOG TCPIP NODE as400 REMOTE as400 \ SERVER 446 REMOTE_DATABASE as400_dbname \ OSTYPE os400 |
Catalog the remote database in DCS:
bash$ db2 CATALOG DCS DATABASE as400_dbname AS as400_dbname |
bash$ db2 CATALOG DATABASE as400_dbname AS as400_dbname \ AT NODE as400 AUTHENTICATION DCS |
bash$ export LD_ASSUME_KERNEL=2.2.5 bash$ db2set DB2ENVLIST=LD_ASSUME_KERNEL |
To catalog the DB2 Administration Server, issue the following command:
bash$ db2 catalog admin local node machine-name instance Administration-Server-name system machine-name ostype linux |
On Caldera, the Control Center didn't work for me until I added the instance user IDs to the appropriate groups. For more information, see Section 3.1.3.1.
Ensure that you have installed the IBM Developer Kit for Java, and that the directory containing the jre or java executable is in your path. If you issue the command
bash$ java -fullversion |
If you recompile the kernel yourself, you should be able to safely increase this value to 9.
In the 2.4 kernel source, this variable is defined in /proc/sys/kernel/msgmni. The default value of 16 must be increased to enable DB2 Version 7.1 to function correctly. The good news is that you can change this value without recompiling the kernel or rebooting your machine. For more information, see Section 12.
This variable, defined in /usr/src/linux/include/linux/tasks.h, determines the number of simultaneous processes that Linux supports. A second variable, MAX_TASKS_PER_USER, is defined as NR_TASKS/2. Since DB2 instances are treated as users by Linux, and each connection uses a single process, the maximum number of connections per instance is capped at the value of NR_TASKS/2.
The default value for NR_TASKS in the kernel source is 512, allowing a maximum of 256 simultaneous connections to a single DB2 instance. DB2 itself requires a few connections for overhead processes. If you recompile the kernel yourself, you should increase this value to something like 2048. The stock kernels shipped with the Red Hat, SuSE, and TurboLinux distributions increase the value of NR_TASKS to 2560 or above. However, Caldera OpenLinux eDesktop 2.4 ships with a kernel in which NR_TASKS is set to the default value of 512. Caldera users should increase the value of this variable and recompile the kernel.
This variable, defined in /usr/src/linux/include/linux/sem.h, determines the number of semaphore identifiers that Linux supports. This variable is particularly important on symmetric multi-processing (SMP) machines. A unique semaphor identifier is required for each processor per agent (or connection); therefore, on a quad-processor machine, four semaphore identifiers are required per connection.
The default value for SEMMNI in the kernel source is 128, which, on a quad-processor machine, will only allow 32 simultaneous connections to a DB2 instance. If you recompile the kernel yourself, increase this value to something like 1024.
The following table shows the default values of the kernel parameters set in the stock kernel source and in the kernels provided by each distribution.
unknown indicates that I don't know what the default level is, probably because it came to my attention after I had already removed the distribution (your feedback is welcome!)
?? indicates that I could not find the parameter in the kernel source or in the /proc/sys/kernel/ directory. Help, anyone?
** as a prefix indicates that the default value is not acceptable and must be increased
Table 2. Default kernel parameter values, by distribution
Distribution | _SHM_ID_BITS | MSGMNI | NR_TASKS | SEMMNI | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2.2 kernel source | 7 | 128 | 512 | 128 | ||||||||||||||||||
2.4 kernel source | ?? | **16 | ?? | 128 | ||||||||||||||||||
Caldera OpenLinux eDesktop 2.4 | 7 | Unknown | 512 | 128 | ||||||||||||||||||
Caldera OpenLinux eServer 2.3 | 7 | Unknown | 512 | 128 | ||||||||||||||||||
Mandrake Linux 7.2 | 10 | 512 | 4090 | 512 | ||||||||||||||||||
Red Hat 6.2 |
| Unknown |
|
| ||||||||||||||||||
Red Hat 7.1 | n/a (2.4 kernel) | 16 | n/a (2.4 kernel) | 128 | ||||||||||||||||||
SuSE 6.2 | Unknown | Unknown | Unknown | Unknown | ||||||||||||||||||
SuSE 6.3 | Unknown | Unknown | Unknown | Unknown | ||||||||||||||||||
SuSE 7.0 | 9 | 128 | 2048 | 512 | ||||||||||||||||||
TurboLinux 6.0 |
| Unknown |
|
|
A buffer pool is a database object representing system memory used to cache table and index data as it is read from disk or modified. DB2 allocates a default buffer pool of 4 megabytes of memory. This is a ridiculous default for a production database because it will inhibit performance greatly. To get good performance out of DB2, you must create one or more buffer pools and associate them with the tablespaces used to hold the tables in your database. For more information on buffer pools and increasing performance, see the IBM DB2 Administration Guide: Performance.
On a system with a 2.2 kernel compiled with support for >1 gigabyte of RAM, the practical upper limit for buffer pools is about 1 gigabyte of memory due to the location in memory in which Linux loads shared libraries.
![]() | For DB2 Version 7.1, you cannot use other versions of Java. Versions of the Java Virtual Machine (JVM) supplied by other software organizations are not supported. |
Installing the IBM Developer Kit for Java, Version 1.1.8
Download the IBM Developer Kit for Java, version 1.1.8, from the IBM Java Developer's Kit downloads web site. I'll assume that you download the RPM package of the IBM Developer Kit for Java.
Install the IBM Developer Kit for Java by issuing the following command as root:
bash# rpm -ivh IBMJava118-SDK-1.1.8-2.0-i386.rpm |
I most recently tested IBM JDK 1.1.8 build 20010115a successfully on Red Hat 6.2. To see which build of the IBM JDK you are using, issue the java -fullversion command.
Add the following lines to your /etc/profile file to set up the Java environment for all users:
export JAVA_HOME=/usr/jdk118 export PATH=$PATH:$JAVA_HOME/bin export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/classes.zip |
![]() | Caldera users should see Section 3.1.1 for instructions on configuring the IBM Developer Kit for Java on Caldera OpenLinux. |
![]() | Red Hat 7.1 enabled a floating stack feature in the glibc library that breaks the IBM JDK 1.1.8. Other distributions might follow their lead. If the DB2 Control Center refuses to start successfully or your Java applications do not work, you can disable the floating stack by setting the LD_ASSUME_KERNEL environment variable to 2.2.5 before running the DB2 Control Center as follows:
|
Installing the IBM Developer Kit for Java, Version 1.3
Download the IBM Developer Kit for Java, version 1.3, from the IBM Java Developer's Kit downloads web site. I'll assume that you download the RPM package of the IBM Developer Kit for Java.
Install the IBM Developer Kit for Java by issuing the following command as root:
bash# rpm -ivh IBMJava2-SDK-1.3-1.1-i386.rpm |
I most recently tested build cx130-20010329 successfully with Red Hat 7.1. To see which build of the IBM JDK you are using, issue the java -fullversion command.
Add the following lines to your /etc/profile file to set up the Java environment for all users:
export PATH=$PATH:/opt/IBMJava2-13/jre/bin |
![]() | Caldera users should see Section 3.1.1 for instructions on configuring the IBM Developer Kit for Java on Caldera OpenLinux. |
IBM JDK 1.3 does away with the jre command, even if you install the the IBM JRE 1.3 package. However, the db2cc script calls the jre command. The easiest solution is to create a link called jre to the java executable in the /opt/IBMJava2-13/bin directory by issuing the following command as root.
bash# ln -sf /opt/IBMJava2-13/jre/bin/java /opt/IBMJava2-13/jre/bin/jre |
The db2cc script calls the jre command with the -nojit argument, which is not supported in IBM JDK 1.3. Remove the option by changing line 44 of /usr/IBMdb2/V7.1/bin/db2cc to the following:
JRE_OPTIONS="-ss256k -mx128m -Ddb2path=$DB2PATH" |
Configure the msgmni parameter by issuing the sysctl command as root:
bash# sysctl -w kernel.msgmni=128 |
bash# echo "128" > /proc/sys/kernel/msgmni |
To set the msgmni kernel parameter at boot time, append the following lines to /etc/sysctl.conf:
# Sets maximum number of message queues to 128 # Set this to 1024 or higher on production systems kernel.msgmni = 128 |
bash$ ipcs -l ------ Shared Memory Limits -------- max number of segments = 4096 max seg size (kbytes) = 32768 max total shared memory (kbytes) = 8388608 min seg size (bytes) = 1 ------ Semaphore Limits -------- max number of arrays = 128 max semaphores per array = 250 max semaphores system wide = 32000 max ops per semop call = 32 semaphore max value = 32767 ------ Messages: Limits -------- max queues system wide = 128 max size of message (bytes) = 8192 default max size of queue (bytes) = 16384 |
Following is a list of references to further information on using DB2 V7.1 for Linux:
Covers the use of DB2 Universal Database on all platforms, including Linux and other Unices, OS/2, OS/390, OS/400, and Windows. This forum is quite active.
This mailing list claims about 300 subscribers who ask and answer questions. The site provides a link to searchable archives, and sharing of utilities and scripts is encouraged.
Although this newsgroup was meant to serve users trying out the DB2 V7.1 beta code, there are a lot of general questions about DB2 on Linux that might help answer your questions. Now that the final release is available, activity on this forum has slowed down significantly.
IBM publishes many books on installing, administering, and developing applications with DB2. If you decide not to install the documentation when you install DB2, you can always access the documentation online in HTML format or download PDF versions of the books.
This web site contains the latest information about restrictions, workarounds, or additional documentation for developing applications with DB2.
This web site contains general information about using DB2 for Linux, including a link to the free download of DB2 Personal Developers Edition.
This web site is the online version of DB2 Magazine, which publishes articles about using DB2 on Linux and other platforms. You can also sign up a free subscription to the print version of the magazine.
This web site contains white papers published by IBM about DB2. White papers typically provide overviews or introductions to new technology or new releases of a product.
IDUG holds a number of international conferences on DB2 and has regional user groups. While IDUG has traditionally focused on DB2 for OS/390 and OS/400, they have increasingly included information on DB2 for Linux, other Unices, OS/2, and Windows. The IDUG web site includes online discussion forums and links to other DB2 resources.
Andika Triwidada contributed most of the information in this document about installing DB2 on Debian, using rpm to install the DB2 packages. The web page is the original source of that information. For those interested in installing previous releases of DB2 for Linux on Debian, Andika also includes information on running DB2 Version 5.2 and DB2 Version 6.1 on Debian.
Daniel Scheibli has started a project with the following mission statement:
The project provides tools that help DB2 administrators to understand the db2diag.log file, display extensive information about current connections, and provide a comprehensive list of information about the tablespaces and tablespace containers.
The Net Search Extender, formerly known as the Text Extender, allows you to perform full-text indexing and searches of databases on DB2.
Before Net Search Extender was available for DB2 for Linux, Kevin Sangalee put together an excellent page on an alternative method of providing similar function. From the site:
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
The precise terms and conditions for copying, distribution and modification follow.
one line to give the program's name and a brief idea of what it does. Copyright (C) yyyy name of author This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
Also add information on how to contact you by electronic and paper mail.
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. |
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice |