Topic
2 replies Latest Post - ‏2013-05-23T15:28:41Z by LukeNumrych
awg_brad
awg_brad
10 Posts
ACCEPTED ANSWER

Pinned topic DB2/CLP script failure on AIX DB2 v10 and WebConsole v3.2

‏2013-05-22T18:02:52Z |

I'm trying setup a script that will be capable of runnig a backup on multiple databases.  A previous forum post netted me the statement below (In red) from a DB2 v10 on Windows user:

--#SET TERMINATOR @ begin atomic    declare cmdstring varchar(255);   set (cmdstring) = (     select        'backup db ' || current server || ' online to "e:\db2backups" compress include logs without prompting'       from sysibm.sysdummy1   );   call SYSPROC.ADMIN_CMD(cmdstring); end @

When I run this script (even when I strip it down to just the declare statement) I receive the following message in my log file:


db2 => DB21109E  The syntax is incorrect for the "--#SET TERMINATOR" directive.  Reason Code: "1".
db2 => set (cmdstring) = (     select        'backup db ' || current server || ' online to "/san01/backup/online" compress include logs without prompting'       from sysibm.sysdummy1   )
DB21034E  The command was processed as an SQL statement because it was not a 
valid Command Line Processor command.  During SQL processing it returned:
SQL0206N  "CMDSTRING" is not valid in the context where it is used.  
SQLSTATE=42703

db2 => call SYSPROC.ADMIN_CMD(cmdstring)
SQL0206N  "CMDSTRING" is not valid in the context where it is used.  
SQLSTATE=42703

db2 => db2 (cont.) => end @ terminate
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 "end" was found following "BEGIN-OF-STATEMENT".  
Expected tokens may include:  "".  SQLSTATE=42601

db2 =>

I"ve tried just about every character on the keyboard as well as pairs of characters for the terminator.  I have the DB2 statement termination character set to a semi-colon (;) on the job edit screen.  I've been searching IBM Inforcenter, the internet, and this forum for a solution but haven't found one yet.  Any assistance would be appreciated, thanks!

Attached is my complete log file.

Attachments

  • awg_brad
    awg_brad
    10 Posts
    ACCEPTED ANSWER

    Re: DB2/CLP script failure on AIX DB2 v10 and WebConsole v3.2

    ‏2013-05-22T18:17:28Z  in response to awg_brad

    Never mind.  I found my solution.  I needed to change the DB2 statement termination character on the job edit screen to match the value in the the SET TERMINATOR statement.

  • LukeNumrych
    LukeNumrych
    53 Posts
    ACCEPTED ANSWER

    Re: DB2/CLP script failure on AIX DB2 v10 and WebConsole v3.2

    ‏2013-05-23T15:28:41Z  in response to awg_brad

    Glad you found a way!  I can't wait to implement this in production... of course I will have to convince the powers to let me upgrade to 10.1 first ;).