Showing posts with label db2 general. Show all posts
Showing posts with label db2 general. Show all posts

Sunday, October 26, 2014

SQL1220N The database manager shared memory set cannot be allocated

I faced this error while using db2 on Ubuntu 12.04 desktop, When tried to start instance it failed as below.

SQL1220N

The database manager shared memory set cannot be allocated.

The term shared memory is a term used to describe a type of memory management in the Unix kernel.  It is a memory region that can shared between different processes. Using a shared memory model, this avoids creating duplicate copies of memory.  So programs can eaily share data.
SHMMAX is just the maximum size of a single shared memory segment.  It’s size is represented in bytes”.

By default SHMMAX is 32 MB , Here db2 database manager wasn't able to start the instance with existing SHMMAX value use cat /proc/sys/kernel/shmmax to find out current value, so What we do is increase the value

Place an entry in /etc/sysctl.conf like kernel.shmmax=500000000, which is around 500MB just restart the machine and we are good to go. If not working increase it to 1 gb or more.

db2inst1@ubuntu:~$ db2start
10/26/2014 18:50:07     0   0   SQL1063N  DB2START processing was successful.
SQL1063N  DB2START processing was successful.

Tuesday, July 1, 2014

Migration of db2 v9.7 to v10.1 / Upgrade of DB2 v9.7 to v10.1

Migration of db v9.7 to v10.1

1) First run db2ckupgrade to find out if we are allowed to migrate the instance to 10.1 level
2) After db2ckupgrade is successful, stop the instance and install the db2 v10.1 binaries
3) We now upgrade the instance code level to 10.1 using command db2iupgrade
4) once instance level has been upgraded we need to upgrade the databases under that instance

STEP 1

db2inst1@sairam:~/software/server$ ./db2ckupgrade -e -l /home/db2inst1/logfile -u db2inst1 -p db2inst1
DBT5508I  The db2ckupgrade utility completed successfully. The database or databases can be upgraded.

db2inst1@sairam:~/software/server$ more ~/logfile 
Version of DB2CKUPGRADE being run: VERSION "10.1"

Database: "SAMPLE"

DBT5537I  The db2ckupgrade utility has completed processing for database "SAMPLE".

DBT5508I  The db2ckupgrade utility completed successfully. The database or databases can be upgraded.

db2inst1@sairam:~/software/server$ db2ls

Install Path                       Level   Fix Pack   Special Install Number   Install Date                  Installer UID
---------------------------------------------------------------------------------------------------------------------
/opt/ibm/db2/V9.7                 9.7.0.9        9                            Tue Jul  1 16:48:02 2014 IST             0
db2inst1@sairam:~/software/server$
db2inst1@sairam:~/software/server$

db2inst1@sairam:~/software/server$ db2stop
01/07/2014 18:03:05     0   0   SQL1064N  DB2STOP processing was successful.
SQL1064N  DB2STOP processing was successful.

db2inst1@sairam:~/software/server$ ls -lrt
total 64
-r-xr-xr-x  1 db2inst1 db2inst1 5154 May 15 16:55 db2prereqcheck
-r-xr-xr-x  1 db2inst1 db2inst1 5154 May 15 16:55 db2setup
-r-xr-xr-x  1 db2inst1 db2inst1 5172 May 15 16:55 db2_install
-r-xr-xr-x  1 db2inst1 db2inst1 5136 May 15 16:55 db2ls
-r-xr-xr-x  1 db2inst1 db2inst1 5302 May 15 16:55 db2_deinstall
-r-xr-xr-x  1 db2inst1 db2inst1 5190 May 15 16:56 installFixPack
-r-xr-xr-x  1 db2inst1 db2inst1 5349 May 15 16:56 db2ckupgrade
drwxr-xr-x 28 db2inst1 db2inst1 4096 May 15 16:56 doc
drwxr-xr-x  6 db2inst1 db2inst1 4096 May 15 16:56 db2

STEP 2

db2inst1@sairam:~/software/server$ sudo ./db2_install 
............................................
......................................
.......................
The execution completed successfully.

