Phase-in of package rebinds
With rebind-phase in, Db2 can rebind a package concurrently with its execution. A rebind operation creates a new copy of the package. When the rebind operation finishes, new threads can use the new package copy immediately, and existing threads can continue to use the copy that was in use prior to the rebind (the phased-out copy) without disruption.
With Rebind phase-in, a REBIND PACKAGE operation generates a new copy, while existing threads continue to execute the current copy of the package, which becomes the phased-out copy. When the new copy is committed by the REBIND command, that copy becomes the current copy and is immediately available for the next execution by a new thread. Threads that existed prior to the REBIND can also use the new current copy when they release the phased-out copy (based on the RELEASE(COMMIT) or RELEASE(DEALLOCATION) option).
Db2 can generate as many as 14 copies to phase in new package copies at REBIND. Only one is the current copy, and its copy ID is in the catalog table SYSPACKAGE. All phased-out copies, and the original and previous copies, are stored in SYSPACKCOPY and other catalog tables until they are deleted. However, copyID 3 is for internal use only, and is not stored in the SYSPACKCOPY or SYSPACKAGE catalog tables.
On subsequent executions of the REBIND PACKAGE command, Db2 detects when a phased-out copy can be safely deleted, and its copy ID can be reused. The maximum copy ID is 16.
When all available copy IDs are in use, a subsequent REBIND command might fail and issue the DSNT500I message, with reason code 00E30307. This failed command indicates a thread which prevents one or more phased-out copies from being reused.
You can use the PLANMGMTSCOPE(PHASEOUT) option on the FREE PACKAGE subcommand to free unused phased-out copies, which could be created when a package is rebound. It is recommended that phased-out package copies be freed in order to reduce space in the Db2 directory and catalog. The subcommand will free the phased-out copies that are not currently used by an executing thread. The SYSPACKCOPY.TIMESTAMP column value can be used to determine when a copy becomes phased-out. In addition, the PLANMGMTSCOPE(INACTIVE) option on the FREE PACKAGE subcommand also addresses the phased-out copies.
- APREUSE(NONE) PLANMGMT(EXTENDED)
- APREUSE(WARN) PLANMGMT(EXTENDED) APREUSESOURCE(CURRENT)
- APREUSE(ERROR) PLANMGMT(EXTENDED) APREUSESOURCE(CURRENT)
- The package is not a generated package for a trigger or SQL routine, such as a procedure or user-defined function.