The command_history table

The command_history table contains the list and results of all the SQL administration API functions that were run in the previous 30 days.

The command_history table shows each SQL administration API function that was run and displays information about the user who ran the function, the time the function was run, the primary arguments of the function, and the message returned when the database server completed running the function.

Table 1. The command_history table
Column Data Type Description
cmd_number serial The unique ID for each row.
cmd_exec_time datetime year-to-second The time that the function started.
cmd_user varchar The user who ran the function.
cmd_hostname varchar The name of the host computer from which the function was run.
cmd_executed varchar The primary argument of the function that was run.
cmd_ret_status integer Return code.
cmd_ret_msg lvarchar Return message.

The following table shows sample arguments and the associated results messages in a command_history table.

Table 2. Example information in a command_history table
Argument (cmd_executed) Message Returned (cmd_ret_msg)
set sql tracing on SQL tracing on with 1000 buffers of 2024 bytes.
create dbspace Space 'space12' added.
checkpoint Checkpoint completed.
add log Added 3 logical logs to dbspace logdbs.
To display the command history, run the following SQL statement from the sysadmin database:
SELECT * FROM command_history;

The size of the command_history table

Depending on how many SQL administration API functions are run, the command_history table can grow quite large. You can change the amount of time that information is retained in the command_history table by updating the value field of the COMMAND HISTORY RETENTION row in the ph_threshold table.

You can also use SQL statements like DELETE or TRUNCATE TABLE to manually remove the data from this table.


Copyright© 2018 HCL Technologies Limited