For more information see the DB2 installation log at
"/tmp/db2_install.log.52793".

db2inst1@sairam:~/software/server$ db2ls

Install Path                       Level   Fix Pack   Special Install Number   Install Date                  Installer UID
---------------------------------------------------------------------------------------------------------------------
/opt/ibm/db2/V9.7                 9.7.0.9        9                            Tue Jul  1 16:48:02 2014 IST             0 
/opt/ibm/db2/V10.1               10.1.0.4        4                            Tue Jul  1 18:08:00 2014 IST             0 

STEP 3

db2inst1@sairam:/opt/ibm/db2/V10.1/instance$ sudo ./db2iupgrade db2inst1
DBI1446I  The db2iupgrade command is running.

DB2 installation is being initialized.

 Total number of tasks to be performed: 4
Total estimated time for all tasks to be performed: 309 second(s)

Task #1 start
Description: Setting default global profile registry variables
Estimated time 1 second(s)
Task #1 end

Task #2 start
Description: Initializing instance list
Estimated time 5 second(s)
Task #2 end

Task #3 start
Description: Configuring DB2 instances
Estimated time 300 second(s)
Task #3 end

Task #4 start
Description: Updating global profile registry
Estimated time 3 second(s)
Task #4 end

The execution completed successfully.

For more information see the DB2 installation log at
"/tmp/db2iupgrade.log.23052".
DBI1070I  Program db2iupgrade completed successfully.

db2inst1@sairam:~$ db2level
DB21085I  This instance or install (instance name, where applicable:
"db2inst1") uses "64" bits and DB2 code release "SQL10014" with level
identifier "0205010E".
Informational tokens are "DB2 v10.1.0.4", "s140509", "IP23584", and Fix Pack
"4".
Product is installed at "/opt/ibm/db2/V10.1".

db2inst1@sairam:~$ db2 list db directory

 System Database Directory

 Number of entries in the directory = 1

Database 1 entry:

 Database alias                       = SAMPLE
 Database name                        = SAMPLE
 Local database directory             = /home/db2inst1
 Database release level               = d.00
 Comment                              =
 Directory entry type                 = Indirect
 Catalog database partition number    = 0
 Alternate server hostname            =
 Alternate server port number         =

db2inst1@sairam:~$ db2level
DB21085I  This instance or install (instance name, where applicable:
"db2inst1") uses "64" bits and DB2 code release "SQL10014" with level
identifier "0205010E".
Informational tokens are "DB2 v10.1.0.4", "s140509", "IP23584", and Fix Pack
"4".
Product is installed at "/opt/ibm/db2/V10.1".

db2inst1@sairam:~$ db2start
07/01/2014 18:14:31     0   0   SQL1063N  DB2START processing was successful.
SQL1063N  DB2START processing was successful.

db2inst1@sairam:~$ db2 connect to sample
SQL5035N  The database must be upgraded to the current release.  
SQLSTATE=55001

STEP 4

db2inst1@sairam:~$ db2 upgrade db sample

DB20000I  The UPGRADE DATABASE command completed successfully.

db2inst1@sairam:~$ db2 connect to sample

   Database Connection Information

 Database server        = DB2/LINUXX8664 10.1.4
 SQL authorization ID   = DB2INST1
 Local database alias   = SAMPLE

db2inst1@sairam:~$ 

Monday, June 30, 2014

Installation methods of DB2 on Linux/Unix

Installation methods of DB2 on Linux/Unix - There are 4 methods, i will take this in a detailed with practical examples.

1) db2setup

The DB2 Setup wizard is a GUI installer available on Linux, UNIX, and Windows operating systems. The DB2 Setup wizard provides an easy-to-use interface for installing DB2 products and for performing initial setup and configuration tasks.
note: On Linux and UNIX platforms, an X server is required to display the DB2 Setup wizard.
a) uncompress the v9.7fp9_linuxx64_server.tar file
b) cd server
c) sudo ./db2prereqcheck
d) sudo ./db2setup  - a GUI installer will be opened and you just need to run through the steps and complete, its pretty straightforward and easy process.



