Monday, December 22, 2014

Run DB2 SQL Scripts on command line

Use this:


1. login as the db user - if on unix use db2profile to set environment
2.  run db2 and connect to the db2 instance
3. quit
4. run the script using
      db2 -tvf < script name>

Note: some may require special options:
db2 +c -td@ -vf <script  name>

The above means auto commit is on, use @ as the delimiter for every SQL in the script.

For more details:
db2 ? options

Saturday, December 20, 2014

Create sample unicadb database on DB2 on linux


CREATE DATABASE UNICADB AUTOMATIC STORAGE YES ON '/apps/db2data/unicadb' DBPATH ON '/apps/db2data/unicadb' USING CODESET UTF-8 TERRITORY US PAGESIZE 32 K

CONNECT TO UNICADB

CREATE BUFFERPOOL UNICA32KBPOOL  SIZE 3000 PAGESIZE 32K 

CREATE REGULAR TABLESPACE UNICA PAGESIZE 32K MANAGED BY AUTOMATIC STORAGE BUFFERPOOL UNICA32KBPOOL  AUTORESIZE YES


create bufferpool unicasys32kbpool size 500 pagesize 32K

CREATE TEMPORARY TABLESPACE TEMPSPACE2 pagesize 32k MANAGED BY AUTOMATIC STORAGE BUFFERPOOL unicasys32kbpool


REVOKE USE OF TABLESPACE USERSPACE1 FROM PUBLIC
 
GRANT USE OF TABLESPACE UNICA TO USER UMP WITH GRANT OPTION 

GRANT USE OF TABLESPACE UNICA TO USER UC  WITH GRANT OPTION

GRANT USE OF TABLESPACE UNICA TO USER UMO WITH GRANT OPTION

Thursday, December 18, 2014

Installing DB2 Data Studio on Linux - libswt-pi-gtk.so error

If you can the following errors, it means you don't have 32bit GTK components installed:

unica@rhel-server-6 staging]$ ./install
00:00.38 ERROR [main] com.ibm.cic.agent.internal.ui.AgentUI reportStatus
  Could not load SWT library. Reasons:
      /apps/staging/configuration/org.eclipse.osgi/bundles/109/1/.cp/libswt-pi-gtk-4237.so (libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory)
      swt-pi-gtk (Not found in java.library.path)
      /home/unica/.swt/lib/linux/x86/libswt-pi-gtk-4237.so (libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory)
      /home/unica/.swt/lib/linux/x86/libswt-pi-gtk.so (/home/unica/.swt/lib/linux/x86/liblibswt-pi-gtk.so.so: cannot open shared object file: No such file or directory)
  java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
    /apps/staging/configuration/org.eclipse.osgi/bundles/109/1/.cp/libswt-pi-gtk-4237.so (libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory)
    swt-pi-gtk (Not found in java.library.path)
    /home/unica/.swt/lib/linux/x86/libswt-pi-gtk-4237.so (libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory)
    /home/unica/.swt/lib/linux/x86/libswt-pi-gtk.so (/home/unica/.swt/lib/linux/x86/liblibswt-pi-gtk.so.so: cannot open shared object file: No such file or directory)

    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:331)
    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:240)
    at org.eclipse.swt.internal.gtk.OS.<clinit>(OS.java:22)
    at java.lang.J9VMInternals.initializeImpl(Native Method)
    ...
The displayed failed to initialize.  See the log /apps/staging/configuration/1418895329737.log for details.

To solve:

yum install gtk2.i686 gtk2-engines.i686 PackageKit-gtk-module.i686 PackageKit-gtk-module.x86_64 libcanberra-gtk2.x86_64 libcanberra-gtk2.i686

Wednesday, December 17, 2014

rdma and log_mtts_per_seg when installing DB2 10.5

I got the following errors when running db2prereqcheck:

Validating "rdma" ...
Found package "rdma" on host "localhost.localdomain".
DBT3566E  The db2prereqcheck utility detected that the service named "rdma" is not enabled on host "localhost.localdomain".
   ERROR : Requirement not matched.


Validating "modprobe.conf" ...
DBT3588W  The db2prereqcheck utility was unable to validate the configuration of the log_mtts_per_seg parameter on the following host machine: "localhost.localdomain". Reason code: "1".
   WARNING : Requirement not matched.


After doing some research, since I am not using the DB2 PureScale features, it should be OK to ignore these errors.