When I create a database (with Sybase Central), a log file is also created. How can I clear the log file entries through Sybase Central or iSQL? Thanks.

asked 02 Sep '11, 01:30

sam's gravatar image

sam
315141624
accept rate: 0%


If you don't need the log file for different purposes (backup, SQL Remote, MobiLink clients, ...), you can simply stop the database and just delete the log file. This should be done when there are no open transactions.

Once the database is restarted, it will create a new (and therefore "empty") log file.

Note that there is no way (at least no public way) to remove only parts of the contents of the transaction log file.

Besides that, there are several ways to limit the size of the transaction log file, cf. this FAQ.

permanent link

answered 02 Sep '11, 02:27

Volker%20Barth's gravatar image

Volker Barth
31.5k318461676
accept rate: 33%

edited 02 Sep '11, 02:30

You can also backup the database and during this process truncate the logfile. As an SQL Statement:

BACKUP DATABASE ... TRANSACTION LOG TRUNCATE

The dbbackup utility provides the command line parameter -x for this.

permanent link

answered 02 Sep '11, 02:54

Martin's gravatar image

Martin
8.6k119151237
accept rate: 14%

As Volker mentioned, you can delete the log file and run without one if you are not worried about backup/recover-ability of your data.

However, maintaining an intact log file can be the difference between recovering a corrupt database and starting from scratch. If you have the free space available for the transaction log, I would recommend continuing with the transaction log in place. There is also an option of using incremental logs for backup/recovery, but as always, the strategy you put in place has to be a design-choice.

Here is a link to the help for a little information on the transaction log: http://dcx.sybase.com/index.html#1201/en/dbadmin/da-dbfiles-s-4160005.html

permanent link

answered 02 Sep '11, 10:58

Tyson%20Lewis's gravatar image

Tyson Lewis
2.2k1641
accept rate: 22%

edited 02 Sep '11, 10:59

Also as I have learned from the Sybase Gurus having no transaction logfile will be a little bit slower than having one. So my recommendation is to use a logfile.

(02 Sep '11, 13:56) Martin
Replies hidden

AFAIK, it can be noticably slower: When you run a database without a transaction log, every COMMIT statement will force a CHECKPOINT. And when applications run in AUTO COMMIT mode, that will lead to very frequent checkpoints...

That said, I have understood (and answered) Sam's question as dealing with getting rid of the initial transaction log of a freshly created database, not of generally running without one... but that's just my understanding:)

(02 Sep '11, 14:37) Volker Barth

You can also run the database in bulkmode (-b) to avoid creation of a log file after restart of the server engine.

But don't use this in a productive Environment.

permanent link

answered 05 Sep '11, 12:02

Thomas%20Duemesnil's gravatar image

Thomas Dueme...
2.6k263661
accept rate: 17%

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:

×104
×34
×23

question asked: 02 Sep '11, 01:30

question was seen: 6,438 times

last updated: 05 Sep '11, 12:02