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
959405069
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
9.0k127165257
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
24.8k9139296
accept rate: 41%

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:

×48

question asked: 18 Nov '11, 11:35

question was seen: 2,584 times

last updated: 18 Nov '11, 13:21