The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

Hi. On our customer's production databases, the backup process will truncate the log file. However, on their test database (which is not backed-up) the log file can become very large. How can I setup the test db so that the log file is periodically truncated, without implementing a backup process to get the job done? Thanks, Doug

asked 18 Nov '11, 11:35

dejstone's gravatar image

dejstone
959384969
accept rate: 0%


when starting the database use the follwing switch:

-m database option

Truncates the transaction log when a checkpoint is done. The -m database option must be specified after the database-file, and applies only to that database.

dbsrv... my.db -m
permanent link

answered 18 Nov '11, 12:12

Martin's gravatar image

Martin
8.6k114149237
accept rate: 14%

If you want to keep the log file under a specific size then you could create a GrowLog event that truncates the log:

Here is an example taken from the docs - truncate the log when it becomes greater than 10MB:

CREATE EVENT LogLimit
TYPE GrowLog
WHERE event_condition( 'LogSize' ) > 10
HANDLER
BEGIN
  IF EVENT_PARAMETER( 'NumActive' ) = 1 THEN 
   BACKUP DATABASE
   DIRECTORY 'c:\\logs'
   TRANSACTION LOG ONLY
   TRANSACTION LOG RENAME MATCH;
  END IF;
END;
permanent link

answered 18 Nov '11, 13:21

Mark%20Culp's gravatar image

Mark Culp
22.3k9129262
accept rate: 40%

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:

×30

question asked: 18 Nov '11, 11:35

question was seen: 908 times

last updated: 18 Nov '11, 13:21