Db2commandLine

ftp://ftp.software.ibm.com/ps/products/db2/info/vr8/pdf/letter/db2n0e80.pdf

http://www3.software.ibm.com/ibmdl/pub/software/dw/dm/db2/dm-0406qi/CLPCommands_v8.1.pdf

http://www3.software.ibm.com/ibmdl/pub/software/dw/dm/db2/dm-0406qi/systemCommands.pdf


 * Create and run a SP on DB2**

Save the file as Sample.db2

CREATE PROCEDURE SP_SAMPLE

BEGIN

DECLARE c CURSOR WITH RETURN FOR

SELECT MAJOR_LINE_NM FROM TABLE fetch first 1 row only;

OPEN c;

END@


 * Compile the DB2 SP**

db2 -td@ -f Navneet_1.db2


 * call the DB2 SP**

db2 call SP_SAMPLE

**-**   db2 "call SP_SAMPLE_VAR ('04/08/2013')"

 **Create Sequence On a DB2 Object** __CREATE SEQUENCE__ __ORG_SEQ__ __START WITH__ __1__ __INCREMENT BY__ __1__ __NO MAXVALUE__

**To Drop Sequence**

__Drop Sequence __

__Teminate when the table ends with -668 error__

__load from /dev/null of del modified by coldel|__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__messages /tmp/M_Quest_L.msg__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__tempfiles path /tmp/M_quest_L__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__terminate into DBINTR2.M_QUEST_L__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__statistics no__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__nonrecoverable__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__PARTITIONED DB CONFIG__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__MODE PARTITION_AND_LOAD__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__TRACE 10;__

<span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__**IMPORT STATEMENT**__

<span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__db2 "export to Labcorp_Server1 of del modified by coldel| select * from dbintr2.M_labcorp_L_ODS"__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__db2 "export to /home/smolga01/scripts/Development/labcorp/ of del modified by coldel| messages /edw_work3/extract.msg select * from dbintr2.M_LABCORP_L"__

<span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__**LOAD STATMENT**__

<span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__load from /home/smolga01/LABDATA/labcorp.dat of del modified by coldel|__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__messages /tmp/M_LABCORP_L_ODS.msg__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__tempfiles path /tmp/M_LABCORP_L_ODSM_LABCORP_L_ODS__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__replace into DBINTR2.M_LABCORP_L_ODS__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__statistics no__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__nonrecoverable__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__PARTITIONED DB CONFIG__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__OUTPUT_DBPARTNUMS (1,2,3,4,5,6,7,8)__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__PARTITIONING_DBPARTNUMS (1,2,3,4,5,6,7,8)__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__MODE PARTITION_AND_LOAD__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__TRACE 10;__

<span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__TS_DATA08_16K__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__in TS_CTL_16K__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__PARTITIONING KEY (SEQUENCE_NUM)__

<span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__**Load when failed by some means the Table goes into Inconsisten State so as to recover the table with the data in it, we have to use the following command**__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__load from /home/smolga01/LABDATA/labcorp.dat of del modified by coldel|__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__messages /tmp/M_LABCORP_L_ODS.msg__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__tempfiles path /tmp/M_LABCORP_L_ODSM_LABCORP_L_ODS__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__**terminate** into DBINTR2.M_LABCORP_L_ODS__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__statistics no__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__nonrecoverable__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__PARTITIONED DB CONFIG__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__OUTPUT_DBPARTNUMS (1,2,3,4,5,6,7,8)__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__PARTITIONING_DBPARTNUMS (1,2,3,4,5,6,7,8)__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__MODE PARTITION_AND_LOAD__ <span style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">__TRACE 10;__

RUNSTATS ON TABLE db2admin.department ON KEY COLUMNS

DB2 Enterprize Edition Explanation. []

Ref

Desizip.com