2) response file installation

a) A response file is a text file that contains setup and configuration values. The file is read by the DB2 setup program and the installation is performed according to the values that have been specified, this method of installation is also referred as silent installation as you dont need to interact during the installation process
using db2setup wizard we can generate a response file, benefit of this installation method is that you can create a response file without performing an installation and later change the options based on your requirement.
a) uncompress the v9.7fp9_linuxx64_server.tar file
b) cd server
c) sudo ./db2prereqcheck
d) sudo ./db2setup - a GUI installer will be opened and follow the steps.. at step number 4 we will have an "save my installation settings in a response file" ( No software will be installed ) - follow through rest of steps based on your requirement and you will finally get response file generated by the end of all steps.



e) sudo ./db2setup -r responsefile

b) Customizing the sample response files that are provided for each DB2 product , sample file will be found in below location you can see after untar and unzipping the file
server/db2/platform/samples , where < platform >is the platform that you are installing on
a) uncompress the v9.7fp9_linuxx64_server.tar file
b) cd server/db2/platform/samples ( here platform refers to your OS ) , here you can see sample response file
c) copy the sample to your custom location and make changes according to your requirements and the specific components that you want to install, use that edited file to install db2 product
d) sudo ./db2setup -r  db2aese.rsp_filename

3) db2_install command

The db2_install command installs all components for the DB2 product, but i doesnt perform user and group creation, instance creation .
a) uncompress the v9.7fp9_linuxx64_server.tar file
b) sudo ./db2prereqcheck
c) sudo ./db2_install   ( follow the response and complete the installation )

4) payload file deployment

This method is an advanced installation method that is not recommended for most users. It requires the user to physically install payload files. A payload file is a compressed tarball that contains all of the files and metadata for an installable component.
a) uncompress the v9.7fp9_linuxx64_server.tar file
b) cd server/db2/linuxamd64/FILES
c) now we need to untar needed components to the location /opt/ibm/db2/V9.7
d) now we will setup the fault monitor by running command   DB2DIR/bin/db2fmcu -u -p /etc/inittab  ( DB2DIR is the installation location your prouduct)
e) check which level of db2 installed using command db2greg -dump
f) create instance and setup profile file ..

First 3 ways of installation of db2 product is recommended for all users and 4th method is for most advanced users and is also not a recommend method of db2 product installation by IBM.

Let me know your comments and issues that you faced during DB2 installation on Unix and Linux. And 4th method is a very interesting one, let me know if any you faced any particular issues using 4th method.

Wednesday, May 14, 2014

Learning DB2 Basics

Its always good to learn basics so let me share you some best books and tutorials.

1) Learning db2 visually with examples 2nd edition 2008 - this is my favorite book for DB2 learners . I got a soft copy luckily somewhere in internet, Often i read it on GS3 when i get bored ..



Link to download : https://www.mediafire.com/?cuy2zr07roj3et1  ( please don't share any alternative links as i want to see the original downloads count )

2) Want to learn db2 in video tutorials, luckily we have one for that as well. We can even download offline copy to watch it. You have to signup using Google or some... Its has two parts of tutorials. Once you read everything you can also take test to evaluate your learning's.

1) DB2 Essential Training I  (DB101EN)
2) DB2 Essential Training II (DB102EN)





Monday, April 28, 2014

Installing DB2 fixpack

Install DB2 Fix packs – Below steps are intended for Linux, Unix operating systems.


1) Perform the necessary tasks before installing a fix pack.
2) Choose a fix pack installation method and install the fix pack.
3) Perform the necessary tasks after installing the fix pack.
4) Apply the appropriate DB2 database product license.

1) Perform the necessary tasks before installing a fix pack

a) If you already have DB2 database product installed, the space required to install the fix pack is slightly greater than the space consumed by the existing DB2 database products. This space is only required temporarily during the fix pack installation process.

To determine the space used by the existing DB2 database products, perform the command:

du -h -s DB2DIR

