FORCE APPLICATION command using the ADMIN_CMD procedure

The FORCE APPLICATION command forces local or remote users or applications off the system to allow for maintenance on a server.

Attention: If an operation that cannot be interrupted (RESTORE DATABASE, for example) is forced, the operation must be successfully re-executed before the database becomes available.

Scope

This command affects all database partitions that are listed in the $HOME/sqllib/db2nodes.cfg file.

In a partitioned database environment, this command does not have to be issued from the coordinator database partition of the application being forced. It can be issued from any database partition server in the partitioned database environment.

Authorization

One of the following authorities:
  • SYSADM
  • SYSCTRL
  • SYSMAINT

Required connection

Database

Command syntax

Read syntax diagramSkip visual syntax diagramFORCE APPLICATIONALL(,application-handle)MODE ASYNC

Command parameters

FORCE APPLICATION
ALL
All applications will be disconnected from the database server. This might close the connection the ADMIN_CMD procedure is running on, which causes an SQL1224N error to be returned for the ADMIN_CMD procedure once the force operation is completed successfully.
application-handle
Specifies the agent to be terminated. List the values using the LIST APPLICATIONS command.
MODE ASYNC
The command does not wait for all specified users to be terminated before returning; it returns as soon as the function has been successfully issued or an error (such as invalid syntax) is discovered.

This is the only mode that is currently supported.

Examples

The following example forces two users, with application-handle values of 41408 and 55458, to disconnect from the database:
CALL SYSPROC.ADMIN_CMD( 'force application ( 41408, 55458 )' )

Usage notes

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 terminated.

The following types of users and applications cannot be forced:
  • users creating a database
  • system applications
In order to successfully force these types of users and applications, the database must be deactivated and/or the instance restarted.

After a FORCE APPLICATION has been issued, the database will still accept requests to connect. Additional forces might be required to completely force all users off.

Command execution status is returned in the SQLCA resulting from the CALL statement.