Results 1 to 7 of 7

Thread: Why this error

  1. #1
    Join Date
    Sep 2003
    Posts
    4

    Question Unanswered: Why this error

    From Perl when I execute the following script

    $command="db2cmd.exe DB2CLP.BAT DB2.EXE RESTORE DATABASE testdb user db2admin FROM C: TAKEN AT 20030919155911 to D: INTO testdb1 WITH 2 BUFFERS BUFFER 1024 WITHOUT PROMPTING";

    system $command;

    I get the error

    SQL0104N An unexpected token "END-OF-STATEMENT" was found following "FROM".
    Expected tokens may include: "<identifier>". SQLSTATE=42601

    Does any body know why?

    Thanks in advance.

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: Why this error

    I think C: should be C:\
    Same with the other drive namings

    Let us know if this solves the problem

    Sathyaram

    Originally posted by neelakant
    From Perl when I execute the following script

    $command="db2cmd.exe DB2CLP.BAT DB2.EXE RESTORE DATABASE testdb user db2admin FROM C: TAKEN AT 20030919155911 to D: INTO testdb1 WITH 2 BUFFERS BUFFER 1024 WITHOUT PROMPTING";

    system $command;

    I get the error

    SQL0104N An unexpected token "END-OF-STATEMENT" was found following "FROM".
    Expected tokens may include: "<identifier>". SQLSTATE=42601

    Does any body know why?

    Thanks in advance.
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Sep 2003
    Posts
    4

    Re: Why this error

    Originally posted by sathyaram_s
    I think C: should be C:\
    Same with the other drive namings

    Let us know if this solves the problem

    Sathyaram

    Now the script looks like

    $command="db2cmd.exe DB2CLP.BAT DB2.EXE RESTORE DATABASE testdb user db2admin FROM C:\ TAKEN AT 20030919155911 to D:\ INTO testdb1 WITH 2 BUFFERS BUFFER 1024 WITHOUT PROMPTING";

    system $command;

    but the error message I get now is

    SQL0104N An unexpected token "END-OF-STATEMENT" was found following "TAKEN".
    Expected tokens may include: "AT". SQLSTATE=42601

    I simply can't understand what the problem is!!!
    Can anybody help me?

    Thanks in advance.
    Neelakant.

  4. #4
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: Why this error

    From my command line, this works for me

    C:\Documents and Settings\Sathyaram>db2cmd.exe DB2.EXE RESTORE DATABASE testdb user db2admin FROM C:\ TAKEN AT 20030919155911 to C: INTO testdb1 WITH 2 BUFFERS
    BUFFER 1024 WITHOUT PROMPTING

    You do not need db2clp.bat ...

    and to part of the command does not need \ following the drive letter

    If you continue to get the same error as now, make sure that the variable command is set to the correct value ...

    HTH

    Sathyaram


    Originally posted by neelakant
    Now the script looks like

    $command="db2cmd.exe DB2CLP.BAT DB2.EXE RESTORE DATABASE testdb user db2admin FROM C:\ TAKEN AT 20030919155911 to D:\ INTO testdb1 WITH 2 BUFFERS BUFFER 1024 WITHOUT PROMPTING";

    system $command;

    but the error message I get now is

    SQL0104N An unexpected token "END-OF-STATEMENT" was found following "TAKEN".
    Expected tokens may include: "AT". SQLSTATE=42601

    I simply can't understand what the problem is!!!
    Can anybody help me?

    Thanks in advance.
    Neelakant.
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  5. #5
    Join Date
    Sep 2003
    Posts
    4

    Re: Why this error

    Originally posted by sathyaram_s
    From my command line, this works for me

    C:\Documents and Settings\Sathyaram>db2cmd.exe DB2.EXE RESTORE DATABASE testdb user db2admin FROM C:\ TAKEN AT 20030919155911 to C: INTO testdb1 WITH 2 BUFFERS
    BUFFER 1024 WITHOUT PROMPTING

    You do not need db2clp.bat ...

    and to part of the command does not need \ following the drive letter

    If you continue to get the same error as now, make sure that the variable command is set to the correct value ...

    HTH

    Sathyaram
    Hello Sathyaram,

    thanks a lot. Your suggestion to remove the db2clp.bat from the statement solved my earlier problems. But now I am getting the error

    "SQL1096N The command is not valid for this node type."

    Can you suggest some solution to this problem. I am really new to DB2.

    Thanks in advance.

    with regards,
    Neelakant.

  6. #6
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: Why this error

    Oh , now I see ... you are doing this from a client ?
    Based on this assumption, here is the information from the db2 command reference :

    To restore to a new remote database, it is necessary to first attach to the
    instance where the new database will reside. Then, create the new database,
    specifying the code page and the territory of the server.

    If you are not sure the type of instance, then issue the command

    db2 get dbm cfg

    from a command line on the client and the second non-blank line in the output will tell you the node type .. (This command should be run on the box under the same instance id you are trying to run the perl script)


    Please bear with me if my assumption is wrong

    Cheers
    Sathyaram
    Originally posted by neelakant
    Hello Sathyaram,

    thanks a lot. Your suggestion to remove the db2clp.bat from the statement solved my earlier problems. But now I am getting the error

    "SQL1096N The command is not valid for this node type."

    Can you suggest some solution to this problem. I am really new to DB2.

    Thanks in advance.

    with regards,
    Neelakant.
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  7. #7
    Join Date
    Sep 2003
    Posts
    4

    Re: Why this error

    Now we have a different approach to the issue of backup and restore. we now have a file named "com.db" , the content of which is as follows

    connect to testdb user db2admin using password;
    backup database testdb user db2admin using password online to c:\\;
    connect to testdb2 user db2admin using password;
    RESTORE DATABASE testdb user db2admin using password FROM C: taken at 20030923162140 to D: INTO testdb2 WITH 2 BUFFERS BUFFER 1024 replace existing WITHOUT PROMPTING;

    The com.db file is executed from a perl script with the commands

    $cmd ="db2cmd.exe DB2.exe -tvf d:\\db2\\com.db";
    system $cmd;

    Now I get the output as follows

    connect to testdb user db2admin using

    Database Connection Information

    Database server = DB2/NT 7.1.0
    SQL authorization ID = DB2ADMIN
    Local database alias = TESTDB


    backup database testdb user db2admin using online to c:\\

    Backup successful. The timestamp for this backup image is : 20030925123751


    connect to testdb2 user db2admin using
    SQL1117N A connection to or activation of database "TESTDB2" cannot be made
    because of ROLL-FORWARD PENDING. SQLSTATE=57019

    RESTORE DATABASE testdb user db2admin using FROM C: taken at 2003092316
    2140 to D: INTO testdb2 WITH 2 BUFFERS BUFFER 1024 replace existing WITHOUT PROM
    PTING
    SQL2540W Restore is successful, however a warning "2528" was encountered
    during Database Restore while processing in No Interrupt mode.


    Is there a way to avoid all the errors we see in the output?

    Thanks in advance.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •