drop log argument: Drop a logical log (SQL administration API)

Use the drop log argument with the admin() or task() function to drop the specified logical log.

Syntax

Read syntax diagramSkip visual syntax diagramEXECUTE FUNCTIONadmintask("drop log","log_number");
Element Description Key Considerations
log_number The logical log file number. The number must be an unsigned integer greater than or equal to 0.

Usage

Use this function to drop a single logical log file.

The database server requires a minimum of three logical-log files at all times. You cannot drop a log file if the database server has only three logical-log files.

Important: Before you can drop any of the first three logical-log files, you must add new logical-log files and run a backup of the logical-log files. The backup must be run using either the ontape -a command or the ontape -c command. After you add the new logical-log files and run a backup, you can then use onparams -d -llognum to delete the first three logical-log files.
The status of the log file determines if the log file can be dropped, and the actions taken by the database server when the log file is dropped:
  • If you drop a log file that has never been written to, status is newly Added (A), the database server deletes the log file and frees the space immediately.
  • If you drop a used log file that has a status of User (U) or Free (F), the database server marks the log file as Deleted (D). After you take a level-0 backup of the dbspaces that contain the log files and the root dbspace, the database server deletes the log file and frees the space.
  • You cannot drop a log file that is currently in use (C) or contains the last checkpoint record (L).

You can obtain the log number from the number field of the onstat -l command. The sequence of log numbers might be out of order.

This function is equivalent to the onparams -d -l lognum command.

Example

The following example drops the logical log with a file number of 2:
EXECUTE FUNCTION task("drop log","2");
The following example drops the log for a specific chunk by looking up the log number based on the chunk number:
SELECT task("drop log", number) FROM sysmaster:syslogfil WHERE chunk = 1;