DBA DOCUMNETS

•February 23, 2009 • Leave a Comment

DB2 ROWS TO COLUMN

•February 23, 2009 • Leave a Comment

CREATE A TABLE AS BELOW

create table PIVOT(
    ID INTEGER,
    NAME  CHAR(10),
    COLCOUNT  INTEGER
)

INSERT THE VALUES AS BELOW 

SELECT * FROM PIVOT

/*
ID    NAME    COLCOUNT
1    COL101        1
1    COL102        2
1    COL103        3
2    COL201        1
2    COL202        2
2    COL203        3
*/

QUERY
SELECT
    ID,
    max(case when COLCOUNT = 1 THEN NAME end) AS COL1,
    max(case when COLCOUNT = 2 THEN NAME end) AS COL2,
    max(case when COLCOUNT = 3 THEN NAME end) AS COL3
FROM PIVOT
GROUP BY ID

/*
ID    COL1    COL2    COL3
1    COL101        COL102        COL103   
2    COL201        COL202        COL203   
*/

Setting Up a User Exit on DB2 UDB V8 to Archive Database Logs

•February 22, 2009 • Leave a Comment

DB2 manually archiving transaction logs to TSM using user exit

•February 22, 2009 • Leave a Comment

have you missed any logs being archived to TSM user exit because of some problem in TSM server or User exit itself.

here is how you do it manually:-

db2uext2 -OS<os> -RL<release> -RQ<request> -DB<dbname> -NN<nodenumber>  -LP<logpath> -LN<logname> [-AP<adsmpasswd>]

to set all this option best way is to look at userexit  ARCHIVE.LOG  . you will have entry as below.

********************************************************************************
Time Started:      Fri Aug 22 18:01:55 2008

Parameter Count:      8
Parameters Passed:
Database name:     TST_PROD
Logfile name:      S0024899.LOG
Logfile path:      /transaction_logs/NODE0000/
Node number:       NODE0000
Operating system:  Linux/Z64
Release:           SQL08029
Request:           ARCHIVE
System Action:     ARCHIVE from /transaction_logs/NODE0000/ file S0024899.LOG to TSM for database NDB_PROD
Media Type:        TSM
User Exit RC:      0
Time Completed:    Fri Aug 22 18:01:56 2008

********************************************************************************

now you have all the option parameters required.

#db2uext2 -OSLinux/Z64 -RLSQL08029 -RQARCHIVE -DBTST_PROD -NNNODE0000  -LP/transaction_logs/NODE0000/ -LNS0039440.LOG

after you archive the logs you can cross verify using db2adutl command.

#db2adutl query logs db TST_prod

Top ten AIX and UNIX articles and tutorials—May 2007

•February 19, 2009 • Leave a Comment

Learn 10 good UNIX usage habits

•February 19, 2009 • Leave a Comment

UNIX tips: Learn 10 good UNIX usage habits

Adopt 10 good habits that improve your UNIX® command line efficiency — and
break away from bad usage patterns in the process. This article takes you step-by-step
through several good, but too often neglected, techniques for command-line operations.
Learn about common errors and how to overcome them, so you can learn exactly why
these UNIX habits are worth picking up.

Advanced techniques for using the UNIX find command

•February 19, 2009 • Leave a Comment

AIX commands you should not leave home without

•February 19, 2009 • Leave a Comment

DB2 9 certification: Everything you need to know

•February 18, 2009 • Leave a Comment

DB2 9 certification: Everything you need to know

DB2 9 certification: Everything you need to know

How to remove duplicate rows/date from a table

•February 17, 2009 • Leave a Comment

doyouDB2.com – How to remove duplicate rows/date from a table

How to remove duplicate rows/date from a table