Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Wait option for Oracle 11g DDL (DDL_LOCK_TIMEOUT)

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

The DDL command requires the internal structure of an exclusive lock. If these locks are not available, a "ORA-00054: resource busy" is returned, which can be particularly frustrating when trying to modify frequently accessed objects. To solve this problem, Oracle 11g includes the DDL_LOCK_TIMEOUT parameter, using the alter system and alter session commands at the instance or session level, respectively.

DDL_LOCK_TIMEOUT indicates the number of seconds a DDL command waits for a lock before throwing a "resource busy" error. The default value is 0 (for 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, but not 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 failing.

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 commit the insert of the first session within 20 seconds, alter table will return an execution success message.

SQL > alter table ddl_lock_test add (

Name varchar2 (20)

);

Table altered.

SQL >

For more information, please refer to the official document: http://docs.oracle.com/cd/B28359_01/server.111/b28320/initparams068.htm

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report