where DB2DIR represents the location where the DB2 copy is installed.

b) Download the fix pack

c) Uncompress the fixpacks, use the below command

gunzip -c filename.tar.gz | tar -xvf - 

d) Before installing a fix pack, if there are DB2 database products installed in the selected installation path, you must stop all of the DB2 processes. If you have multiple DB2 copies, stop only the DB2 processes that are associated with the copy that you are updating.
Determine which instances are associated with the DB2 copy.

Issue the command: DB2DIR/instance/db2ilist

where DB2DIR represents the location where the DB2 copy is installed.

su - iname
db2 force application all
db2 terminate
db2stop
exit

If the DB2 Administration Server (DAS) belongs to the DB2 copy that you are updating, stop the DAS:
su - aname
db2admin stop
exit

where aname represents the DAS owner name.

e) Optional: On AIX, run slibclean to unload unused shared libraries from memory before installation:

/usr/sbin/slibclean

f) Disable the fault monitor processes. To stop the Fault Monitor Daemon, issue the command:

DB2DIR/bin/db2fm -i iname -D

where DB2DIR is the location where the DB2 copy is installed and iname represents the instance owner name. The command must be performed once for each instance in the DB2 copy.

g) Ensure all DB2 interprocess communications are cleaned for the instance to be updated. As the instance owner, run the following command at each physical partition:

$HOME/sqllib/bin/ipclean

2) Choose a fix pack installation method and install the fix pack.

There are 2 ways that you use the fixpack and installation methods that match the purpose.

1) Follow these instructions to install new DB2 database products at a particular fix pack level. The db2setup command is used to perform the installation.

Change to the directory that contains the fix pack image.

Launch the installation by issuing the command: ./db2setup

2) Follow these instructions if a DB2 database product is already installed and you want to apply a new fix pack level. The installFixPack command is used to install the fix pack.

You have two choices when it comes to fix pack installation; using a universal fix pack (all products) or a product-specific fix pack.

Why would I use the universal fix pack?
If I want to upgrade multiple products in place.
If I do not remember what I have installed to be able to install the fix pack in a new location without losing my current set of features or products.

Why would I use the product-specific fix pack?
If I have a single product and want to save the time to download the fix pack.
If system downtime is costly.
If I need to test the new fix pack without impacting my production databases.
If I need the ability to go back to the previous version quickly (system downtime in case of failure).
If I already have a fix pack installed and need to add new features or products to the fix pack.
Note: Many of these advantages can be achieved by installing from your original media to a new location and using the universal fix pack to upgrade features or products, however, there is a cost of extra installation time.

Launch the installation by issuing the installFixPack command. For example,

./installFixPack -b DB2DIR

where DB2DIR is the location of the DB2 database products that you want to update.

Note: I had seen below error in Linux environment.

Stopping DB2 Fault Monitor :.......Success
ERROR: The installFixPack command detected some DB2 libraries are still loaded
in memory and some applications might still be running in the current
installation copy.  All applications must be stopped. See the fix pack readme
for pre-installation instructions, and re-run the installFixPack command.
Alternatively, to override automatic checking, you can re-issue the
installFixPack command with the '-f db2lib' parameter. Note: If you re-issue
the installFixPack command with the '-f db2lib' parameter, after the DB2
instances are updated, some applications might not work properly and might need
to be restarted to function properly against the updated DB2 instance.

Preparing the system :.......Failure
Change to the directory that contains the fix pack image.

If you get error as above use the below command, and complete the install.

./installFixPack -b DB2DIR –f db2lib

3) Perform the necessary tasks after installing the fix pack.

a) For each instance, issue the command:

DB2DIR/instance/db2iupdt iname

where iname represents the instance name and DB2DIR represents the location where the DB2 copy is installed.

b) If the DB2 Administration Server (DAS) belongs to the DB2 copy where you installed the fix pack, issue the command:

DB2DIR/instance/dasupdt

where DB2DIR is the location where the DB2 copy is installed. If this DB2 copy is now running at a more recent fix pack level than all of the other DB2 copies, consider updating the DAS to belong to this DB2 copy.

