Atomic operations

When running under COMMIT(*CHG), COMMIT(*CS), or COMMIT(*ALL), all operations are guaranteed to be atomic.

That is, they will complete or they will appear not to have started. This is true regardless of when or how the function was ended or interrupted (such as power failure, abnormal job end, or job cancel).

If COMMIT (*NONE) is specified, however, some underlying database data definition functions are not atomic. The following SQL data definition statements are guaranteed to be atomic:

Notes:
  1. If constraints need to be added or removed, as well as column definitions changed, the operations are processed one at a time, so the entire SQL statement is not atomic. The order of operation is:
    • Remove constraints
    • Drop columns for which the RESTRICT option was specified
    • All other column definition changes (DROP COLUMN CASCADE, ALTER COLUMN, ADD COLUMN)
    • Add constraints
  2. If multiple columns are specified for a COMMENT ON or LABEL ON statement, the columns are processed one at a time, so the entire SQL statement is not atomic, but the COMMENT ON or LABEL ON to each individual column or object will be atomic.
  3. If multiple tables, SQL packages, or users are specified for a GRANT or REVOKE statement, the tables are processed one at a time, so the entire SQL statement is not atomic, but the GRANT or REVOKE to each individual table will be atomic.
  4. If dependent views need to be dropped during DROP TABLE or DROP VIEW, each dependent view is processed one at a time, so the entire SQL statement is not atomic.

The following data definition statements are not atomic because they involve more than one database operation:

Note:
  1. RENAME is atomic only if the name or the system name is changed. When both are changed, the RENAME is not atomic.

For example, a CREATE TABLE can be interrupted after the DB2® UDB for iSeries™ physical file has been created, but before the member has been added. Therefore, in the case of create statements, if an operation ends abnormally, you may need to drop the object and then create it again. In the case of a DROP SCHEMA statement, you may need to drop the schema again or use the CL command Delete Library (DLTLIB) to remove the remaining parts of the schema.