The following instructions are for the installation of DB2 8.2 on Solaris and Linux (Solaris 10 and Fedora Core kernel 2.6 and up ) systems. You need to install the DB2 software on the computer which the database will reside; we refer to this computer as "metaserver", though its true hostname could be something different. It may or may not be the same machine on which you will build LDAS. There are separate links for different DB2 8.2 versions on various platforms
Installation of 32 bit DB2 on Solaris and Linux
For Linux systems, download and install IBM Java2 Developer Kit 1.4.1. IBM does not provide a JDK for Solaris systems. You will have to register with IBM in order to download the software. Make sure you download the SDK RPM (e.g. IBMJava2-SDK-1.4.2-1.0.i386.rpm). Also, it is necessary to create a link for Java2 1.3.1 due to hard-coded paths in some DB2 utilities. Run the following commands as user root to properly install IBM Java2 1.4.2.
rpm -ivh IBMJava2-SDK-1.4.2-1.0.i386.rpm
cd /opt
ln -s IBMJava2-142 IBMJava2-131
Verify that the Java package has been installed by entering:
rpm -qa | grep -i ibm
IBMJava2-SDK-1.4.2-1.0
Log in to the database server as user root. Remain logged in as root unless otherwise specified.
Depending on how you obtained the DB2 software will determine where the installation files are located. If you received the software on CD-ROM, you will need to mount it on the appropriate system. Make sure the CD-ROM includes "DB2 Universal Database Enterprise Server Edition" and is for the correct operating system (Solaris or Linux). If you downloaded the software from IBM's web-site, you will need to extract the archive to a local or NFS-mounted filesystem. If there is a mirror image of DB2 on a file system, you can mount (as root) the mirror software as an nfs file system to extract from:
mount gateway-dev:/export/mirror /mnt/nfs
Change to the top-level directory of the DB2 installation files, which were prepared in the previous step. Type ./db2_install to start the installer script. When the installer prompts for a product code, enter DB2.ESE. When the installation completes, run the following command to install the license file.
/opt/IBM/db2/V8.1/adm/db2licm -a ./db2/license/db2ese.lic
You can now safely unmount or remove the installation files.
Download the FixPak for the appropriate system from IBM's FTP server:
Download the FixPak for the appropriate system from IBM's FTP server:
See Steps to upgrade from a fixpak for upgrade details.
Nothing needs to be done for Solaris 10 for now.
The recommended Solaris 9 kernel parameter settings depend on the amount of physical memory installed in your system. DB2 provides sample files with recommended kernel parameter settings according to different memory configurations. The sample files are provided with the DB2 installation files in the db2/solaris/samples directory, with the following names:
Depending on the amount of physical memory in your system, append the contents of the appropriate kernel.param file to the /etc/system file. It is necessary to reboot the computer for the new settings to take effect.
Note: The shmsys:shminfo_shmmax parameter should be set to the suggested value in the appropriate kernel.param file, or 90% of physical memory (in bytes), whichever is greater. For example, if you have 196 MB of physical memory in your system, set the shmsys:shminfo_shmmax parameter to 184968806 (196 * 1024 * 1024 * 0.9).
DB2 for Solaris also provides a utility that recommends kernel parameters based on the size and configuration of your system. This tool is named db2osconf and can be found in /opt/IBM/db2/V8.1/bin. To use db2osconf correctly, first use the values in one of the above mentioned files. Then run db2osconf to fine tune your system with more accurate values.
kernel.msgmni = 1024
kernel.sem = 250 256000 32 1024
Run the following command to load in the new settings:
All database access will be done through the username ldasdb. Create the ldasdb user by running the following commands. Replace /usr1 with your choice of location for the database user account.
mkdir -p /usr1
/usr/sbin/groupadd ldas
/usr/sbin/useradd ldasdb -m -g ldas -s /bin/tcsh -d /usr1/ldasdb
chmod 755 /usr1/ldasdb
touch /usr1/ldasdb/.login /usr1/ldasdb/.profile
chown ldasdb:ldas /usr1/ldasdb/.login /usr1/ldasdb/.profile
Set a password for this account by running the following command and entering a new password when prompted.
passwd ldasdb
Create a directory, owned by ldasdb, for the purpose of storing the database data. This directory can also hold more than one database. By convention we will call this directory databases. Replace /usr1 with your choice of location for the database data.
mkdir -p /usr1/databases
chmod 755 /usr1/databases
chown ldasdb:ldas /usr1/databases
An instance is a DB2 database manager running under a specific Unix username. Each instance may contain one or more databases. To create an instance for ldasdb, run the following commands. This will create the directory /usr1/ldasdb/sqllib and modify /usr1/ldasdb/.login to properly configure the environment at login time.
/opt/IBM/db2/V8.1/instance/db2icrt -s ese -u ldasdb ldasdb
For some DB2 operations, it may be necessary to use a DB2 adminstrator account. Create a db2das account by running the following commands. Replace /usr1 with your choice of location for the database adminstrator account.
/usr/sbin/groupadd -r db2adm
/usr/sbin/useradd db2das -m -g db2adm -s /bin/tcsh -d /usr1/db2das
touch /usr1/db2das/.login /usr1/db2das/.profile
chown db2das:db2adm /usr1/db2das/.login /usr1/db2das/.profile
Set a password for this account by running the following command and entering a new password when prompted.
passwd db2das
Create a DAS instance by running the following command.
/opt/IBM/db2/V8.1/instance/dascrt -u db2das
If you are upgrading from a DB2 7.2 installation, you can migrate the existing instance and databases for use in DB2 8.1. The IBM DB2 documentation has detailed information on migrating instances and databases. Specifically, chapters 4 and 6 of the Quick Beginnings document are very informative. Refer to the end of this document for links to DB2 documentation. The steps below are summarized from the DB2 documentation.
As a precaution, backup all existing databases before migrating. Run the following command as user ldasdb for each database. Replace ldas_tst with the name of a database on your system. Replace /usr1/databases/backup with your choice of backup directory. Make sure the backup directory already exists before starting the backup.
db2 backup database ldas_tst to /usr1/databases/backup
db2 list database directory
db2licd -end
db2 terminate
db2 force applications all
db2stop
To migrate the ldasdb instance, run the following commands as user root.
/opt/IBM/db2/V8.1/instance/db2imigr ldasdb
On Linux systems remove the following line from /usr1/ldasdb/.login, if it exists.
setenv LD_ASSUME_KERNEL 2.2.5
Log in as user ldasdb and follow the instructions found below to Configure the database manager. To migrate existing databases, run the following command for each database. Replace ldas_tst with the name of a database on your system.
db2 migrate database ldas_tst
Make sure to re-configure each database with the recommended settings, as the original configuration settings are not migrated. It is also recommended to update the table statistics by running the runstats command on preformance critical database tables.
As user root, change to the top-level directory of the DB2 7.2 installation files and type ./db2_deinstall. Unfortunately the db2_deinstall script does not remove everything from the 7.2 installation and requires some manual cleanup. Edit /etc/inittab and remove the following line (towards the bottom).
db:234:once:/etc/rc.db2 > /dev/console 2>&1 # Autostart DB2 Services
You can safely remove /etc/rc.db2 as it is not used by DB2 8.1. On Linux systems, there should no longer be a /usr/IBMdb2 directory. If the directory still exists, it probably contains files that were modified after the 7.2 installation for RedHat 9 or Fedora Core 3 compatibility . In that case, you can safely remove the /usr/IBMdb2 directory.
It is no longer necessary to be logged in as user root. Perform this step as user ldasdb.
db2set DB2COMM=TCPIP
db2set DB2AUTOSTART=YES
db2 update database manager configuration using svcename 50002
db2 update database manager configuration using diaglevel 4
db2 terminate
db2start
chmod a+w /usr1/ldasdb/sqllib/db2dump/db2diag.log
ls -l /usr1/ldasdb/sqllib/db2dump/db2diag.log
-rw-rw-rw- 1 ldasdb ldas 45990754 Dec 22 10:34 /usr1/ldasdb/sqllib/db2dump/db2diag.log
Log in as user ldasdb and run the following command to create a sample database. This can take a few minutes to process. There is no completion message; when the shell prompt returns, the process is complete.
db2sampl
Enter the following commands to connect to the sample database, retrieve a list of all the employees that work in department 20, and reset the database connection.
db2 connect to sample
db2 "select * from staff where dept = 20"
db2 connect reset
The query above should return the following information:
ID NAME DEPT JOB YEARS SALARY COMM
------ --------- ------ ----- ------ --------- ---------
10 Sanders 20 Mgr 7 18357.50 -
20 Pernal 20 Sales 8 18171.25 612.45
80 James 20 Clerk - 13504.60 128.20
190 Sneider 20 Clerk 8 14252.75 126.50
4 record(s) selected.
After you have verified the installation, remove the sample database.
db2 drop database sample
db2stop
/opt/IBM/db2/V8.1/instance/db2iupdt ldasdb
As db2 instance user, foreach database enter:
db2updv8 -d <dbname>
db2start
db2 list database directory on /usr1/databases Local Database Directory on /usr1/databases Number of entries in the directory = 1 Database 1 entry: Database alias = LDAS_TST Database name = LDAS_TST Database directory = SQL00001 <--- no file path Database release level = a.00 Comment = Directory entry type = Home Catalog database partition number = 0 Database partition number = 0So issue the following command:
db2 catalog database ldas_tst on /usr1/databasesVerify the system information on the database is correct:
db2 list database directory System Database Directory Number of entries in the directory = 1 Database 1 entry: Database alias = LDAS_TST Database name = LDAS_TST Local database directory = /usr1/databases <--- file path Database release level = a.00 Comment = Directory entry type = Indirect Catalog database partition number = 0 Alternate server hostname = Alternate server port number =Repeat catalog for each existing database.
At a command prompt, enter:
db2 terminate
db2 CONNECT TO <dbname>
db2 BIND <path>/@db2ubind.lst BLOCKING ALL GRANT PUBLIC ACTION ADD
db2 terminate
where <path> represents the full path name of the directory where the bind files are located, such as $HOME/sqllib/bnd where $HOME
represents the home directory of the instance for the database server. db2ubind.lst and db2cli.lst contain lists of
required bind files used by DB2 UDB. Packages that are already bound will return an SQL0719 error. This is expected.
At a command prompt, enter:
db2 terminate
db2 CONNECT TO <dbname>
db2 BIND <path>/db2schema.bnd BLOCKING ALL GRANT PUBLIC sqlerror continue
db2 terminate
More details are in the documentation of fixpak 14
The DB2 tarball for 64 bit Solaris X86 contains pre-requsites and installation instructions. Basically you must be using Solaris 10 1/06 or greater and have the 64-bit version of Java installed.
In order to obtain DB2 entire system installation tarballs, you must be a registered user of IBM. Users of educational systems must be registered in the Scholar Program.
The DB2 tarball for this system is C909HML.tar.gz. As root user, download this tarball from IBM web site and untar it into a temporary directory.
cd to the installation directory and enter
./db2_installThe default installation directory is /opt/IBM/db2/V8.1. This installation will take about 20 minutes some occasional logs to the screen.
The fixpaks for 64 bit DB2 for X86 machines running Solaris are:
./db2_install
This is done by using the command:
/opt/IBM/db2/V8.1/instance/db2icrt -w 64 -s ese -u ldasdb ldasdb
db2start
Execute step #12 in the instructions for installation of 32 bit DB2 for Solaris and Linux. Before deleting the sample database connect to the sample database and verify the db2 8.2 patch level:
db2 connect to sample
Database Connection Information
Database server = DB2/SUN64 8.2.4
SQL authorization ID = LDASDB
Local database alias = SAMPLE
Another way to verify the DB2 version is via the db2level command:
db2level DB21085I Instance "ldasdb" uses "64" bits and DB2 code release "SQL08024" with level identifier "03050106". Informational tokens are "DB2 v8.1.0.104", "n060331", "U805925", and FixPak "11". Product is installed at "/opt/IBM/db2/V8.1".
The DB2 tarball for 64 bit Linux X86 contains pre-requsites and installation instructions. Basically
if you are installing on a bare system without DB2.
The fixpak for 64 bit DB2 for X86 machines running Linux is:
Regular Fixpak FP13_MI00167
./installFixPak -y
To create a 64 bit instance:
/opt/IBM/db2/V8.1/instance/db2icrt -w 64 -s ese -u ldasdb ldasdbTo update an existing 32 bit instance
/opt/IBM/db2/V8.1/instance/db2updt -w 64 ldasdb
db2start
Execute step #12 in the instructions for installation of 32 bit DB2 for Solaris and Linux. Before deleting the sample database connect to the sample database and verify the db2 8.2 patch level:
db2 connect to sample
Database server = DB2/LINUXX8664 8.2.6
SQL authorization ID = LDASDB
Local database alias = SAMPLE
Another way to verify the DB2 version is via the db2level command:
db2level DB21085I Instance "ldasdb" uses "64" bits and DB2 code release "SQL08026" with level identifier "03070106". Informational tokens are "DB2 v8.1.3.120", "s060801", "MI00167", and FixPak "13". Product is installed at "/opt/IBM/db2/V8.1".