Maintaining a history database
A history database grows as it accumulates history information. Plan for routine maintenance of the history database. Determine the amount of time that you need to keep the history data before you can archive or delete it (for example, keep only data for the current and previous month, or the current and previous quarter, or for the current year only).
To dispose of outdated history data:
- Issue the nzhistcleanupdb command and specify a date and time threshold (see The nzhistcleanupdb command). All data recorded before this date and time is deleted. The user you specify for this command must both be able to access the history database and must have the Delete privilege for the history database tables.
- To completely remove the deleted rows in the history database, issue the nzreclaim command (see The nzreclaim command).
For example:
- The following command removes from the history database with the
name histdb any history data that was collected before October 31,
2013, and automatically grooms the history tables afterward:
[nz@nzhost ~]$ nzhistcleanupdb -d histdb -u smith -pw password -t "2009-10-31" -g About to DELETE all history entries older than 2013-10-31 00:00:00 (GMT) from histdb. Proceed (yes/no)? :yes BEGIN DELETE 0 DELETE 98 ⋮ DELETE 503 COMMIT
- The following command completely removes the deleted rows in the
history database:
[nz@nzhost ~]$ nzreclaim -db histdb -u smith -pw password -alltbls -records