IBM Support

Truncate Table returns error -106 non-exclusive access

Troubleshooting


Problem

Running the truncate table statement can result in errors where the table could not be opened due to non exclusive access.

Symptom

The following errors will be returned:
242: Could not open database table (tabname).
106: ISAM error: non-exclusive access.

Cause

The TRUNCATE statement fails if any of the following conditions exist:
The user does not hold the Delete access privilege on the table.
The table has an enabled Delete trigger, but the user lacks the Alter privilege.
The specified table or synonym does not exist in the local database.
The table was defined by the CREATE EXTERNAL TABLE statement.
The specified synonym does not reference a table in the local database.
The statement specifies a synonym for a local table, but the USETABLENAME environment variable is set.
The statement specifies the name of a view or a synonym for a view.
The table is a system catalog table or a system-monitoring interface (SMI) table.
An R-tree index is defined on the table.
The table is a virtual table (or has a virtual-index interface) for which no valid am_truncate access method exists in the database.
An Enterprise Replication replicate that is not a master replicate is defined on the table. (For more information about replicates, see the IBM Informix Enterprise Replication Guide.)
A shared or exclusive lock on the table already exists.
One or more cursors are open on the table.
A concurrent session with Dirty Read isolation level is reading the table.
Another table, with at least one row, has an enabled foreign-key constraint on the specified table. (An enabled foreign key constraint of another table that has no rows, however, has no effect on a TRUNCATE operation.)

Resolving The Problem

There may be another session that has a access left on this table.

On smaller systems:

  1. run onstat -g ses 0 > session.out
  2. Edit session.out and search for that table name. Identify that sesid(session ID) for each query or transaction running on that table. Note: There could be multiple entries on this table.
  3. run onmode -z <sesid> to kill each session and release the resources
  4. If onmode -z does not kill hte session(s), the database server will need to be recycled to free up these resources.

[{"Product":{"code":"SSGU8G","label":"Informix Servers"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"--","Platform":[{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"11.5;11.7;12.1","Edition":"","Line of Business":{"code":"","label":""}}]

Document Information

Modified date:
16 June 2018

UID

swg21674115