-- ==================================================================-- -- Run the following Rexx directly in your DB2I2 Work Bench -- -- ==================================================================-- Do ll = 1 to 10 Say time() Address Tso "TWAIT PERD00000100" End -- ================================================================= -- -- RUN with Trunc=Y Truncate result to fit the current wk bench -- -- RUN with Edit=Y Edit result dataset -- -- RUN with Duration=y Generate begining, ending and Duration info -- -- ================================================================= -- LINEOBJ SELECT "QUERYNO", "APPLNAME", "PROGNAME", "COLLID" , "GROUP_MEMBER", "EXPLAIN_TIME", "STMT_TYPE" , "COST_CATEGORY", "PROCMS", "PROCSU", "REASON" , "STMT_ENCODE", "TOTAL_COST" FROM "DB2ADM"."DSN_STATEMNT_TABLE" FETCH FIRST 5 ROWS ONLY END_LINEOBJ db2i2rex "run in duration=y trunc=y idd=db2i2rxl" -- -- Run with host variable support -- LINEOBJ SELECT "QUERYNO", "APPLNAME", "PROGNAME", "COLLID" , "GROUP_MEMBER", "EXPLAIN_TIME", "STMT_TYPE" , "COST_CATEGORY", "PROCMS", "PROCSU", "REASON" , "STMT_ENCODE", "TOTAL_COST" FROM "DB2ADM"."DSN_STATEMNT_TABLE" WHERE QUERYNO = &QNO FETCH FIRST 5 ROWS ONLY END_LINEOBJ db2i2rex "run in duration=y trunc=y idd=db2i2rxl &QNO=0" -- -- Run with -INC -- LINEOBJ -INC idsn=pds.cntl(qry) END_LINEOBJ db2i2rex "run in duration=y trunc=y idd=db2i2rxl &QNO=0" -- ================================================================= -- -- DSCOPY cont=y Continue & bypass process if there are difference -- -- nostops Do not stop source objects -- -- nostop Do not stop both source and target objects -- -- ================================================================= -- LINEOBJ SC DDB2ADM.SDB2ADM DDB2ADM.SMAP SC DDB2ADM.SDB2ADM DDB2ADM.SDB2ADM END_LINEOBJ db2i2rex "dscopy cont=y nostops idd=db2i2rxl" -- ================================================================= -- -- DISPLAY TSIX RESTRICT EDIT=Y -- -- ================================================================= -- LINEOBJ TS DDB2ADM.* END_LINEOBJ db2i2rex "display edit=y idd=db2i2rxl tsix" -- ================================================================= -- -- Drill Down PG or DM with $ Q=qualifier -- -- EXPLAIN from PG or DM Drilldown with T=N option -- -- Global Variable, once is defined, can be used anywhere -- -- ================================================================= -- LINEOBJ PG .DB2ADM.DSN8CLRV. PG .DB2ADM.DSN8HC3. END_LINEOBJ db2i2rex "idd=db2i2rxl odsn=t1 t=n" db2i2rex "&exp idsn=t1 odsn=t2" -- ================================================================= -- -- DFLTSP=(pri,sec) with utility for object without runstats -- -- ================================================================= -- LINEOBJ ts ddb2adm.sdb2adm END_LINEOBJ db2i2rex "rebuild pu(rbldall)", "idd=db2i2rxl", "dfltsp=(1,100)" -- "template=tmp(rb)" -- ================================================================= -- -- WKSP=(type,pri,sec,dir) instead of WKSP=1 -- -- Default have been change from CYL,1,1 to TRK,1,1 -- -- ================================================================= -- -- Recover To RBA with Rebuild Indexes -- -- ================================================================= -- LINEOBJ TS DDB2ADM.SDB2ADM BP8K0 0 P N N N 16 2 TS DDB2ADM.SMAP BP0 0 A N N Y 4 8 END_LINEOBJ db2i2rex "rba idd=db2i2rxl" db2i2rex "recover idd=db2i2rxl pu(rcvrrbaa) odsn=t3" db2i2rex "rebuild pu(rbldall)", "idd=db2i2rxl odsn=t3 append step#=10 jobcard=n", "template=tmp(rb)" -- ================================================================= -- -- Recover to Last Quiesce with Rebuild Indexes -- -- ================================================================= -- LINEOBJ TS DDB2ADM.SDB2ADM BP8K0 0 P N N N 16 2 TS DDB2ADM.SMAP BP0 0 A N N Y 4 8 END_LINEOBJ db2i2rex "qbuild f1=dbname f2=tsname odsn=t1 idd=db2i2rxl" db2i2rex "run t=n idsn=pds.cntl(qq) odsn=t2" db2i2rex "rxdb2i2 idsn=t2" db2i2rex "recover idd=db2i2rxl pu(rcvrrbaa) odsn=t3" db2i2rex "rebuild idd=db2i2rxl pu(rbldall)", " odsn=t3 append step#=10 jobcard=n" Say "It is all done in RXDB2I2!!!" -- ================================================================= -- -- Smart Recovery with Report To RBA Recovery -- -- ================================================================= -- LINEOBJ DB DDB2ADM END_LINEOBJ -- drill down db to get all ts line objects db2i2rex "idd=db2i2rxl odsn=t1 t=n" -- RBA to get all RBA points for all TS line objects db2i2rex "rba idsn=t1" -- REPORT recovery to RBA db2i2rex "report idsn=t1 pu(rptrba) odsn=t3" -- PAUSE Here Until Prevoius Submitted Job is Done If sysdsn(db2i2.report.recovery) \= 'OK' Then Do Say "** No objects needed to be Recovered" Exit 4 End db2i2rex "recover idsn=db2i2.report.recovery pu(rcvrrbaa) odsn=t3" db2i2rex "rebuild pu(rbldall)", "idsn=db2i2.report.recovery odsn=t3 append step#=10 jobcard=n", "template=tmp(rb)" -- ================================================================= -- -- Smart Recovery with Report To RBA Recovery to Last Quiesec Point -- -- ================================================================= -- LINEOBJ DB DDB2ADM END_LINEOBJ db2i2rex "odsn=t0 idd=db2i2rxl t=n" db2i2rex "qbuild f1=dbname f2=tsname odsn=t1 idsn=t0" db2i2rex "run t=n idsn=pds.cntl(qq) odsn=t2" db2i2rex "rxdb2i2 idsn=t2" db2i2rex "report idsn=t0 pu(rptrba) odsn=t3 jobnm=db2admrp" Address Tso "Submit T3" -- PAUSE Here for 10 Seconds Until Prevoius Submitted Job is Done -- TWAIT formate PERDhhmmssmm Address Tso "TWAIT PERD00001000" If sysdsn(db2i2.report.recovery) \= 'OK' Then Do Say "** No objects needed to be Recovered" Exit 4 End db2i2rex "recover idsn=db2i2.report.recovery pu(rcvrrbaa) odsn=t3" db2i2rex "rebuild pu(rbldall)", "idsn=db2i2.report.recovery odsn=t3 append step#=10 jobcard=n", "template=tmp(rb)" db2i2rex "Flist t3 121"