Tuesday, March 13, 2007

How to use DB2 V8.2 in Solaris 10 Zones



This is more like an hands on on how-to use DB2 V8.2 in Solaris 10 Zones I have a Solaris 10 system which already has DB2 V8.2 fixpack 13 installed in /opt/IBM/DB2/V8.2. Currently there are no zones define on the system So we start by creating a local zone


# mkdir -p /export/zone/testbed
# chmod 700 /export/zone/testbed

# zonecfg -z testbed
testbed: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:testbed> create
zonecfg:testbed> set zonepath=/export/zone/testbed
zonecfg:testbed> add net
zonecfg:testbed:net> set address=10.0.0.1
zonecfg:testbed:net> set physical=eri0
zonecfg:testbed:net> end
zonecfg:testbed> verify
zonecfg:testbed> commit
zonecfg:testbed> exit


# zoneadm -z testbed install
Preparing to install zone .
Creating list of files to copy from the global zone.
Copying <14661> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <1018> packages on the zone.
Initialized <1018> packages on zone.
Zone is initialized.
Installation of <110> packages was skipped.
The file
contains a log of the zone installation.
#

Please review the install_log file very carefully as it highlights all packages that could not be added to the local zone. This clearly indicates if that package was installed without any problems or not. For example in my install_log file I see


*** package <mqm> was not installed:

The package <mqm> is either not fully installed in the
global zone, or the package contains a request script. Only packages
that are fully installed in the global zone and that do not contain a
request script can be installed when a new zone is created. If this
package does not contain a request script, you can correct this
problem by removing and reinstalling the package in the global zone.

This indicates that since the WebSphere MQ package that was installed in the global zone uses a request script, it did not install it by default into the local zone. In this particular installation, I verified that all the 42 packages starting with "db2" were installed into the local zone without any problems.


NOTE: While this "inheritance" works, from my talks with the IBM DB2 support team, their recommendation is not to install DB2 on the global zone at all, but install it directly under the local zone, once the local zone is available)


# zoneadm -z testbed boot
# zlogin -C testbed
[Connected to zone 'testbed' console]

You did not enter a selection.
What type of terminal are you using?
1) ANSI Standard CRT
2) DEC VT52

..

Follow the prompts to complete the Zone initialization, otherwise the zone will not be fully available. When the system identification step is completed and you logout use ~. to exit from the console mode.


# zlogin testbed
[Connected to zone 'testbed' pts/4]
Last login: Tue Mar 13 07:09:25 on pts/4
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
# uname -a
SunOS testbed 5.10 Generic_118833-36 sun4u sparc SUNW,Sun-Blade-1000
# cat /etc/release
Solaris 10 6/06 s10s_u2wos_09a SPARC
Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
Use is subject to license terms.
Assembled 09 June 2006

# cd /opt/IBM/db2/V8.1
# pwd
/opt/IBM/db2/V8.1


It inherited my DB2 V8.2 installation from global zone where it was already installed before I created the new local zone


NOTE AGAIN : While this works, from my talks with the IBM DB2 support team, their recommendation is not to install DB2 on the global zone at all, but install it directly under the local zone, once the local zone is available)


# mkdir /export/home
# groupadd db2iadm1
# useradd -g db2iadm1 -s /usr/bin/bash -d /export/home/db2inst1 -m db2inst1
64 blocks
# projadd -U db2inst1 user.db2inst1
# projmod -a -K "project.max-shm-ids=(priv,4k,deny)" user.db2inst1
# projmod -a -K "project.max-sem-ids=(priv,4k,deny)" user.db2inst1
# projmod -a -K "project.max-shm-memory=(priv,4G,deny)" user.db2inst1
# projmod -a -K "project.max-msg-ids=(priv,4k,deny)" user.db2inst1
# useradd -g other -s /usr/bin/bash -d /export/home/db2fenc1 -m db2fenc1
64 blocks
#

The recommended way to figure out the ballpark values for the above project parameters is to to run the db2osconf utility in Global zone and use the recommended values.


# cd /opt/IBM/db2/V8.1/instance
# ./db2icrt -w 64 -p 50000 -u db2fenc1 db2inst1
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
DBI1070I Program db2icrt completed successfully.


# su - db2inst1
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
-bash-3.00$ db2licm -a db2license.txt
DBI1402I License added successfully.

-bash-3.00$ db2start
03/13/2007 16:09:43 0 0 SQL1063N DB2START processing was successful.
SQL1063N DB2START processing was successful.
-bash-3.00$
-bash-3.00$ db2level
DB21085I Instance "db2inst1" uses "64" bits and DB2 code release "SQL08026"
with level identifier "03070106".
Informational tokens are "DB2 v8.1.0.120", "s060801", "U808889", and FixPak
"13".
Product is installed at "/opt/IBM/db2/V8.1".

Now verifying the newly created instance

-bash-3.00$ db2sampl
-bash-3.00$ db2 connect to sample

Database Connection Information

Database server = DB2/SUN64 8.2.6
SQL authorization ID = DB2INST1
Local database alias = SAMPLE

-bash-3.00$ db2 "select count(*) from employee"

1
-----------
32

1 record(s) selected.

-bash-3.00$ db2 connect reset
DB20000I The SQL command completed successfully.
-bash-3.00$




Hopefully this helps getting over the fear of using Zones and DB2. Again refer to previous blog entry for the white paper on DB2 Containers.
With this my more than two years old original entry of DB2 V8.1 (prior to release of DB2 V8.2) in Solaris 10 zones before Solaris 10 was released is now obsolute.



 


No comments: