cancel
Showing results for 
Search instead for 
Did you mean: 

how to keep test database log file small

Former Member
2,854

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

Accepted Solutions (0)

Answers (2)

Answers (2)

MCMartin
Participant

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
MarkCulp
Participant

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;