Feature of DDL With the WAIT
Option OR Ora-00054 Resource busy error solution in Oracle Database
11g
This is usually common that some time when we try to modify some table and
we got error of "ORA-00054: resource busy" because when we try to modify table
that table is in use.
For overcoming this error in oracle 11g database introduce a parameter
DDL_LOCK_TIMEOUT in which you set the time for which your modify command wait
for showing the error of Ora-00054 . And you can set DDL_LOCK_TIMEOUT parameter
at session as well as on instance level what ever you want.
Example:-
1. In your First session
CREATE TABLE new (
no NUMBER
);
INSERT INTO new VALUES (10);
2. In your second session
open another session and set DDL_LOCK_TIMEOUT to value say 60 sec
ALTER SESSION SET ddl_lock_timeout=60;
and then issue alter command on created table
ALTER TABLE new ADD (
name VARCHAR2(50)
);
Note: Here DDL_LOCK_TIMEOUT value is 60 if in between these 60 seconds you
issue commit command in your first session then your alter command run
successfully in second session and if you didn't issue commit command in
first session then your second session wait for 60 seconds and on 61st seconds
it will give the error of
ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired.
First Case: if issue commit in first session
1. In your First session
CREATE TABLE new (
no NUMBER
);
INSERT INTO new VALUES (10);
commit;
2. In your second session
ALTER TABLE new ADD (
name VARCHAR2(50)
);
Table altered.
SQL>
Second Case: if commit is not issue in first session
1. In your First session
CREATE TABLE new (
no NUMBER
);
INSERT INTO new VALUES (10);
2. In your second session
ALTER TABLE new ADD (
*
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired
No comments:
Post a Comment