Salesforce

How to truncate a database log when PROLOG cannot be used

« Go Back

Information

 
TitleHow to truncate a database log when PROLOG cannot be used
URL NameP20131
Article Number000140317
EnvironmentProduct: Progress
Version: 8.x, 9.x
Product: OpenEdge
Version: 10.x, 11.x
OS: All supported platforms
Question/Problem Description
How to truncate a database lg file online when PROLOG cannot be used
Is there a way to truncate the database log file online without using PROLOG ?
How to truncate the .lg file while the database is running.
How to set the database log file back to a zero byte value while the database is online.
How to manage the size of the database lg file when PROLOG cannot be used
Steps to Reproduce
Clarifying Information
Managing the size of a database lg file.
Error Message
Defect Number
Enhancement Number
Cause
Resolution
Use-Cases where PROLOG is not a viable solution
  • PROLOG was first introduced in Progress 9 as an offline utility
  • In versions prior to OpenEdge 10.1A, the PROLOG utility can be used to truncate a database log file only when the database is offline. 
  • Prior to OpenEdge 10.1C04, 10.2A01, 10.2B, PROLOG cannot truncate database log files larger than 2 GB
  • In OpenEdge 11.7, PROLOG cannot truncate database log files larger than 2 GB due to a regression
For further detail, refer to Article  How truncate the log file while the database is running since 10.1A   

There are times when it is necessary to truncate the database log file while the database is online.  Database log files can however be set back to a zero byte value while the database is online. The following method can be used when it is not possible to bring the database down or use the PROLOG utility:

1.   Backup the current dbname.lg file.  ("dbname" refers to the name of the database)
 
[UNIX]:            cp dbname.lg origdbname.lg
[WINDOWS]:   copy dbname.lg origdbname.lg

Do not use the UNIX mv command to backup the current database log file.  Using this command will preserve the inode and cause the running process to continue writing to the moved file and not the new one.

2a.  Create a new empty database log file in the current directory:
 
[UNIX]:     > dbname.lg
(Creates an empty log file and maintains the owner and group permissions of the file.)

OR

2b.  Change to a different directory than the one where the existing dbname.lg is located in.

[UNIX\WIN]:  cd <directoryname>

Then create a new dbname.lg file that is 0 length in size.
 
[UNIX]:             touch dbname.lg
[WINDOWS]:   notepad or edit dbname.lg
(Create an empty file, then save the file without adding anything to the file).

3.   Overwrite the existing dbname.lg file with the new empty dbname.lg.  
 
[UNIX]:            cp "empty" dbname.lg to "current" dbname.lg
[WINDOWS]:   copy "empty" dbname.lg to "current" dbname.lg

This solution will not cause harm to the running database. 
  • A few new entries being written to the log file during the time the existing database log file is being replaced with the new empty one may be lost. 
  • The new database lg file will allow new connections provided the permissions on the new dbname.lg file are the same as the existing database files.
  • Already spawned remote server process (_mprosrv and _sqlsrv2) will continue to connect remote users as before, but will not log information to the newly created database log file.  To fix this problem, use PROMON to disconnect the remote server process before allowing new remote connections or disconnect remote users then the remote server.  How to terminate a remote server process?  
Workaround
Notes
Keyword Phrase
Last Modified Date2/18/2021 1:54 PM

Powered by