Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

I need to recevory a database with more than 200 incremental backups (we do a lot of it a day).

I'm using ASA9, so I don't have -ad option.

I can't write bat/script since dbeng9 command line creates a new process and stops the first one, this way I'll try to process second log without first finishes.

Can you help me?

asked 21 Sep '11, 18:17

Zote's gravatar image

accept rate: 43%

Solved with a little bit of C#.

My program lists all log files, and starts a new dbeng9 for each, and wait until no more dbeng9 process exists. Torrow I'll cleanup my code, and publish it at bitbucket or github, this can be helpful for someone.

permanent link

answered 21 Sep '11, 23:12

Zote's gravatar image

accept rate: 43%

I would think that a PowerShell scriptlet would be an easier way to do that -- I know that I've used VBScript to achieve a similar effect when using CuteFTP to upload a 3-4GB file in 20MB chunks. Your comment about not being able write such a script was why I suggested the brute-force batch-file method.

(22 Sep '11, 01:21) William Clardy

From the help docs, it sounds like your best bet may be to translate the log files into a single SQL file, and then apply that directly to your database:

To recover from multiple transaction logs using the dbtran utility

  1. Run the Log Translation utility (dbtran) against the directory containing the transaction log files and output the resulting SQL statements into a .SQL file.
  2. Start the backup copy of your database.
  3. Apply the .SQL file generated by dbtran in step 1 to the backup copy of your database from Interactive SQL.


The following example uses the dbtran utility to apply the backup and current transaction logs to the backup copy of the database.

  1. Run the Log Translation utility against the c:\backup directory and output the SQL statements into a file called recoverylog.sql:

    dbtran -m "c:\backup" -n recoverylog.sql

  2. Start the backup copy of the database called backupasademo.db :

    dbeng9 backupasademo.db

  3. Apply the recoverylog.sql file to the database from Interactive SQL:

    dbisql "uid=dba;pwd=sql;eng=backupasademo" READ recoverylog.sql

permanent link

answered 21 Sep '11, 19:53

Calvin%20Allen's gravatar image

Calvin Allen
accept rate: 25%

edited 21 Sep '11, 19:55

Isn't an option. Apply translated logs are so much slow...

(21 Sep '11, 23:10) Zote

The quick and dirty way around dbeng9 starting in a separate process would be to use a batch file for all the dbeng9 -a commands, alternating the dbeng9 commands with pause commands.

That would be uncomfortably interactive, because you'll have to smack the [Enter] key after each log file has been processed, but it will get you back in business.

permanent link

answered 21 Sep '11, 20:05

William%20Clardy's gravatar image

William Clardy
accept rate: 0%

edited 21 Sep '11, 20:05

I made something like this using C#.

(21 Sep '11, 23:13) Zote

Out of my memory something like this can help.

for %b in ( *.log ) do start "Server" /wait dbeng9 database.db -a %b

The only problem here is that you have to watch carefully for spaces in your command line.

Not as sexy as C# but ... "It is tempting, if the only tool you have is a hammer, to treat everything as if it were a nail." by Abraham Maslow

permanent link

answered 22 Sep '11, 06:38

Thomas%20Duemesnil's gravatar image

Thomas Dueme...
accept rate: 17%


IMHO that would work only if the log files are read in the correct order. I'm not sure if one can always rely on a "natural" ordering.
For a test I've use a for loop to create a batch file which I could sort in an appopriate editor.
for %l in (*.*) do echo start "Server" /wait dbeng9 database.db -a %l >>ApplyLog.bat

(22 Sep '11, 08:04) Reimer Pods

Good Point.

 for /F %b in ( 'dir /b /O:N' ) do echo %b

Will step through the output of the directory command which is sorted by name.

There is always a Option you not already know before you need it.

(22 Sep '11, 08:42) Thomas Dueme...

You might appreciate this correlary to Maslow's thought:

(22 Sep '11, 15:44) William Clardy
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 21 Sep '11, 18:17

question was seen: 3,294 times

last updated: 22 Sep '11, 15:44