If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Force application for a DB

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-09-07, 08:08
rahul_s80 rahul_s80 is offline
Registered User
 
Join Date: Jul 2006
Location: Pune , India
Posts: 433
Exclamation Force application for a DB

i was just wondering how to force applications for only a specified DB.
i need DB scripts for BKP to run at night(task centre) ,
but the problem is
db2 force application all
will force connections for other DB's also (which i dont want)
any hints ?
__________________
Rahul Singh
Certified DB2 9 DBA / Application Developer
Reply With Quote
  #2 (permalink)  
Old 08-09-07, 08:23
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
You could use the following query to generate the script you need:

select 'force application ('||rtrim(char(agent_id))||')' from table(snapshot_appl_info('MyDB',-1)) as x

Andy
Reply With Quote
  #3 (permalink)  
Old 08-09-07, 08:50
grofaty grofaty is offline
Registered User
 
Join Date: Jan 2003
Posts: 1,570
ARWinner, this is new in v8.2 if I am not mistaken. I use Windows batch script to do the same task for any kind of database new and old versions - this is one command in one line:
Code:
FOR /F "tokens=3 delims= " %%i IN ('db2 list application for database MyDB ^| find /v "Auth" ^| find /v "--" ^| find /v "Name"') DO db2 force application (%%i)
Note: use your database name instead of MyDB.

rahul_s80, can you write your db2 version and operating system type and version.

Hope this helps,
Grofaty

Last edited by grofaty; 08-09-07 at 08:54.
Reply With Quote
  #4 (permalink)  
Old 08-09-07, 09:14
myprotein myprotein is offline
Registered User
 
Join Date: Aug 2007
Posts: 23
i think , when you execute "force application xxx" ,you must connect to the very db ,which db you have connected ,then witch db you would force app disconnected.
Reply With Quote
  #5 (permalink)  
Old 08-09-07, 09:19
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Quote:
Originally Posted by myprotein
i think , when you execute "force application xxx" ,you must connect to the very db ,which db you have connected ,then witch db you would force app disconnected.
You do not have to be connected to the database, but you do need an instance attachment which you would normally get if you logged on as instance owner.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #6 (permalink)  
Old 08-09-07, 09:30
myprotein myprotein is offline
Registered User
 
Join Date: Aug 2007
Posts: 23
oh,sorry,ic
Reply With Quote
  #7 (permalink)  
Old 08-09-07, 13:51
regence regence is offline
Registered User
 
Join Date: Aug 2007
Location: TX, USA
Posts: 5
Have you tried DEACTIVATE DATABASE, followed by an ACTIVATE DATABASE?
Reply With Quote
  #8 (permalink)  
Old 08-10-07, 06:18
rahul_s80 rahul_s80 is offline
Registered User
 
Join Date: Jul 2006
Location: Pune , India
Posts: 433
thanks,
db2 quiesce db immediate force connections
will suit me better
__________________
Rahul Singh
Certified DB2 9 DBA / Application Developer
Reply With Quote
  #9 (permalink)  
Old 08-10-07, 23:13
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Quote:
Originally Posted by rahul_s80
thanks,
db2 quiesce db immediate force connections
will suit me better
That should work for most shops, except those where the applications are using the instance owner id (which is not affected by quiesce).
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On