Document Type | Troubleshooting
Category | Monitoring/Inspection
Applicable Product Version | 7FS02PS
Error Codes | 12033, 12034
Document Number | TMOTS005
Issue
When executing an ALTER statement during service operation, the error โJDBC-12033: Lock acquisition failed in NOWAIT modeโ occurs.
Cause
The JDBC-12033 error occurs when a DML X lock is not applied during DDL execution, and waiting does not proceed.
Solutions
Set a lock on the table before performing the ALTER statement.
NoteIn the current situation, it appears that the transaction applying the lock is waiting, so a commit/rollback guide is provided to resolve the blocking.
Session 1 | Session 2 |
|---|---|
create table test01 (id number); | |
insert into test01 values (1); | Lock table test01 in exclusive mode wait 10; โ Waits up to 10 seconds until the insert is committed. After 10 seconds, a timeout occurs, the lock is not set, and error โ12034โ occurs (TBR-12034: Lock acquisition timed out in WAIT mode.) โ Cannot acquire lock if another session has the table locked. |
commit; | |
Locked. | |
SQL> alter table test01 add id2 number; Table 'TEST01' altered. โ For DDL, commit is automatic, so no separate commit is required. | |
| SQL> commit; Commit completed. | |
| SQL> insert into test01 values (2, 1); 1 row inserted. | |
| SQL> commit; Commit completed. | |
| SQL> select * from test01; ID ID2 1 2 1 2 rows selected. | |
If the session holding the lock is disconnected, the lock is automatically released. |