zoukankan      html  css  js  c++  java
  • 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
    版权声明:本文为博主原创文章,转载请附上博文链接!

  • 相关阅读:
    HTML5——WEB存储学习笔记
    show()与showDialog()的区别
    如何为winform程序打包(图解)
    Winform打包程序制作的快捷方式指向错误的位置(指向安装包文件)
    HTML5 ——range学习笔记
    引用 Eclipse异常退出的解决办法
    sql查询数据库中所有包含要查询内容的存储过程、视图等
    sql查询数据库中所有包含要查询内容的存储过程、驶入
    SQL Union和SQL Union All用法
    sql查询数据库所有表(select * from sysobjects )
  • 原文地址:https://www.cnblogs.com/cxxjohnson/p/10007159.html
Copyright © 2011-2022 走看看