ORA-00054 in Oracle: the resource is busy, but specifies a solution to get the resource in Nowait Mode

Source: Internet
Author: User

This error is also caused by operations on a table, such as update and truncate. In addition, if the transaction is not committed, other operations may also cause this exception.

ORA-00054 resource busy and acquire with Nowait specified

Cause: the Nowait keyword forced a return to the command prompt because a resource was unavailable for a lock table or select for update command.

Action: Try the command after a few minutes or enter the command without the Nowait keyword.

Cause: The table is locked or is being operated by anotherProgramThe system is busy.

Solution: unlock a table or wait for completion.

For example, when I modify a table record without a commit and modify the table structure, this exception is triggered.

Exception info: ORA-00054: the resource is busy, but specifies to get the resource in Nowait Mode

Exception Demo:

Let's try to produce the problem in our development environment. I have opened two session that connected to database under a schema. in one session, I have created a table and inserted data into it.

SQL> Create Table A (a number );
Inland transportation
Table created.

SQL> INSERT INTO A values (1 );

1 row created.

I did not yet committed data in session 1. Now in another session whenever I try to any DDL like (ALTER TABLE, drop table) ORA-00054 will produce.

In another session,
SQL> alter table a add B number;
Alter table a add B number
*
Error at line 1:
ORA-00054: Resource busy and acquire with Nowait specified

SQL> drop Table;
Drop Table
*
Error at line 1:
ORA-00054: Resource busy and acquire with Nowait specified

SQL> lock Table A in exclusive mode Nowait;
Lock Table A in exclusive mode Nowait
*
Error at line 1:
ORA-00054: Resource busy and acquire with Nowait specified

Cause of the problem
Whenever you try to do any structural changes on a table Oracle try to lock the table exclusively with Nowait option (this is in 10.2g while in 11G you can change the wait timeout ). if Oracle fails to lock the table exclusively then ORA-00054 will occur.

Solution of the problem
In 10.2G you are limited to several choices to solve the problem. To avoid it,

-Re run the DDL at a later time when the Database become idle.
Or,

-Kill the sessions that are preventing the exclusive lock.
Or,

-Prevent end user to connect to the database and then run the DDL.

You have different views to see locking information about the table. Women's brand rankings
1) dba_blockers: displays a session if it is not waiting for a locked object but is holding a lock on an object for which another session is waiting. In our scenario this view will not help.

2) dba_ddl_locks: it lists all DDL locks held in the database and all outstanding requests for a DDL lock.

3) dba_dml_locks: it lists all DML locks held in the database and all outstanding requests for a DML lock.
If you query from it in the mode_held field you will see 'row exclusive lock '.
SQL> select mode_held from dba_dml_locks where owner = 'maximsg ';

Mode_held
-------------
Row-X (SX)

4) dba_lock: it lists all locks or latches held in the database, and all outstanding requests for a lock or latch.

5) dba_lock_internal: it displays a row for each lock or latch that is being held, and one row for each outstanding request for a lock or latch.

6) dba_locks is a synonym for dba_lock.

7) dba_waiters: shows all the sessions that are waiting for a lock.

In order to see locked object query,

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.