We often work with databases that have come off server environments (some have the Truncate Log at Checkpoint Option set on the Server). When we do, we are usually connecting to them stand alone as a local ODBC Source in Sybase SQL Central (opening the file rather than a server).

In version 9 of SqlAnywhere stopping and starting the database in this mode would truncate the log. In version 11 the log continues to grow.

How do we Truncate the log when we are connected as a local ODBC source?

Thanks

asked 20 Oct '11, 18:46

Glenn%20Barber's gravatar image

Glenn Barber
1.1k234051
accept rate: 0%


When you connect to a database that is not currently running, it will be auto-started if it is configured to do so. I suspect that when you explicity start the database without auto-starting, that the command line parameters differ causing the change in behavior.

If you want to configure the auto-start to truncate the transaction log on checkpoint, you should be able to accomplish this by setting the appropriate -m switch in the DSN, or alternatively passing the START or DBS connection parameters when you connect to the database:

START connection parameter

DBS connection parameter

As an alternative, the transaction log can be manually truncated by issuing the appropriate backup statement.

I.e.

BACKUP DATABASE DIRECTORY '' TRANSACTION LOG ONLY TRANSACTION LOG TRUNCATE;

BACKUP statement

permanent link

answered 20 Oct '11, 19:06

Tyson%20Lewis's gravatar image

Tyson Lewis
2.2k1641
accept rate: 22%

edited 20 Oct '11, 20:47

If I am to understand this - this approach would require us to modify the Additional Connection Parameters in the ODBC - we are using SQL Central to Connect and our only choice is the ODBC.

We would prefer a command which we can optionally execute when we are already connected using SQL Central. Does something like that exist?

(20 Oct '11, 20:28) Glenn Barber
Replies hidden

Yes, there is a command you can execute against the database to truncate the transaction log. You will need to spawn an Interactive SQL session from Sybase Central to execute it though. I've edited my answer to include an example and link.

(20 Oct '11, 20:48) Tyson Lewis

Thanks - Thats exactly what I was looking for.

(21 Oct '11, 11:25) Glenn Barber
Your answer
toggle preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×15

question asked: 20 Oct '11, 18:46

question was seen: 1,878 times

last updated: 21 Oct '11, 11:25