DB2 Version 9.7 for Linux, UNIX, and Windows

Tuning the application heap size

About this task

You use the database configuration parameter APPLHEAPSZ to specify the size of the application heap (in number of 4-KB pages). This parameter defines the number of private memory pages that are available for use by the database manager on behalf of a specific agent or subagent. The heap is allocated when an agent or subagent is initialized for an application. The allocated amount is the minimum amount that is needed to process the request to the agent or subagent. As the agent or subagent requires more heap space to process larger SQL statements, the database manager allocates memory as needed, up to the maximum that is specified on this parameter. The application heap is allocated out of the agent's private memory.

The default value for the APPLHEAPSZ parameter is 128 (4-KB pages). When you run the ST_enable_db stored procedure, this value must be at least 2048.

Recommendation: For most DB2® Spatial Extender applications, especially those that import from or export to shape files, use an APPLHEAPSZ parameter value of at least 2048.
If the APPLHEAPSZ is set to an inadequate value, the following error message is issued when you try to enable a database for spatial operations:
GSE0009N Not enough space is available in DB2's application heap.

GSE0213N A bind operation failed. SQLERROR = "SQL0001N Binding or 
precompilation did not complete successfully. SQLSTATE=00000". 

To change the application heap size:

Procedure

  1. Issue the command GET DATABASE CONFIGURATION to find the current value for the APPLHEAPSZ parameter or view the Configure Database window of the DB2 Control Center.
  2. Change the value to the recommended value of 2048 or higher. You can change the value to 2048 by issuing the following command, where db_name identifies your database:
    UPDATE DATABASE CONFIGURATION FOR db_name USING APPLHEAPSZ 2048
  3. Disconnect all applications from the database.
  4. If the database was explicitly activated, deactivate the database.

What to do next

The change takes effect the next time either the database is activated or a connection to the database is established.