db2 database log cleanup

  1, archive log     

  When using the db2 database archive log (by modifying the parameters are changed LOGARCHMETH1 archive log) when the number of logs is not cleaned regularly, will piled up, will definitely last full disk, database access problems. Archive log is divided into three activity log, archive log online and off-line archive logs.

  • Activity Log: This log contains information related to the transaction unit has not yet been committed or rolled back, and the information has been submitted but not yet written to the transaction database file.
  • Online archive logs: When the activity log of all changes to the normal treatment is not needed, that the log recorded in the transaction have been submitted and written to the database file, the activity log to a log online archive. Call online, and because they activity log stored in the same directory.
  • Offline archive log: Copy the online archive logs from the active log directory to another place archive, known as off-line archive logs. These logs may roll still needs time to recover before the database. (So-called online archive log, the log file is archived and the active log file in the same directory; and off-line archive log, the log file is kept separate from the activity log)

2, delete the archive log

  1, archive log viewer  

db2 list history archive log all for dbname

 

  2, view the backup timestamp

db2 list history backup all for dbname

  

3, the time stamp 20190712001102 clear before all offline archived logs

db2 prune history 20190712001102 with force option and delete

    Note: db2 prune history 20190712001102 will be clearly specified timestamp and all entries before (not just archived information, also includes backup). By default, the log file will not be clear after the last database backup information

 

  4, view the backup history log to find the most recent backup of the database

db2 list history backup all for dbname

 

  5, sub-clear online backup log before S0000699.LOG

db2 connect to dbname user user using pwaswd;
db2 prune logfile prior to S0000699.LOG

 

 3. Other notes

View current activity log

db2pd -db dbname -logs

prune logfile prior to XXXXXXX.LOG addition to activities under the previous XXXXXXX.log log directory online archive log files
db2 prune history [XXXXXXXXXXXXXX] with force option and delete to clear the timestamp of the previous archive log files offline

Guess you like

Origin www.cnblogs.com/zxw-xxcsl/p/11230262.html