Steps to installation of IBM DB2 8.2 software

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

  1. Prerequisites

    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.

    Verify that the Java package has been installed by entering:

    rpm -qa | grep -i ibm
    IBMJava2-SDK-1.4.2-1.0
    
  2. Prepare the installation media

    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:

  3. Install DB2 Enterprise Server Edition software for DB2 8.1

    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.

    You can now safely unmount or remove the installation files.

  4. Install DB2 FixPak 9a to upgrade DB2 8.1 to 8.2.2

    This latest fixpak is installed over DB2 8.1.0 or higher up to 8.2.1.

    Download the FixPak for the appropriate system from IBM's FTP server:

  5. Install DB2 FixPak 14 to upgrade DB2 8.2.2 to 8.2.7

    This latest fixpak is installed over DB2 8.2 or higher up to bring db2 level to 8.2.7.

    Download the FixPak for the appropriate system from IBM's FTP server:

  6. See Steps to upgrade from a fixpak for upgrade details.

  7. Adjust system kernel parameters

  8. Create Unix usernames for database access

    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.

    Set a password for this account by running the following command and entering a new password when prompted.

  9. Create the databases directory

    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.

  10. Create the DB2 user instance

    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.

  11. Create a DB2 administrator account (optional)

    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.

    Set a password for this account by running the following command and entering a new password when prompted.

    Create a DAS instance by running the following command.

  12. Migrate from DB2 7.2

    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.

    1. Backup existing databases

      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

      To get a list of available databases, issue the following DB2 command.

        db2 list database directory

    2. Take the DB2 server offline

      To shut down the DB2 7.1 server, run the following commands as user ldasdb.

        db2licd -end
        db2 terminate
        db2 force applications all
        db2stop

    3. Migrate existing instance

      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

    4. Migrate existing database(s)

      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.

    5. Uninstall DB2 7.2 software

      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.

  13. Configure the database manager

    It is no longer necessary to be logged in as user root. Perform this step as user ldasdb.

  14. Validate the installation (optional)

    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

  15. Steps to upgrade from a fixpak

    1. As database user ldasdb, stop DB2 server:
      
      db2stop
      
    2. Extract the archive, uncompressing as necessary, to a temporary directory e.g. /tmp. Change to the temporary directory e.g. /tmp and type ./installFixPak -y to update the DB2 installation. After the update completes, you can safely remove the extracted files.
    3. Update the instance

      
      /opt/IBM/db2/V8.1/instance/db2iupdt ldasdb
      
    4. Update the sytem catalog to use the current fixpak capabilities

      As db2 instance user, foreach database enter:

      
      db2updv8 -d <dbname>
      
    5. Restart DB2 server
      
      db2start
      
    6. If there are existing databases in a database directory other than the home directory of the database user, you may need to recatalog these databases again, e.g. given database ldas_tst on /usr1/databases before the upgrade, the databae file path is not in the system catalog. Note: this step may not be necessary if db2updv8 is used to make current on the fixpak.
      
      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            = 0
      
      
      So issue the following command:
      
      db2 catalog database ldas_tst on /usr1/databases
      
      Verify 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.

    7. Bind binding files - bind your DB2 utilities against all your databases after installation. This step is necessary for the fixes to complete the installation and ensure that the right code level is used. The procedure of binding, which follows, needs to be performed only once per database. Not all bnd files in the bnd directory are needed.

      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.
    8. Also bind db2schema.bnd (needed for catalog function support ) to each database.

      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

Installation of 64 bit DB2 on AMD Opteron or UltraSparc running Solaris 10

  1. Prerequisites

    The DB2 tarball for 64 bit Solaris X86 or UltraSparc 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.

  2. Increase Resource

    Increase the limits of shared memory segments, semaphore ids and total memory used for shared memory by appending the following to /etc/system for DB2:
    
    * For DB2
    set msgsys:msginfo_msgmni = 3584
    set semsys:seminfo_semmni = 4096
    set shmsys:shminfo_shmmax = 15392386252
    set shmsys:shminfo_shmmni = 4096
    
  3. Obtain DB2 Enterprise Server Edition software for DB2 9.1.0.5

    Obtain the DB2 9.1 tarball DB2_ESE_V91_Solaris_x86-64.tar.gz for AMD 64 bit on Solaris 10 from IBM using a valid user license. For solaris ultrasparc the tarball is v9fp5_sunos_ese.tar.gz.

  4. Install DB2 9.1

    The default installation directory is /opt/IBM/db2/V9.1. This installation will take about 20 minutes some occasional logs to the screen.
  5. Update to the latest fixpak

    Obtain the DB2 9.1.0.4 fixpak tarball v9fp4_sunamd64_ese.tar.gz for AMD 64 bit on Solaris 10 at http://www-1.ibm.com/support/docview.wss?rs=71&uid=swg21268149

    Untar fixpack to in /tmp. cd /tmp and run ./installFixPak -y

  6. Create a 64 bit DB2 instance

    This is done by using the command:

    
    /opt/IBM/db2/V9.1/instance/db2icrt -s ese -u ldasdb ldasdb
    
  7. As user ldasdb, start DB2 via
    
    	db2start
    
  8. Verify the DB2 version installed

    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 9.1.0.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 "SQL09014" with
    level identifier "01050107".
    Informational tokens are "DB2 v9.1.0.4", "s071028", "U811794", and Fix Pack
    "4".
    Product is installed at "/opt/IBM/db2/V9.1".
    
    For solaris UltraSparc, the db2level is 9.1.5:
    
    > db2level
    DB21085I  Instance "ldasdb" uses "64" bits and DB2 code release "SQL09015" with
    level identifier "01060107".
    Informational tokens are "DB2 v9.1.0.5", "s080512", "U815923", and Fix Pack
    "5".
    Product is installed at "/opt/IBM/db2/V9.1".
    

Installation of 64 bit DB2 on AMD Opteron running Linux

  1. Prerequisites

    The DB2 tarball for 64 bit Linux X86 contains pre-requsites and installation instructions. Basically

  2. Install DB2 8.2 for a bare system

    Install DB2 Enterprise Server Edition software for DB2 8.2

    if you are installing on a bare system without DB2.

  3. Apply V8 FixPak 13 for LinuxAMD (2.6 kernel, 64 bit)

    The fixpak for 64 bit DB2 for X86 machines running Linux is:

    		Regular Fixpak FP13_MI00167
    
  4. Create or update to 64 bit DB2 instance

    To create a 64 bit instance:

    
    /opt/IBM/db2/V8.1/instance/db2icrt -w 64 -s ese -u ldasdb ldasdb
    
    To update an existing 32 bit instance
    
    /opt/IBM/db2/V8.1/instance/db2updt -w 64 ldasdb
    
  5. As user ldasdb, start DB2 via
    
    	db2start
    
  6. Verify the DB2 version installed

    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".
    
  7. Remove DB2 installation

    To remove a DB2 installation,

    1. As user ldasdb, you may want to drop your existing databases first.
    2. As user ldasdb, issue db2stop to bring down DB2 if it is up and exit ldasdb login.
    3. As user root, issue
      <DB2 installed path>/instance/db2idrop ldasdb e.g.
      /opt/ibm/db2/V8.1/db2idrop ldasdb
      DBI1070I Program db2idrop completed successfully.
    4. As user root, run deinstall process /install/db2_deinstall ldasdb e.g.
      /opt/ibm/db2/V8.1/db2install -a

Additional DB2 Information


Mary O. Lei