DB2 BIND处理

db2 bind处理

1)涉及db2的cobol程序编译过程



2)bind处理相关联对象
DBRM : Database Request Module/数据库请求模块
DBRM实现的功能主要有以下2条
  ◆ 绑定Package
  ◆  绑定Plan

Package : SQL语句处理之后生成的结果,存放在DB2中。
          Package同cobol代码编译链接生成的Load Module比较类似。
          该对象同Load Module同样,有相同的Timestamp和Contoken,
          在运行时,Package和Load Module的属性会比较处理,不同的时候出现-805错误。

PackageList : Package的集合。在db2中这个集合称为collection。
Plan可以是Packagelist的集合,Packelist是Package的集合,
Plan名称和Package名称是通过db2相关联的,可以通过sysibm.syspacklist查询。
Plan一旦建立,在不添加新的Packlist的前提下,Plan不需要重新编译,只更新Package就可以了。
相关联的3张数据表:sysibm.syspacklist;sysibm.syspackage;sysibm.sysplan

3)bind用jcl

Plan bind
*****************************************************************
//PLANBIND EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(0,LT)
//SYSTSPRT   DD SYSOUT=*
//SYSPRINT   DD SYSOUT=*
//SYSUDMMP   DD SYSOUT=*
//SYSTSIN    DD *
DSN SYSTEM(dbb1)
BIND PLAN(plan-name )     -
     PKLIST(pkl-name1.*  -
            pkl-name2.*  -
            pkl-name3.*) -
     ACT(ADD) ISO(CS) VALIDATE(BIND) QUALIFIER(table-space-name) -
     CURRENTDATA(NO) DEGREE(1) DYNAMICRULES(BIND)
/*
//GRANT0 EXEC PGM=IKJEFT01,DYNAMNBR=20,COUND=(0,LT)
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSTSIN  DD *
DSN SYSTEM(dbb1)
RUN PROGRAM(DSNTIAD) PLAN(DSNTIAD) LIBRARY('dbb1.runlib.load')
END
/*
//SYSIN    DD *
  GRANT EXECUTE ON PLAN plan-name TO id1,id2,id3
/*
*****************************************************************

Package bind
*****************************************************************
//SYSTSIN  DD *
DSN SYSTEM(dbb1)
BIND PRCKAGE(package-name) member(pg-name) QUALIFIER(table-space-name) -
     VALIDATE(BIND) EXPLAIN(YES) ISO(CS) CURRENTDATA(NO)
RUN  PROG(DSNTIAD) PLAN(DSNTIAD) LIBRARY('dbb1.runlib.load')
/*
*****************************************************************

4)db2相关联问答

Q4) Explain what a plan is?

A4) Plan is a DB2 object (produced during the bind process) that associates one or more database request modules with a plan name.

Q5) What is a DB2 bind?

A5) Bind is a process that builds “access paths” to DB2 tables. A bind uses the Database Request Modules(s) (DBRM(s)) from the DB2 pre-compile step as input and produces an application plan. It also checks the user’s authority and validates the SQL statements in the DBRM(s).

Q2) What is an access path?

A2) The path that is used to get to data specified in SQL statements.

Q6) What information is used as input to the bind process?

A6) The database request module produced during the pre-compile. The SYSIBM.SYSSTMT table of the DB2 catalog.

Q19) What is a Database Request Module(DBRM)?

A19) A DBRM is a DB2 component created by the DB2 pre-compiler containing the SQL source statements extracted from the application program. DBRMs are input to the bind process.

Q24) What will the FREE command do to a plan?

A24) It will drop(delete) that existing plan.

Q32) Where are plans stored?

A32) Each plan is defined uniquely in the SYSIBM.SYSPLANS table to correspond to the transaction (s) that are to execute that plan.

猜你喜欢

转载自sjmz30071360.iteye.com/blog/2082949