When a database user inserts, updates, or deletes data from a table in a database, or adds a table's primary key, or the table's index, a ora-00054 often occurs: resource busy and acquire with Nowait specified errors.
It is mainly because a transaction is being executed (or the transaction has been locked), which leads to execution failure.
1. Users with DBA permissions can view database locks
Select t2.username, t2.sid, t2.serial #, t2.logon _ time
From v $ locked_object T1, V $ session T2
Where t1.session _ id = t2.sid order by t2.logon _ time;
Example: testuser 339 13545 17:40:05
Testuser, whose Sid is 339 and serial # Is 13545
2. view the specificSQLStatement. If SQL is not important, kill it.
Select SQL _text from V $ session A, V $ sqltext_with_newlines B
Where decode (A. SQL _hash_value, 0, prev_hash_value, SQL _hash_value) = B. hash_value
And a. Sid = & SID order by piece;
The SQL statement, for example, begin: ID: = SYS. dbms_transaction.local_transaction_id; end;
3. Kill the transaction
Alter system kill session '00000045 ';
4. You can execute other transaction SQL statements.
For example, add the table's primary key:
Alter table Test
Add constraint pk_test primary key (test_no );
5,If prompted: ORA-00030: user session ID does not exist
Alter session set events 'immediate trace name flush_cache level 1 ';
Unknown consequences
ORA-00031: session marked for kill
After some Oracle processes are killed, the state is set to "killed", but the locked resources are not released for a long time. Sometimes there is no way to restart the database. Now we provide a way to solve this problem, that is, it cannot be killed in Oracle, and it can be killed again at the OS level.
ora-00054: Resource busy and acquire with Nowait specified solution