DBAtlas · Database operations atlas

3961: Snapshot isolation transaction failed because the object was modified by a DDL statement

SQL Server

What does it mean?

A transaction running at snapshot isolation failed because an object it accessed was changed by a DDL statement (schema change) in another concurrent transaction. Metadata is not versioned, so the snapshot transaction cannot continue.

Why does it happen?

While a transaction started at SNAPSHOT isolation (SET TRANSACTION ISOLATION LEVEL SNAPSHOT) is running, another session runs DDL such as ALTER TABLE/CREATE INDEX on a table it accesses. Snapshot transactions can see row versions but not schema versions. This error does not occur under READ COMMITTED SNAPSHOT (RCSI); RCSI takes a new snapshot for each statement.

How to fix it

Retry the transaction; it usually succeeds once the DDL has completed. As a permanent fix, perform schema changes (DDL) in maintenance windows without heavy snapshot workload. Catch this error in the application and implement automatic retry logic. Shorten long-running snapshot transactions.

Open in DBAtlas →

More from this engine