The nzhistcleanupdb command

Use the nzhistcleanupdb command to periodically delete old history information from a history database.

Synopsis

Syntax for deleting old history information from a history database:
nzhistcleanupdb [options]

Inputs

The nzhistcleanupdb command takes the following input options. The input options have two forms for the option names.
Table 1. The nzhistcleanupdb inputs
Input Description
{-d | --db} dbname The name of the history database from which you want to remove old data. If you want to specify a delimited name, you must enclose the name in double quotation marks, and you must escape the quotes with a backslash. For example:

-d \"MyDbName\"

{-n | --host} NZ_HOST The host name of the system where the database resides. The default and only value for this option is NZ_HOST.
{-u | --user} user The user account that permits access to the database. The default is NZ_USER. The user must both be able to access the history database and must have the Delete privilege for the history database tables.

If you want to specify a delimited name, you must enclose the name in double quotation marks, and you must escape the quotes with a backslash. For example:

-u \"MyUserName\"

{-p | --pw} password The password for the user account that permits access to the database. The default is NZ_PASSWORD.
{-t | --time} "<yyyy-mm-dd[,hh:mm[:ss] ]>" The date and time threshold. All data recorded before this date and time is deleted. The date (year, month, and day) is required. The time (hours, minutes, and seconds) is optional. The default time is 12:00 AM (midnight, start of day).
-f | --force Do not prompt for confirmation.
-g | --groom Run a groom operation (that is, automatically issue the GROOM TABLE command) after the cleanup operation completes. This updates the zone maps for the history data tables, which improves the performance of queries against those tables.
-h | --help Display the usage and syntax for the command.

Outputs

None.

Description

After running the command, you can run nzreclaim to completely remove the deleted rows in the table. However, use caution when planning the time to reclaim. Reclaims lock the tables that they process, which can cause the loader to error when attempting to load new history data.

Privileges required
You must be the nz user to run this command.
Common tasks
This command deletes old history information from a history database.

Usage

The following deletes history data which is older than January 1, 2009,10:45 p.m., from the histdb history database:
nzhistcleanupdb -d histdb -u myuser -p password -t "1/1/2009,22:45"