Skip to Content
avatar image
Former Member

SQL commands in loadercli command files

Hello,

i want to write a script which i could use for exporting / importing database tables from one db to another.

the script should export selected tables from the source db, delete the data in the selected tables in the destination db, and then import the selected data from the export files.

it could be that there are no records in the destination table, so the delete statement would fail:

aportal@server:~/install/dbscripts> /opt/sdb/programs/bin/loadercli -n localhost -u dbadmin,dbadmin -d ap_testu -b aportal-i.cmd

Loader protocol: '/home/aportal/sdb/server/loader/log/loader.log'

Loader packages: '/home/aportal/sdb/server/loader/packages'

User DBADMIN connected to database AP_TESTU schema DBADMIN on localhost.

use user aportal aportal

Successfully executed

SET MAXERRORCOUNT 3

Successfully executed

delete from aportal.tabelle

Error during execution

-->-25010

SQL error 100 = Row not found (error position: 1)

Defined maximum number of errors (1) reached

1 error(s) while processing command file 'aportal-i.cmd'.

---> See Loader log file for more information.

i thought to increase the maxerrorcount value, but this doesn't work. is there another possibility to delete empty tables?

thx

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Dec 20, 2007 at 07:36 PM

    Hello Chris,

    -> You could call the help to get an overview of all options:

    loadercli -h

    < or review the MAXDB documentation :

    http://maxdb.sap.com/currentdoc/default.htm -> Tools : Loader >

    There are Options for Controlling Input and Output, and you could use the option::

    -E <number> :: Maximum permitted number of errors

    For example::

    /opt/sdb/programs/bin/loadercli -n localhost -u dbadmin,dbadmin -d ap_testu -E 100 -b aportal-i.cmd

    -> "is there another possibility to delete empty tables?"

    Please overview the documents at

    http://maxdb.sap.com/currentdoc/default.htm -> Tutorials ->SQL Tutorial

    Data Manipulation -> Inserting, Changing, and Deleting Rows

    • To delete rows, you are using the DELETE statement.

    • If necessary, you could use DROP TABLE to delete the table.

    Thank you and best regards, Natalia Khlopina

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 27, 2007 at 09:47 AM

    Hi Chris,

    as Nathalia already stated - the -E option will do the trick for you. I think you would like to have the loadercli running the batch script without stopping on errors. The -E option is exactly for this - it lets the LOADER client (which reads the commands from the batch file and sends it to the LOADER server) ignore errors during execution of sent commands. On the other hand the command SET MAXERRORCOUNT <N> is a command for the LOADER server to ignore the given count of errors during execution of a single EXPORT or IMPORT command.

    Regards,

    Steffen

    Add comment
    10|10000 characters needed characters exceeded