This API affects all database partition servers that are listed in the db2nodes.cfg file.
In a partitioned database environment, this API does not have to be issued from the coordinator partition of the application being forced. This API can be issued from any database partition server in the partitioned database environment.
Instance. To force users off a remote server, it is necessary to first attach to that server. If no attachment exists, this API is executed locally.
sqlenv.h
SQL_API_RC SQL_API_FN
sqlefrce (
sqlint32 NumAgentIds,
sqluint32 * pAgentIds,
unsigned short ForceMode,
struct sqlca * pSqlca);
SQL_API_RC SQL_API_FN
sqlgfrce (
struct sqlca * pSqlca,
unsigned short ForceMode,
sqluint32 * pAgentIds,
sqlint32 NumAgentIds);
If this parameter is set to SQL_ALL_USERS (defined in sqlenv), all applications with either database connections or instance attachments are forced. If it is set to zero, an error is returned.
This parameter must be set to SQL_ASYNCH (defined in sqlenv).
The database manager remains active so that subsequent database manager operations can be handled without the need for db2start.
To preserve database integrity, only users who are idling or executing interruptible database operations can be forced off.
After a force command has been issued, the database will still accept requests to connect. Additional forces may be required to completely force all users off. The database system monitor functions are used to gather the agent IDs of the users to be forced.
When the force mode is set to SQL_ASYNCH (the only value permitted), the API immediately returns to the calling application.
Minimal validation is performed on the array of agent IDs to be forced. The user must ensure that the pointer points to an array containing the total number of elements specified. If NumAgentIds is set to SQL_ALL_USERS, the array is ignored.
When a user is forced off, a unit of work rollback is performed to ensure database consistency.
All users that can be forced will be forced. If one or more specified agent IDs cannot be found, sqlcode in the sqlca structure is set to 1230. An agent ID may not be found, for example, if the user signs off between the time an agent ID is collected and sqlefrce is called. The user that calls this API is never forced off.
Agent IDs are recycled, and are used to force applications some time after being gathered by the database system monitor. When a user signs off, therefore, another user may sign on and acquire the same agent ID through this recycling process, with the result that the wrong user may be forced.
FORCE APPLICATION {ALL | :agentidarray} [MODE ASYNC]