Overriding the RELEASE(DEALLOCATE) option for packages by using profile tables
You can create profiles to specify that Db2 overrides the RELEASE(DEALLOCATE) bind option for specific packages and uses RELEASE(COMMIT) behavior to release the packages. COMMIT is the only option that can be specified.
Before you begin
FL 500 Activate function level 500 or higher.
If the Db2 profile tables and related objects does not exist on the Db2 subsystem, you must create them. For a list of the objects and how to create them, see Profile tables.
The distributed data facility (DDF) must be loaded, with the DDF subsystem parameter set to AUTO or COMMAND. See DDF STARTUP OPTION field (DDF subsystem parameter).
This task describes one of several uses for profile tables. For an overview of how to use profile tables and a summary of the different uses, see Monitoring and controlling Db2 by using profile tables.
About this task
A high-performance DBAT is a database access thread that stays associated with a remote connection at transaction boundaries, rather than being pooled. With high-performance DBATs, the amount of allocation and deallocation processing is reduced because the copy of the package remains allocated until the DBAT terminates. However, the same behaviors that make high-performance DBATs advantageous for performance can also make package and DDL management more difficult. The packages remain allocated and locks remain held for a longer duration. One option to allow DDL or BIND to break in, is to temporarily disable the high-performance DBATs, by issuing the -MODIFY DDF command with the PKGREL(COMMIT) option, as described in Controlling deallocation for high-performance DBATs, but that approach affects the entire subsystem. A better option is to use a profile to override the release behavior more selectively, for specific packages that hold locks on the objects that you want to alter or rebind. For more information about this use case, see Example: creating a profile that overrides package release behavior to enable break-in for a DDL statement.
When a profile overrides the release behavior for packages, the override applies to newly loaded packages. For packages already loaded when the -START PROFILE command is issued, the release behavior is overridden at the end of a transaction.
Profiles for the RELEASE_PACKAGE keyword can apply to local applications only, remote applications only, or both. For more information, see the description of the ATTRIBUTE2 column.
Procedure
To specify by using a profile that Db2 releases RELEASE(DEALLOCATE) packages at commit, complete the following steps:
Example: creating a profile that overrides package release behavior to enable break-in for a DDL statement
You can create a profile to temporarily override the release behavior of packages. The goal is to increase the chances that a data definition (DDL) statement can successfully break in and complete when long-running threads hold locks on the object.
For example, assume that you need to add a column to a table named T1, and you want to reduce lock contention while the change is applied. To reduce contention on the package locks while you are altering the table, you can use the following approach:
- Query the SYSPACKDEP catalog table to find packages that depend on table T1. Assume that the schema qualifier for T1 is DBAUSER.
SELECT DCOLLID, DNAME -- names of the dependent packages FROM SYSIBM.SYSPACKDEP WHERE BQUALIFIER = ‘DBAUSER’ AND BNAME = ‘T1’ -- name of table to be changed
- Assume that query returns the following rows that identify the dependent packages as DEALLOC.P1 and DEALLOC.P2:
DEALLOC P1 DEALLOC P2
Also assume that these packages are invoked by local applications, and that they are bound with the RELEASE(DEALLOCATE) bind option.
- Assume that local thread 1 executes packages DEALLOC.P1 and DEALLOC.P2.
- In the SYSIBM.DSN_PROFILE_TABLE table, you insert the following row to create a profile that specifies the collection ID DEALLOC as the filter:
PROFILEID ROLE AUTHID PRDID COLLID PKGNAME 99 null null null DEALLOC null - You also insert the following row in the SYSIBM.DSN_PROFILE_ATTRIBUTES table:
PROFILEID KEYWORDS ATTRIBUTE1 ATTRIBUTE2 99 RELEASE_PACKAGE COMMIT 1 - You issue the START PROFILE command to activate, which causes Db2 to reload the profile table into a data structure in memory. Now that the new profile with PROFILEID 99 is activated, the following behaviors take effect:
- The existing local thread 1, which is executing packages DEALLOC.P1 and DEALLOC.P2, is released when the transaction ends at COMMIT or ROLLBACK.
- When a new thread executes the first SQL statement in the DEALLOC.P1 package, the package is loaded and the release commit behavior applies, even though P1 was bound with RELEASE(DEALLOCATE).
- You execute the following SQL statements to give the ALTER TABLE statement for table T1 a higher timeout and deadlock priority:
SET CURRENT LOCK TIMEOUT = 60 -- assuming the subsystem parameter IRLMRWT is 30 SET SYSIBMADM.DEADLOCK_RESOLUTION_PRIORITY = 255 ALTER TABLE T1 ADD C1 INT
- After the ALTER TABLE completes successfully, you disable or delete the new rows in the profile tables. Then, issue the START PROFILE command again so that Db2 reloads the profile table into a data structure in memory. The profile with PROFILEID 99 is no longer activated, and new local threads can load packages DEALLOC.P1 and DEALLOC.P2 for execution.