DDL commands require the internal structure of the exclusive lock. If these locks are not available, an rdquo; ORA-00054: resourcebusyrdquo; will be returned when attempting to modify frequently accessed objects
DDL commands require the internal structure of the exclusive lock. If these locks are not available, an rdquo; ORA-00054: resource busyrdquo; will be returned when attempting to modify frequently accessed objects
DDL commands require the internal structure of the exclusive lock. If these locks are not available, a "ORA-00054: resource busy" will be returned, which can be particularly frustrating when attempting to modify frequently accessed objects, to solve this problem, Oracle 11g contains the DDL_LOCK_TIMEOUT parameter. You can use the alter system and alter session commands at the instance or session level.
DDL_LOCK_TIMEOUT indicates the number of seconds for a DDL command to wait for the lock to be available before the "resource busy" error is thrown. The default value is 0 (NOWAIT ).
SQL> create table ddl_lock_test (
Id number
);
SQL> insert into ddl_lock_test values (1 );
----------- Create a test table and insert a piece of data without commit;
----------- Create a new session, set DDL_LOCK_TIMEOUT to a non-zero value at the session level, and try to add a column to the table;
SQL> alter session set ddl_lock_timeout = 20;
SQL> alter table ddl_lock_test add (
Name varchar2 (20)
);
-------- This session will wait 20 seconds before the failure.
Alter table ddl_lock_test add (name varchar2 (20 ))
*
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT specified
---- If we repeat the alter table command and insert the first session of commit within 20 seconds, alter table will return a message indicating successful execution.
SQL> alter table ddl_lock_test add (
Name varchar2 (20)
);
Table altered.
SQL>