zoukankan      html  css  js  c++  java
  • 创建bitmap index 时对表的加锁方式

    前一篇博客研究了 创建B*tree索引时 对表的加锁方式,现在来研究一下创建bitmap时对表的加锁方式。本文基于10gR2

    测试表基于上一篇博客的test表。文档上面说9i不能以online方式创建bitmap index.

    SQL> create table lock_obj (username varchar2(100),sid number,lock_type varchar2(100),
      2   object_name varchar2(100),XIDUSN number,XIDSLOT number,XIDSQN  number);

    Table created

    SQL> grant select any dictionary to robinson
      2  ;

    Grant succeeded

    SQL>   create or replace trigger t_create_index
      2   before create  on schema
      3  begin
      4  insert into lock_obj
      5  select oracle_username username,session_id sid,decode(
      6    locked_mode,0,'None',1,'Null',2,'Row share',3,'Row Exclusive',4,'Share',
      7   5,'Share Row Exclusive',6,'Exlusive') lock_type,object_name,xidusn,xidslot,xidsqn
      8   from v$locked_object,dba_objects
      9   where v$locked_object.object_id=dba_objects.object_id;
     10   end t_create_index;
     11  /

    Trigger created

    SQL> select count(distinct owner) owner,count( distinct object_id) object_id,count(distinct object_name) object_name,count(distinct status) status,count(*) from test;

         OWNER  OBJECT_ID OBJECT_NAME     STATUS   COUNT(*)
    ---------- ---------- ----------- ---------- ----------
            19      49791       29776          2     273857

    SQL> create bitmap index b_status on test(status) online;

    Index created

    SQL> select * from lock_obj;

    USERNAME          SID LOCK_TYPE            OBJECT_NAME              XIDUSN    XIDSLOT     XIDSQN
    ---------- ---------- -------------------- -------------------- ---------- ---------- ----------
    ROBINSON          139 Row Exclusive        LOCK_OBJ                      0          0          0
    ROBINSON          139 Row share            TEST                          0          0          0
    ROBINSON          139 Row Exclusive        OBJ$                         10         10        305
    ROBINSON          139 Row Exclusive        LOCK_OBJ                     10         39        304
    ROBINSON          139 Row Exclusive        LOCK_OBJ                     10         10        305
    ROBINSON          139 Row share            TEST                         10         39        304
    ROBINSON          139 Row Exclusive        OBJ$                         10         10        305
    ROBINSON          139 Row Exclusive        LOCK_OBJ                     10         39        304
    ROBINSON          139 Row Exclusive        LOCK_OBJ                     10         10        305
    ROBINSON          139 Share                SYS_JOURNAL_51691            10         10        305
    ROBINSON          139 Row share            TEST                         10         39        304

    11 rows selected
    SQL> delete from lock_obj;

    11 rows deleted

    SQL> commit;

    Commit complete

    SQL> drop index b_status;

    Index dropped

    SQL> create bitmap index   b_status on test(status) ;

    Index created

    SQL> select * from lock_obj;

    USERNAME          SID LOCK_TYPE            OBJECT_NAME              XIDUSN    XIDSLOT     XIDSQN
    ---------- ---------- -------------------- -------------------- ---------- ---------- ----------
    ROBINSON          139 Row Exclusive        LOCK_OBJ                      0          0          0
    ROBINSON          139 Share                TEST                          0          0          0

    从实验中发现,创建B*tree index 和创建 bitmap index 时对表的加锁方式是一样的。

    恩,对于rebuild 也应该是一样的 ,我比较懒 不做测试了。

  • 相关阅读:
    linux下如何查看cpu信息
    Linux更换HBA卡后重新扫盘指令
    oracle 11gR2 RAC存储迁移
    Data Migration from Various Storage Types Using EMC VPLEX and EMC RecoverPoint Technologies
    【11grac】Oracle RAC 更换存储实验
    Oracle RAC 11GR2更换主机不换存储--ASM磁盘组异机挂载 推荐 原创
    ELK(Elasticsearch + Logstash + Kibana) 日志分析平台
    Ogg For Bigdata 同步Oracle数据到KAFKA(包括初始化历史数据)
    stm32cubemx+clion环境搭建
    stdarg宏与实现stm32printf串口打印
  • 原文地址:https://www.cnblogs.com/hehe520/p/6330608.html
Copyright © 2011-2022 走看看