c) Update the system catalog objects in your databases to support the fix pack.

db2updv97 -d dbname
where dbname represents the name of the database.

Note: Backup your database before running db2updv97. Some system objects might become unusable after moving back to an earlier fix pack, and your database will need to be restored.

d) Restart the instance , DAS admin

su - iname
db2start

su - dasuser
db2admin start

e) As part of a fix pack installation on the server, binding of the database utilities (IMPORT, EXPORT, REORG, the Command Line Processor) and the CLI bind files occurs automatically. However, if you install a fix pack on the client or an error occurs, you can manually bind the database utilities and the CLI bind files.

If you installed the fix pack on DB2 database products that have existing databases, perform the following commands once for each database:

db2 terminate
db2 CONNECT TO dbname user USERID using PASSWORD
db2 BIND path\db2schema.bnd BLOCKING ALL GRANT PUBLIC SQLERROR CONTINUE 
db2 BIND path\@db2ubind.lst BLOCKING ALL GRANT PUBLIC ACTION ADD 
db2 BIND path\@db2cli.lst BLOCKING ALL GRANT PUBLIC ACTION ADD 
db2 terminate

If you installed the fix pack on DB2 database products that have existing databases, rebind the packages by running the REBIND or db2rbind command.

db2rbind dbname -l  fullpath/logfile all 
fullpath refers to a valid path given with a name to log the rebind output

4) Apply the appropriate DB2 database product license.

INSTHOME/sqllib/adm/db2licm -a filename

Where INSTHOME represents the home directory of the instance owner and filename is the full path name and file name for the license file
Check the license information once after applying the license.

db2licm -l

All the commands used in the post are highlighted as Italic

Wednesday, February 19, 2014

How to create federation between two DB2 databases

The other day developer were asking if they access production table in their test databases. Here when we suggested them that we have Federation support across multiple RDMS vendors.

So lets get started quickly on how to create federation between two DB2 databases

It involves 5 steps Enable database to support federation, Create wrapper, server, usermapping, nicknames . First we need to check whether Federation support is switched on for our database, If you see that FEDERATION is set to off go head and update to YES and recycle the instance

db2inst1@test-machine:~$ db2 get dbm cfg | grep -i FEDERATED
 Federated Database System Support           (FEDERATED) = NO

db2inst1@test-machine:~$ db2 update dbm cfg using FEDERATED YES
DB20000I  The UPDATE DATABASE MANAGER CONFIGURATION command completed 
successfully.

db2inst1@test-machine:~$ db2stop
19/02/2014 17:41:06     0   0   SQL1064N  DB2STOP processing was successful.
SQL1064N  DB2STOP processing was successful.

db2inst1@test-machine:~$ db2start
02/19/2014 17:41:10     0   0   SQL1063N  DB2START processing was successful.

SQL1063N  DB2START processing was successful.

db2inst1@test-machine:~$ db2 get dbm cfg | grep -i FEDERATED
 Federated Database System Support           (FEDERATED) = YES

Wrapper : The CREATE WRAPPER statement registers a wrapper with a federated server. A wrapper is a mechanism by which a federated server can interact with certain types of data sources,The default wrapper name for the DB2 family data sources is DRDA.

Syntax : CREATE WRAPPER <wrappername> 

Server : The CREATE SERVER statement defines a data source to a federated database.

Syntax : CREATE SERVER <servername> TYPE <datasourcename> VERSION <serverversion> WRAPPER <wrappername> AUTHORIZATION "<remoteauthid>" PASSWORD "<password>" OPTIONS (DBNAME 'dbname') 

Usermapping : The CREATE USER MAPPING statement defines a mapping between an authorization ID that uses a federated database and the authorization ID and password to use at a specified data source.

Syntax : CREATE USER MAPPING for <authname> SERVER <servername> OPTIONS (REMOTE_AUTHID 'username',REMOTE_PASSWORD 'password')

Nicknames : The CREATE NICKNAME statement defines a nickname for a data source object. we use this nick name to fetch records from the federated database.

