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 > Unable to run several db2pd commands froma script file. Is my syntax correct?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-04-08, 00:14
pagwu pagwu is offline
Registered User
 
Join Date: Mar 2007
Posts: 70
Unable to run several db2pd commands froma script file. Is my syntax correct?

Hi all,

I need to be able to execute several db2pd commands from a file such as lockinfo.sql. I have the following db2pd commands in this file:
Begin file content:
db2 connect to fsnst2dw user db2inst1 using db2grp1;
db2pd -db fsnst2dw -locks wait showlocks > db2pd_out1.txt;
db2pd -db fsnst2dw -transaction > db2pd_out2.txt;
db2pd -agents > db2pd_out3.txt;
db2pd -applications > db2pd_out4.txt;
db2pd -db fsnst2dw -dynamic > db2pd_out5.txt;
@
End file content:
When I try to run the script file as "db2 -td@ -f lockinfo.sql", I get the following errors...

SQL0104N An unexpected token "db2" was found following "BEGIN-OF-STATEMENT". Expected tokens may include: "SELECT". SQLSTATE=42601

DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0104N An unexpected token "-db fsnst2dw -locks wait showlocks" was found following "db2pd ". Expected tokens may include: "<space>". SQLSTATE=42601

Can someone help with the correct method/syntax to make this work?

Thanks aplenty!
Reply With Quote
  #2 (permalink)  
Old 04-04-08, 07:01
guyprzytula guyprzytula is offline
Registered User
 
Join Date: Jun 2006
Posts: 471
if this is executed with db2 -tf you can only db2 commands in this file without the db2 prefix. o/s commands or other db2 utilities as db2pd are not allowed
it should be executed as a shell script and in that case have the db2 prefix
__________________
Best Regards, Guy Przytula
DB2 UDB LUW certified V6/7/8
Reply With Quote
  #3 (permalink)  
Old 04-04-08, 12:32
pagwu pagwu is offline
Registered User
 
Join Date: Mar 2007
Posts: 70
Thank you Guy. Could you plug in how you would turn the commands into a shell script? Scripting is not my forte (yet!)...

Thanks
Reply With Quote
  #4 (permalink)  
Old 04-04-08, 13:06
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by pagwu
Could you plug in how you would turn the commands into a shell script?
Not sure what "plug in" means in this context, but a shell script is simply a sequence of OS commands; you turn commands into a script by putting those commands in a text file.
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