Kbase P20131: How to truncate a database log when the database is online.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  11/02/2009 |
|
Status: Verified
GOAL:
How to truncate a database log online.
GOAL:
Is there a way to truncate the database log file online ?
GOAL:
How to truncate the .lg file while the database is running.
GOAL:
How to set the database log file back to a zero byte value while the database is online.
FACT(s) (Environment):
Progress 9.x
OpenEdge 10.0x
All Supported Operating Systems
FIX:
For OpenEdge 10.1A++ please refer to Solution P6953, "Can I truncate the log file while the database is running?"
The prolog command is used to truncate a database log file when the database is offline. There could be times when it is necessary to truncate the database log file when the database is online. In these cases, prolog is not a viable solution as the command only works against offline databases. Database log files can be set back to a zero byte value while the database is online. The process
is:
1) Backup the current dbname.lg file. (dbname refers to the name of the database)
UNIX: cp dbname.lg origdbname.lg
WIN: copy dbname.lg origdbname.lg
NOTE: 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.
2) Create a new empty database log file in the current directory (UNIX Platform Only)
UNIX: > dbname.lg (Creates an empty log file and maintains the owner and group permissions of the file.)
or
3) Change to a different directory than the one where the existing dbname.lg is located in.
Command: cd directoryname
4) Create a new dbname.lg file that is 0 length in size.
UNIX: touch dbname.lg
WIN: notepad or edit dbname.lg (this will create an empty file, then save the file without adding anything to the file).
5) Then overwrite the existing dbname.lg file with the new empty dbname.lg.
UNIX: cp "empty" dbname.lg to "current" dbname.lg
WIN: copy "empty" dbname.lg to "current" dbname.lg
This solution will not cause harm to the running database. You may however lose a few new entries being written to the log file during the time you are replacing the existing database log file with the new empty one. The method above is used when it is not possible to bring the database down to use the PROLOG command.