• Oracle 变量之 DDL_LOCK_TIMEOUT


    DDL_LOCK_TIMEOUT
    Property Description
    Parameter type Integer
    Default value 0
    Modifiable ALTER SESSION
    Range of values 0 to 1,000,000 (in seconds)
    Basic No

    DDL_LOCK_TIMEOUT specifies a time limit for how long DDL statements will wait in a DML lock queue. The default value of zero indicates a status of NOWAIT. The maximum value of 1,000,000 seconds will result in the DDL statement waiting forever to acquire a DML lock.

    If a lock is not acquired before the timeout period expires, then an error is returned.

    该参数是oralce 11g中才有的;

    实验:

    --session 1

    SQL> select * from v$version;
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production

    SQL> show parameter ddl
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    ddl_lock_timeout                     integer     0
    enable_ddl_logging                   boolean     FALSE

    --session 2

    SQL> insert into t_1 values('b');
    1 row created.

    --session 3

    SQL> alter table t_1 modify(a varchar2(50));
    alter table t_1 modify(a varchar2(50))
                *
    ERROR at line 1:
    ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired
    该错误是执行之后没有等待直接出现;

    --session 1

    SQL> alter system set ddl_lock_timeout=60;
    System altered.

    SQL> show parameter ddl
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    ddl_lock_timeout                     integer     60
    enable_ddl_logging                   boolean     FALSE

    --session 2

    SQL> insert into t_1 values('a');
    1 row created.

    --session 3

    SQL> alter table t_1 modify (a varchar2(30));
    alter table t_1 modify (a varchar2(30))
                *
    ERROR at line 1:
    ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired

    该错误是在等待了60秒之后才出现;

    --session 3

    SQL> alter table t_1 add  c number;

    则会一直等待下去,直到请求的锁资源被释放(该变量不起作用);

    在网上有些文章说,如果是添加列回立即提交,不敢苟同;
    ---------------------
    作者:搞怪的索引
    来源:CSDN
    原文:https://blog.csdn.net/perfect_db/article/details/9125625
    版权声明:本文为博主原创文章,转载请附上博文链接!

  • 相关阅读:
    【POJ 2987 Firing】 最大权闭合子图
    【sgu176】有源汇有上下界的最大/最小流
    【HDU1263 水果】 STL之map应用经典好题
    【HDU1227 Fast Food】经典DP
    【hdu1043 && poj 1077】八数码问题
    有上下界的网络流问题
    【HDU4521】 dp思想+线段树操作
    miracl库下椭圆曲线方程常用函数使用入门
    函数指针
    python数据查询操作之 一场缺少db.commit()引发的血案……
  • 原文地址:https://www.cnblogs.com/cxxjohnson/p/10007159.html
Copyright © 2020-2023  润新知