隨筆 - 79  文章 - 11  trackbacks - 0
          <2009年11月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          不再墮落。
          Oracle documents: 
          http://tahiti.oracle.com/

          常用鏈接

          留言簿

          隨筆分類(66)

          隨筆檔案(79)

          相冊

          收藏夾(11)

          搜索

          •  

          積分與排名

          • 積分 - 53462
          • 排名 - 949

          最新隨筆

          最新評論

          閱讀排行榜

          mld@ORCL> drop table dept;

          表已刪除。

          mld
          @ORCL> create table dept
            
          2  (deptno, dname, loc, data,
            
          3   constraint dept_pk primary key(deptno)
            
          4  )
            
          5  as
            
          6  select deptno, dname, loc, rpad('*',3500,'*')
            
          7    from scott.dept;

          表已創建。

          mld
          @ORCL> select deptno, dname,
            
          2         dbms_rowid.rowid_block_number(rowid) blockno,
            
          3             ora_rowscn
            
          4    from dept;

              DEPTNO DNAME             BLOCKNO ORA_ROWSCN
          ---------- -------------- ---------- ----------
                  10 ACCOUNTING         156868    1564176
                  
          20 RESEARCH           156868    1564176
                  
          30 SALES              156869    1564176
                  
          40 OPERATIONS         156869    1564176

          mld
          @ORCL> update dept
            
          2     set dname = lower(dname)
            
          3   where deptno = 10;

          已更新 
          1 行。

          mld
          @ORCL> commit;

          提交完成。

          mld
          @ORCL> select deptno, dname,
            
          2         dbms_rowid.rowid_block_number(rowid) blockno,
            
          3             ora_rowscn
            
          4    from dept;

              DEPTNO DNAME             BLOCKNO ORA_ROWSCN
          ---------- -------------- ---------- ----------
                  10 accounting         156868    1564229
                  
          20 RESEARCH           156868    1564229
                  
          30 SALES              156869    1564176
                  
          40 OPERATIONS         156869    1564176

          mld
          @ORCL>
          --默認:ORA_ROWSCN在塊級維護。


           
          要使ORA_ROWSCN在行級維護,需要重建表,啟用ROWDEPENDENCIES (或者用DBMS_REDEFINITION中的在線重建功能)。

          mld@ORCL> drop table dept;

          表已刪除。

          mld
          @ORCL> create table dept
            
          2  (deptno, dname, loc, data,
            
          3   constraint dept_pk primary key(deptno)
            
          4  )
            
          5  as
            
          6  select deptno, dname, loc, rpad('*',3500,'*')
            
          7    from scott.dept;

          表已創建。

          mld
          @ORCL> select deptno, dname,
            
          2         dbms_rowid.rowid_block_number(rowid) blockno,
            
          3             ora_rowscn
            
          4    from dept;

              DEPTNO DNAME             BLOCKNO ORA_ROWSCN
          ---------- -------------- ---------- ----------
                  10 ACCOUNTING         156868    1564176
                  
          20 RESEARCH           156868    1564176
                  
          30 SALES              156869    1564176
                  
          40 OPERATIONS         156869    1564176

          mld
          @ORCL> update dept
            
          2     set dname = lower(dname)
            
          3   where deptno = 10;

          已更新 
          1 行。

          mld
          @ORCL> commit;

          提交完成。

          mld
          @ORCL> select deptno, dname,
            
          2         dbms_rowid.rowid_block_number(rowid) blockno,
            
          3             ora_rowscn
            
          4    from dept;

              DEPTNO DNAME             BLOCKNO ORA_ROWSCN
          ---------- -------------- ---------- ----------
                  10 accounting         156868    1564229
                  
          20 RESEARCH           156868    1564229
                  
          30 SALES              156869    1564176
                  
          40 OPERATIONS         156869    1564176

          mld
          @ORCL>
          mld
          @ORCL>
          mld
          @ORCL>
          mld
          @ORCL>
          mld
          @ORCL> drop table dept;

          表已刪除。

          mld
          @ORCL> create table dept
            
          2  (deptno, dname, loc, data,
            
          3   constraint dept_pk primary key(deptno)
            
          4  )
            
          5  ROWDEPENDENCIES
            
          6  as
            
          7  select deptno, dname, loc, rpad('*',3500,'*')
            
          8    from scott.dept;

          表已創建。

          mld
          @ORCL> select deptno, dname,
            
          2         dbms_rowid.rowid_block_number(rowid) blockno,
            
          3             ora_rowscn
            
          4    from dept;

              DEPTNO DNAME             BLOCKNO ORA_ROWSCN
          ---------- -------------- ---------- ----------
                  10 ACCOUNTING         156884    1564527
                  
          20 RESEARCH           156884    1564527
                  
          30 SALES              156885    1564527
                  
          40 OPERATIONS         156885    1564527

          mld
          @ORCL> update dept
            
          2     set dname = lower(dname)
            
          3   where deptno = 10;

          已更新 
          1 行。

          mld
          @ORCL> commit;

          提交完成。

          mld
          @ORCL> select deptno, dname,
            
          2         dbms_rowid.rowid_block_number(rowid) blockno,
            
          3             ora_rowscn
            
          4    from dept;

              DEPTNO DNAME             BLOCKNO ORA_ROWSCN
          ---------- -------------- ---------- ----------
                  10 accounting         156884    1564550
                  
          20 RESEARCH           156884    1564527
                  
          30 SALES              156885    1564527
                  
          40 OPERATIONS         156885    1564527

          mld
          @ORCL>
          posted on 2009-05-05 22:55 donnie 閱讀(230) 評論(1)  編輯  收藏 所屬分類: database

          FeedBack:
          # re: 使用ORA_ROWSCN的樂觀鎖定 2009-11-19 14:32 ddd
          抄書 %……&*(  回復  更多評論
            
          主站蜘蛛池模板: 桃江县| 宁安市| 廊坊市| 南和县| 全州县| 增城市| 扎鲁特旗| 威信县| 沁源县| 富锦市| 灯塔市| 海盐县| 五常市| 孟津县| 民县| 崇仁县| 邯郸市| 新竹市| 扎囊县| 巴林左旗| 额敏县| 防城港市| 长沙县| 华亭县| 湖南省| 玉田县| 蓬安县| 林甸县| 田阳县| 平定县| 咸宁市| 保亭| 漯河市| 汉中市| 调兵山市| 靖江市| 安仁县| 凌云县| 蓝山县| 北海市| 青岛市|