Sun Update Connection - Enterprise 1.0 User's Guide

ProcedureTo Deploy DB2 on Multiple Machines

This procedure uses a script that calls up the DB2 license file during automated installation.

  1. Upload the DB2 RPMs to the local knowledge base.

    The RPMs are listed under Local -> Local RPMs. See Adding Undetected Linux Software.

  2. Create a Local File Declaration that is the path where the license file should be installed.

    For example, the file might be /tmp/db2pe.lic.

    See Creating File Declarations.

  3. Upload the license file as a Local Configuration File under the File Declaration.

    See Uploading Local Configuration Files.

  4. Create a script that does the following:

    • Installs the license

    • Creates DB2 users and instances

    • Starts DB2


    #!/bin/sh 
    
    OUTFILE=”/tmp/db2_uce.out” 
    
    # Definitions
    LICENSE_FILE=”/tmp/db2pe.lic”
    INST_DIR=”/opt/IBM/db2/V8.1”
    
    SERVICE_NAME=db2c_db2inst1
    SERVICE_PORT=50000
    INSTANCE_NAME=db2inst1
    INSTANCE_USER=db2inst1
    INSTANCE_GROUP=db2grp1 INSTANCE_HOME=”/home/$INSTANCE_USER”
    FENCED_USER=db2fenc1
    FENCED_GROUP=db2fgrp1
    FENCED_HOME=”/home/$FENCED_USER”
    ADMIN_USER=dasusr1
    ADMIN_GROUP=dasadm1
    ADMIN_HOME=”/home/$ADMIN_USER”
    
    # Install the DB2 license
    $INST_DIR/adm/db2licm -a $LICENSE_FILE >> $OUTFILE 2>&1
    
    # Fenced User Creation
    groupadd $FENCED_GROUP 
    useradd -g $FENCED_GROUP -m -d $FENCED_HOME $FENCED_USER 
    chmod 755 $FENCED_HOME 
    
    # Instance User Creation 
    groupadd $INSTANCE_GROUP 
    useradd -g $INSTANCE_GROUP -m -d $INSTANCE_HOME $INSTANCE_USER 
    chmod 755 $INSTANCE_HOME 
    
    # Admin User Creation 
    groupadd $ADMIN_GROUP 
    useradd -g $ADMIN_GROUP -m -d $ADMIN_HOME $ADMIN_USER 
    chmod 755 $ADMIN_HOME 
    
    # Edit entry in /etc/services?? 
    etc_serv=\Qgrep $SERVICE_NAME /etc/services | wc -l\Q 
    if [ $etc_serv -eq 0 ] ; 
    then 
      echo “$SERVICE_NAME $SERVICE_PORT/tcp #DB2” >> /etc/services 
    fi 
    
    # Create db2 instance 
    $INST_DIR/instance/db2icrt -a SERVER -u $FENCED_USER -p $SERVICE_NAME
       $INSTANCE_NAME >> $OUTFILE 2>&1 
    
    # Admin instance creation 
    $INST_DIR/instance/dascrt $ADMIN_USER >> $OUTFILE 2>&1
    
    # Update DB manager configuration 
    $INST_DIR/instance/db2iexec $INSTANCE_NAME “. sqllib/db2profile; db2 
       update dbm 
    cfg using svcename $SERVICE_NAME; db2set -i $INSTANCE_NAME 
       db2comm=tcpip; db2 terminate” >> $OUTFILE 2>&1 
    
    # Set DB2AUTOSTART=YES for $INSTANCE_NAME 
    $INST_DIR/instance/db2iset DB2AUTOSTART=YES -i $INSTANCE_NAME >> 
       $OUTFILE 2>&1 
    
    # DB2 Start 
    $INST_DIR/instance/db2iexec $INSTANCE_NAME “. sqllib/db2profile; 
       db2stop; db2start “ >> $OUTFILE 2>&1 
    
    # DB2 Admin Start 
    $INST_DIR/instance/db2iexec $ADMIN_USER “. das/dasprofile; db2admin 
       start “ >> $OUTFILE 2>&1
  5. Upload the script under Local -> Post-actions -> postDB2.

    See Uploading Actions.

  6. Create a profile that requires the following:

    • All DB2 RPMs

    • Local -> Configuration files -> license file

    • Local -> Post-actions -> postDB2

    See To Create a Profile.

  7. Run a job on selected hosts that deploys the profile.

    See Creating Complex Jobs.