Rebinding applications

You must rebind applications to change bind options. You also need to rebind applications when you make changes that affect the plan or package, such as creating an index, but you have not changed the SQL statements.

About this task

In some cases, Db2 automatically rebinds plans or packages for you, depending on the value of the ABIND subsystem parameter. For details, see Automatic rebinds.

The following actions might require that you rebind a package:

  • Changing the host language or SQL statements in the application. You must replace the package. Precompile, compile, and link the application program. Then issue a BIND command with the ACTION(REPLACE) option.
  • Changing your data attributes in ways that invalidate the package. For details, see Changes that invalidate packages.
  • Improving access paths selection after reorganizing data with the REORG utility or collecting database statistics with RUNSTATS or other utilities. For more information, see Maintaining data organization and statistics.
  • Enabling Db2 to select an access path that uses a newly created index for access to a table.
  • Changing the bind options for a package. If an option that you want to change is not available for the REBIND command, issue the BIND command with ACTION(REPLACE) instead.
  • Preparing for migration to a new Db2 release. For more information, see Rebind old plans and packages in Db2 11 to avoid disruptive autobinds in Db2 12.

Start of changeFL 505 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. For more information, see Phase-in of package rebinds.End of change