Syntax: : CREATE NICKNAME <nickname> for <servername>.<schenaname.tablename>

Now let me take a scenario and explain it using two db2 databases. My aim is to access table in TESTA database from the database MURALI 


murali@test-machine:~$ db2 connect to murali

   Database Connection Information

 Database server        = DB2/LINUXX8664 9.7.6
 SQL authorization ID   = MURALI
 Local database alias   = MURALI

create wrapper drda
DB20000I  The SQL command completed successfully.

create server fedserver TYPE DB2/UDB VERSION 9.7 WRAPPER drda  AUTHORIZATION "murali" password "murali" OPTIONS(DBNAME 'TESTA')
DB20000I  The SQL command completed successfully.

create user mapping for murali SERVER fedserver OPTIONS(REMOTE_AUTHID 'db2inst1',REMOTE_PASSWORD 'db2inst1')
DB20000I  The SQL command completed successfully.

create nickname mytable for fedserver.db2inst1.tab1
DB20000I  The SQL command completed successfully.

murali@test-machine:~$ db2 connect to murali

   Database Connection Information

 Database server        = DB2/LINUXX8664 9.7.6
 SQL authorization ID   = MURALI
 Local database alias   = MURALI

murali@test-machine:~$ db2 "select * from mytable"

ID      NAME      
------- ----------
     1. murali    
     2. sharath   
     3. balaji    
     4. praks     

  4 record(s) selected.

Post your comments and doubts about this topic here.

Tuesday, February 18, 2014

How to Drop schema including its contents in DB2

One day i was doing a schema refresh activity that's when this point came in, I first have to drop the schemas including content and then do a copy.

DB2 has provided us, with a admin procedure which drop's a specific schema and also all the objects contained in it. 

ADMIN_DROP_SCHEMA procedure

Syntax: ADMIN_DROP_SCHEMA(<schema>,<dropmode>,<errortabschema>,<errortab>)

<schemname> - Mention the name of the schema to be dropped in CAPTITAL LETTER
<dropmode> - Reserved for future use and should be set to NULL
<errortabschema> - specify the schema name of a table containing error information for objects that could not be dropped 
<errortab> - specify the name of a table containing error information for objects that could not be dropped.

Example: db2 "call ADMIN_DROP_SCHEMA('SAMPLE',NULL,'ERRORSCHEMA','ERRORTAB')"

db2inst1@test-machine:~$ db2 "call admin_drop_schema('SAMPLE',NULL,'ERRORSCHEMA','ERRORTAB')"

  Value of output parameters
  --------------------------
  Parameter Name  : ERRORTABSCHEMA
  Parameter Value : -

  Parameter Name  : ERRORTAB
  Parameter Value : -

  Return Status = 0

Return status=0 so it means success. Just query the schemaname in database and could see it created ERRORSCHEMA and as it didn't have any issues no errortable is created. If a schema doesn't contain any objects it easy to drop a schema using simple command

db2 "drop schema <schemaname> RESTRICT"

RESTRICT keyword enforces the rule that no objects can be defined in the specified schema for the schema to be deleted from the database

Let me use it on the empty schema which is just created when we tried to drop SAMPLE schema using ADMIN_SCHEMA_DROP procedure, Below is the example for it.


db2inst1@test-machine:~$ db2 "list tables for schema errorschema"

Table/View                      Schema          Type  Creation time             
------------------------------- --------------- ----- --------------------------

  0 record(s) selected.

db2inst1@test-machine:~$ db2 "drop schema errorschema restrict"
DB20000I  The SQL command completed successfully.

I dropped the schema using admin_drop_schema and it has given me return status 0, still i could able to see it in catalog. After some research i understood that there are some dependants which are dropped so i was unable to drop it from catalog. I then took
DB2LOOK for the specific schema and then was able to the USER DEFINED DATA TYPES which are there so i was unable to drop the schema from catalog. I then dropped the user defined dataypes and executed the command db2 "drop schema schemaname restrict" this time
i was able to drop it from catalog. Before dropping the user defined data types i saved them in some file so if needed i can create them again. Also to make sure if your left with any more take a DB2LOOK and check again, Below is the example for the same.
db2 "drop type userdefined1"
DB20000I  The SQL command completed successfully.
db2 "drop type userdefined2"
DB20000I  The SQL command completed successfully.
db2 "drop schema schemaname restrict"
DB20000I  The SQL command completed successfully.

