Force off applications connected to a specific database

This procedure quickly generates a DB2 command to force off applications connected to a specific database.

This quickly generates a command to force off applications connected to a specific database. The DB2 command "force

application all" is too wide in its effect. This tip provides the needed command for a specific database. Just cut-and-paste the command to execute it. It has been tested on DB2 UDB version 7.2 and 8.1. Change the XXXXXXXX to the appropriate database name.

db2 "list applications" | awk -v d=XXXXXXXX
"{if($5==d){if(length(t)>0){t=t","};t=t$3;}}END{print"db2 'force application("t")'";}"

For More Information

  • Feedback: E-mail the editor with your thoughts about this tip.
  • More tips: Hundreds of free DB2 tips and scripts.
  • Tip contest: Have a DB2 tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize -- submit your tip today!
  • Ask the Experts: Our SQL, database design, Oracle, SQL Server, DB2, metadata, and data warehousing gurus are waiting to answer your toughest questions.
  • Forums: Ask your technical DB2 questions--or help out your peers by answering them--in our active forums.
  • Best Web Links: DB2 tips, tutorials, and scripts from around the Web.

This was first published in March 2003

Dig deeper on DB2 UDB (universal databases)

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchEnterpriseLinux

SearchDataCenter

Close