Forcing out transactions when altering table fragments
You can enable the server to force out transactions that have opened or hold locks on the target table of an ALTER FRAGMENT ON TABLE operation in a logging database. Users holding the DBA access privilege can do this by enabling the FORCE_DDL_EXEC session environment option of the SET ENVIRONMENT statement.
About this task
You might want to do this on a busy system, perhaps one that runs 24 hours a day, if you do not want to wait for sessions to close before you alter a fragment.
Be aware, however, that by forcing out concurrent transactions to avoid waiting for locks to be released, the database server closes the Update cursors and rolls back the transactions of other users.
Prerequisites:
- You must be user informix or hold DBA access privileges on the database.
- The table must be in a database that supports transaction logging.
Procedure
To force out concurrent transactions of other sessions when altering a table fragment:
Example
- enable the FORCE_DDL_EXEC session environment option for 100 seconds,
- set the database server to wait up to 25 seconds for locks to be released,
- and change the interval size and storage location of range fragment p2 of table tabF:
SET ENVIRONMENT FORCE_DDL_EXEC '100';
SET LOCK MODE TO WAIT 25;
ALTER FRAGMENT ON TABLE tabF MODIFY
PARTITION p2 TO PARTITION p2 VALUES < 500 IN dbs0;
While the ALTER FRAGMENT statement above is running, other transactions that attempt to access rows in table tabF are at risk of being forced out, if their Update cursor holds locks on rows in fragment p2.
-458 Long transaction aborted.
The
concurrent transaction failing with error -458
was
not necessarily "long," but it had not yet been committed after opening
or holding locks on the same table that the ALTER FRAGMENT statement
in this example was modifying.What to do next
After you complete an ALTER FRAGMENT ON TABLE operation with the FORCE_DDL_EXEC session environment option enabled, you can turn the FORCE_DDL_EXEC session environment option off. For example, specify:
SET ENVIRONMENT FORCE_DDL_EXEC OFF;