The nzhistcreatedb command

Use this command to create a history database including all the tables, views, and other objects needed to collect history data.

Syntax

The command has the following syntax:
nzhistcreatedb option [option ...]

Inputs

The nzhistcreatedb command takes the following options:
Table 1. The nzhistcreatedb input options
Input Description
{-d | --db} dbname The name of the history database to be created. 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 on which the database resides. The default and only possible value for this option is NZ_HOST.
{-t | --db-type} [Q|query|A|audit] The type of the database to be created:
Q | query
A query database collects and stores the data that is most commonly needed to monitor and report on the query activity of a system.
A | audit
An audit database collects the same data as a query database, but stores the data in row-secured tables and digitally signs the data to prevent it from being changed. You can also specify that an audit database is to log the activity of all users or of specific users or groups. For more information about audit history databases, see the IBM® Netezza® Advanced Security Administrator's Guide.
Important: The specified type must match the history database type specified in the CREATE HISTORY CONFIGURATION command used to create the active history configuration; otherwise, the loader process fails.
{-o | --owner}user The user account of the owner of the history database. The specified user account must already be defined and must have Create Database privilege. The default is NZ_USER. You cannot specify the admin user to be the database owner.

If the owner (-o parameter) and load user (-u parameter) accounts are different, the owner account must also be granted the List privilege for the load user account.

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:

-o \"MyUserName\"

{-p | --pw} password The password for the owner user account. The default is NZ_PASSWORD.
{-u | --user} user The load user, that is, the user account that is to be used to load history data into the database. The load user is automatically granted the privileges that are needed to perform the corresponding insert operations. The default load user is the database owner. You cannot specify the admin user to be the load user.

The password for the load user is not specified in this command; instead, it is specified in the history configuration.

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\"

{-v | --schema} number The number of the schema version that is to be used for the history database that is to be created.
Important: The specified version number must match the version number specified in the CREATE HISTORY CONFIGURATION command used to create the active history configuration; otherwise, the loader process fails.
-h | --help Display the usage and syntax for the command.

Outputs

The nzhistcreatedb command has the following output messages:
Table 2. The nzhistcreatedb output messages
Message Description
History database name created successfully ! The command completed successfully.
ERROR: History database qhist not created:

ERROR: GrantRevokeCommand: group/user "name" not found

The command failed because the specified user name did not exist on the system.
ERROR: History database dev not created:

ERROR: createdb: object "hist1" already exists.

The command failed because the specified database name exists on the system.
ERROR: History database hist1 not created:

nzsql: Password authentication failed for user 'name'

The command failed because the password for the specified owner was not correct.
ERROR: History database hist1 not created:

ERROR: CREATE DATABASE: permission denied.

The command failed because the specified owner does not have Create Database privileges on the system.
ERROR: History database hist1 not created:

ERROR: GrantRevokeCommand: permission denied on "bug".

The specified owner account does not have the List privilege for the specified user account or the User object class. The owner must have the List privilege to complete the privilege assignments.

Description

The nzhistcreatedb command creates a history database and configures its ownership and access permissions. It creates the history database object, all the history tables and views, and grants the permissions for the owner and user accounts that are specified in the command. The command can take several (four to five) minutes to complete processing.

Privileges required
You must be the logged in as the nz user to run this command.

Usage

The following command creates a history database with the name histdb:
[nz@nzhost ~]$ nzhistcreatedb -d histdb -t query -v 1 -u jones
  -o smith -p password123
This operation may take a few minutes. Please wait...
Creating tables .................done
Creating views .......done
Granting privileges ....done
History database histdb created successfully !

The command can take several minutes to complete, depending on how busy the system is.