REBIND PACKAGE (DSN)
The DSN subcommand REBIND PACKAGE rebinds an application package when you make changes that affect the package, but have not changed the SQL statements in the program.
For example, you can use REBIND PACKAGE after you complete the following activities:
- Migrate to a new DB2® release
- Apply maintenance to DB2
- Modify authorizations
- Create a new index that statements in the package can use
- Collect statistics using the RUNSTATS utility or with another utility by using the STATISTICS keyword
When the REBIND PACKAGE(*) command is issued, trigger packages are not affected.
- When you change the SQL statements
- When you recompile the program
- When you have previously run BIND PACKAGE with the SQLERROR(CONTINUE) option
Environment
You can use REBIND PACKAGE through DB2I, or enter the REBIND PACKAGE subcommand from a DSN session running in foreground or background.
Data sharing scope: Group
Authorization
The package owner must have authorization to execute all SQL statements embedded in the package for REBIND PACKAGE to build a package without producing error messages. For VALIDATE(BIND), DB2 verifies the authorization at bind time. For VALIDATE(RUN), DB2 verifies the authorization initially at bind time, but if the authorization check fails, DB2 rechecks it at run time.
When the EXPLAIN(ONLY) the option is specified, you must have the EXPLAIN privilege.
The package owner must be a role to execute REBIND PACKAGE in a trusted context with role ownership.
The following table explains the authorization required to run REBIND PACKAGE, depending on the options specified.
Option | Authorization required to run REBIND PACKAGE |
---|---|
REBIND PACKAGE with no change in ownership because the OWNER keyword is not specified. | The authorization IDs of the process must have
one of the following authorities:
|
REBIND PACKAGE with no change in ownership, although the original owner is specified for the OWNER keyword. | The authorization IDs of the process
must have one of the following authorities:
|
REBIND PACKAGE with change of ownership. (An authorization ID that is not the original owner is specified in the OWNER keyword.) | The new OWNER must have one of the
following authorities:
Specifying the OWNER: If any of the authorization IDs have the BINDAGENT privilege granted from the owner, the authorization-id can specify the grantor as OWNER. Otherwise, OWNER authorization-id must be one of the primary or secondary authorization IDs of the binder. |
Syntax
>>-REBIND PACKAGE--| ID-block |--+-------------------------+----> '-OWNER(authorization-id)-' >--+---------------------------+--------------------------------> '-QUALIFIER(qualifier-name)-' >--| enable-block |--| Start of changeoptions-blockEnd of change |--> >--+------------------------+--+------------------------+-------> '-CURRENTDATA(-+-YES-+-)-' '-DBPROTOCOL(---DRDA---)-' '-NO--' >--+------------------------+--+-------------------+------------> +-DEFER(PREPARE)---------+ '-DEGREE(-+-1---+-)-' +-DEFER(INHERITFROMPLAN)-+ '-ANY-' '-NODEFER(PREPARE)-------' >--+----------------------------+-------------------------------> '-DYNAMICRULES(-+-RUN----+-)-' +-BIND---+ +-DEFINE-+ '-INVOKE-' >--+-------------------------+--+---------------------+---------> '-ENCODING(-+-ASCII---+-)-' '-EXPLAIN(-+-YES--+-)-' +-EBCDIC--+ +-NO---+ +-UNICODE-+ '-ONLY-' '-ccsid---' >--+---------------+--+----------------------------+------------> | .-I-. | '-GETACCELARCHIVE(-+-----+-)-' '-FLAG(-+-W-+-)-' +-NO--+ +-E-+ '-YES-' '-C-' >--+-----------------------------------+------------------------> | .-INHERITFROMPLAN-. | '-IMMEDWRITE(-+-NO--------------+-)-' '-YES-------------' >--+---------------------+--+------------------------+----------> '-ISOLATION(-+-RR-+-)-' | .-NO--. | +-RS-+ '-KEEPDYNAMIC(-+-YES-+-)-' +-CS-+ +-UR-+ '-NC-' >--+-------------------------+--+--------------------+----------> | (1) | '-OPTHINT('hint-id')-' | .-NONE-------. | | | (2) | | '-REOPT(-+-ALWAYS-----+-)-' +-ONCE-------+ '-AUTO-------' >--+-----------------------------+--+-----------------+---------> | .-,---------------. | | (3) | | V | | '-PATHDEFAULT-----' '-PATH(---+-schema-name-+-+-)-' '-USER--------' >--+---------------------------------------------+--------------> '-QUERYACCELERATION(-+--------------------+-)-' +-NONE---------------+ +-ENABLE-------------+ +-ENABLEWITHFAILBACK-+ +-ELIGIBLE-----------+ '-ALL----------------' >--+--------------------------------+---------------------------> '-RELEASE(-+-COMMIT----------+-)-' +-DEALLOCATE------+ '-INHERITFROMPLAN-' >--+------------------------+--+----------------------+---------> '-SWITCH(-+-PREVIOUS-+-)-' '-VALIDATE(-+-RUN--+-)-' '-ORIGINAL-' '-BIND-' >--+------------------------------+-----------------------------> '-EXTENDEDINDICATOR(-+-NO--+-)-' '-YES-' >--+---------------------------------------------------------+--> '-CONCURRENTACCESSRESOLUTION(-+-USECURRENTLYCOMMITTED-+-)-' '-WAITFOROUTCOME--------' >--+---------------------+------------------------------------->< '-GENERIC(-'string'-)-'
- NOREOPT(VARS) can be specified as a synonym of REOPT(NONE)
- REOPT(VARS) can be specified as a synonym of REOPT(ALWAYS)
- The PATHDEFAULT keyword is mutually exclusive with the PATH keyword. Do not specify both keywords in the same REBIND command.
ID-block .-,-------------------------------------------------------------------------------. V | >>-(-+---+---------------+-.-+-collection-id-+-.-+-package-id-+-.-+--------------------+-+-+-)->< | '-location-name-' '-*-------------' '-*----------' '-(-+------------+-)-' | | +-version-id-+ | | '-*----------' | '-*-----------------------------------------------------------------------------------'
enable-block >>-+--------------------------------------------------------------------------------+->< | .-,------------. .-------------------------------------. | | V | V | | '-+-+-ENABLE--+--(---+-BATCH----+-+-)-+----+---------------------------------+-+-' | '-DISABLE-' +-DLIBATCH-+ | | .-,---------------. | | +-DB2CALL--+ | | V | | | +-CICS-----+ | +-DLIBATCH(---connection-name-+-)-+ | +-IMS------+ | | .-,------. | | +-IMSBMP---+ | | V | | | +-IMSMPP---+ | +-CICS(---applid-+-)--------------+ | +-REMOTE---+ | | .-,-----. | | '-RRSAF----' | | V | | '-ENABLE(*)-------------------------' +-IMSBMP(---imsid-+-)-------------+ | .-,-----. | | V | | '-IMSMPP(---imsid-+-)-------------'
options-block >>-+--------------------------+--+----------------------+-------> '-PLANMGMT(-+-BASIC----+-)-' | .-NONE--. | +-EXTENDED-+ '-APREUSE(-+-ERROR-+-)-' '-OFF------' >--+------------------------+--+------------------------+------>< | .-NONE--. | | .-YES-. | '-APCOMPARE(-+-WARN--+-)-' '-APRETAINDUP(-+-NO--+-)-' '-ERROR-'
Option descriptions
For descriptions of the options shown in the syntax diagram, see the topic BIND and REBIND options for packages and plans.
Usage notes
Rebinding multiple packages: If you rebind multiple packages, DB2 commits each successful rebind before rebinding the next package.
Rebinding a package for a native SQL procedure: If you issue a REBIND PACKAGE command against a native SQL procedure package, the only bind options that you can change are EXPLAIN, PLANMGMT, SWITCH, APRETAINDUP, APREUSE, and APCOMPARE. If you try to change other bind options the command will fail and return message DSNT215I. The REBIND PACKAGE command rebinds only the SQL statements included in the procedure and not the control statements in the procedure definition.
Rebinding a package for an SQL function: If you issue a REBIND PACKAGE command against a package for an SQL function, the only bind options that you can change are EXPLAIN, PLANMGMT, and SWITCH. If you try to change other bind options, the command will fail and return message DSNT215I. The REBIND PACKAGE command rebinds only the SQL statements included in the function and not the control statements in the function definition.
Example
REBIND PACKAGE (USIBMSTODB22.TEST.DSN8BC81.(MAY_VERSION),
USIBMSTODB22.PRODUCTION.DSN8BC81.(DEC_VERSION)) -
ENABLE (CICS,DLIBATCH) CICS (CON2)