References from IBM : ADMIN_DROP_SCHEMA procedure V9.7



Thursday, February 13, 2014

Catalog a DB2 database

Aim : Need to access a remote database as local database on the server that i currently reside on. For this we need to catalog the database

Works on : Machine having db2 server or client sotware installed on it

Its a two step process First catalog node then catalog database.

Catalog Node   - This puts an entry into node directory.
Catalog Database - This puts an entry into local database directory.

Syntax

db2 catalog tcpip node <NODENAME> remote <REMOTE> server <PORT>

use can use any name for <nodename>, this is just for indetification purpose.
use the ip address or hostname of the target machine for <remote> parameter.
use port number on which the db2 server is listening to <PORT> for allowing incoming connections.

To get the ip address of machine, use command - ifconfig -a
To get the hostname or machine name, use command - hostname
To get the port number to which db2 server is listening to, use command - db2 get dbm cfg | grep SVCE 
SVCENAME is the service name of db2, which we need to match this services files in /etc/services to get the respective port number for the service name(SVCENAME) 


this is example of matching SVCENAME to respective portnumber in /etc/services file

db2inst1@test-machine:~$ db2 get dbm cfg | grep SVCE
 TCP/IP Service name                          (SVCENAME) = db2c_db2inst1
 SSL service name                         (SSL_SVCENAME) = 
db2inst1@test-machine:~$ 
db2inst1@test-machine:~$ cat /etc/services | grep db2c_db2inst1
db2c_db2inst1 50001/tcp

db2 catalog database <dbname> as <aliasname> at node <nodename>

use database name for <dbname> you can also put an alias name for that database using <aliasname> if you dont want any such just ignore it.
user node name that is defined in the first command <nodename>

Always make sure to check the connectivity to the database, that how its shown below.

db2inst1@test-machine:~$ db2 connect to test1 user murali using murali

   Database Connection Information

 Database server        = DB2/LINUXX8664 9.7.6
 SQL authorization ID   = MURALI
 Local database alias   = TEST1

Tuesday, February 11, 2014

Installation of DB2 V9.7 on UBUNTU 12.04 - PART 2

PART 2


Now drag and drop the downloaded copy of IBM DB2 Data server trail copy from your Windows machine to Ubuntu. Follow below instructions.

Always remember we are doing root installation, so remember to use sudo command / else login into root account and setup the db2


1) To extract zipped files to a directory use command                                                
tar -xvf v9.7_linuxx64_server.tar.gz       -
2) change to extracted directory use, list the files and you can now see 7 script files and 2 directories. Now we need to validate if all the prerequisites are met to continue installing DB2 in the machine.

use this command sh db2prereqcheck it will show you errors/warnings like below.

WARNING:
   The 32-bit library file libpam.so is not found on the system
ERROR:
The required library file libstdc++.so.5 is not found on the system.
ERROR:
The required library file libaio.so.1 is not found on the system.

To fix this errors, we need to download and install below packages. Use below commands

1) sudo apt-get install libpam0g:i386 
2) sudo apt-get install libstdc++5
3) sudo apt-get install libaio-dev


libpam.so.0 (32-bit) is required for DB2 database servers to run 32-bit non-SQL routines, use the command, libaio.so.1 is required for DB2 database servers using asynchronous I/O.
libstdc++.so.5 is required for DB2 database servers and clients.

After install all 3 packages above run the prereqcheck again and see if we are good. Following all the instructions above shall give you no errors and warnings during prereqcheck

Now run sh db2setup to start the actual installation, DB2 Launch pad will open.

From the DB2 Setup launchpad, you can view installation prerequisites and the release notes, or you can proceed directly to the installation. 

