Search

Ramchandra's Weblog

Just ……everything about DB2 LUW

Month

February 2009

DBA DOCUMNETS

Overview Database Administration

DB2 ROWS TO COLUMN

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

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

DB2 manually archiving transaction logs to TSM using user exit

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

IBM developerWorks : Top ten AIX and UNIX articles and tutorials—May 2007

Top ten AIX and UNIX articles and tutorials

Learn 10 good UNIX usage habits

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

Advanced techniques for using the UNIX find command

AIX commands you should not leave home without

AIX commands you should not leave home without

DB2 9 certification: Everything you need to know

DB2 9 certification: Everything you need to know

DB2 9 certification: Everything you need to know

Blog at WordPress.com.

Up ↑