Click Install a Product and the Install a Product window displays the products available for installation.
If you have no existing DB2 database products installed on your computer, launch the installation by clicking Install New. Proceed through the installation following the DB2 Setup wizard prompts.

If you have at least one existing DB2 database product installed on your computer, you can:
1) Click Install New to create a new DB2 copy.
2) Click Work with Existing to update an existing DB2 copy, to add function to an existing DB2 copy, upgrade an existing DB2 Version 9.5 and Version 9.7 copy, or to install an add-on product.

After the installation completes, login into the instance user and enter db2 to enter into interactive mode. Now your are good to fly into db2 world....

db2inst1@test-machine:~$ db2
(c) Copyright IBM Corporation 1993,2007
Command Line Processor for DB2 Client 9.7.6
.....................................................................
.....................................................................

For more detailed help, refer to the Online Reference Manual.

db2 => 




Friday, January 31, 2014

Installation of DB2 V9.7 on UBUNTU 12.04 - PART 1

Aim : Installing DB2 for training and personal use.



To decide whether to install DB2 in Linux or Unix or Windows, My choice would be Linux as we have some open source operating systems in Linux which are available with no license fee. So i consider Ubuntu 12.04 for all my trainings and learning with DB2. I am not sure about other editions of Ubuntu as i didn't test them. Also my machine is Windows 7 Home premium 64 bit so i consider 64 bit softwares for all my installations.



1) Download Vmware workstartion evaluation copy from Vmware official site. Below is the link for download

http://www.vmware.com/products/workstation/workstation-evaluation

2) Download Ubuntu 12.04 Desktop from below link from Ubuntu official site. Below is the link for download

http://www.ubuntu.com/download/desktop 

3) Download 90 day free trail of DB2 LUW V9.7 Data server which has all the enterprise server features so that we can use all features to test with ease. Below is the link for the download from IBM official site, it will ask for username and password if your are not having one just register with them, login and download the software.

https://www14.software.ibm.com/webapp/download/preconfig.jsp?id=2009-06-19+07%3A01%3A41.585238R&S_TACT=&S_CMP=

After downloading all 3 softwares now first Install Vmware software on your 64 bit Machine. Simple and easy, click on setup file just follow instructions needed to complete it.

Install Vmware workstation on your Windows 7 Machine and once done start Vmware workstation and create new virtual machine for installing Ubuntu 12.04 Desktop. Just follow instructions given in there to create new virtual machine, but if you are a newbie or have any doubts about installation just follow the below YouTube video to get it done.




Login to your new machine with the username and password given during the installation. Now you need to copy DB2 data server trail to your Ubuntu machine, to achieve we can't copy and paste from windows machine directly without having Vmware tools installed in Ubuntu.

For that now we install Vmware tools. Follow below instructions -

1) Goto VM tab in Vmware workstartion click on Install VMware tools....  

2) Window appears on your screen, copy the file VMwareTools-<verison>.tar.gz from the folder to terminal by just dragging the file into terminal, in terminal use command cp <file> .

3) use command sudo tar -xvf <file-name> to extract files into a directory 

4) change to directory cd <dir-name> there will be one perl file used for installation, use sudo perl <file-name.pl>  just hit enter in keyboard using all the default values given there it will take approximately 2 mins to install Vmware tools. Now we are good to use drag and drop from our Host Windows machine to Guest Ubuntu machine shutdown the Ubuntu machine, go to VM tab in Vmware workstation and click on Settings click on Options tab and see that Shared folders option enabled and Guest Isolation tick the 2 options Enable drag and drop, Enable copy and paste.

Note: Above lines mentioned in bold are commands and lines given in brackets    < > should be the filenames respective to your locations and files.

Till now we have installed Vmware workstation in Windows 7 Host machine, Ubuntu new virtual machine in VM, Vmware tools in Ubuntu for using drag and drop functionality into guest - Ubuntu. 

It would be long post if i continue so i would like to split this post into 2 posts, for this will be the end of first post.