flashback table肯定会造成rowid跟着修改
| flashback table肯定會(huì)造成rowid跟著修改,為什么要開啟行移動(dòng),就是這個(gè)原因 SQL> drop tablespace tp2 including contents and datafiles; Tablespace dropped. SQL> create tablespace tp2 datafile '/u01/app/oracle/oradata/tp2.dbf' size 512K; Tablespace created. SQL> create table t1 (id int,name char(10)) tablespace tp2; Table created. SQL> begin? ??2? ?for i in 1 .. 1000 loop ??3? ? insert into t1 values(i,'gyj'||i); ??4? ?end loop; ??5? ?commit; ??6??end; ??7??/ PL/SQL procedure successfully completed. 查rowid SQL> select rowid,id from t1 where id>=1 and id<=5; ROWID? ?? ?? ?? ?? ?? ?? ? ID ------------------ ---------- AAASvnAAIAAAAAOAAA? ?? ?? ? 1 AAASvnAAIAAAAAOAAB? ?? ?? ? 2 AAASvnAAIAAAAAOAAC? ?? ?? ? 3 AAASvnAAIAAAAAOAAD? ?? ?? ? 4 AAASvnAAIAAAAAOAAE? ?? ?? ? 5 SQL> alter table t1 enable row movement; Table altered. SQL> select current_scn from v$database; CURRENT_SCN ----------- ? ? 6177172 查文件號(hào),塊號(hào),行號(hào) SQL> select id,dbms_rowid.rowid_relative_fno(rowid) file#,dbms_rowid.rowid_block_number(rowid) block#,dbms_rowid.rowid_row_number(rowid) row# from t1 where id>=1 and id<=5; ? ?? ???ID? ?? ?FILE#? ???BLOCK#? ?? ? ROW# ---------- ---------- ---------- ---------- ? ?? ?? ?1? ?? ?? ? 8? ?? ?? ?14? ?? ?? ? 0 ? ?? ?? ?2? ?? ?? ? 8? ?? ?? ?14? ?? ?? ? 1 ? ?? ?? ?3? ?? ?? ? 8? ?? ?? ?14? ?? ?? ? 2 ? ?? ?? ?4? ?? ?? ? 8? ?? ?? ?14? ?? ?? ? 3 ? ?? ?? ?5? ?? ?? ? 8? ?? ?? ?14? ?? ?? ? 4 SQL> delete from t1; 1000 rows deleted. SQL> commit; Commit complete. 插入大量記錄,讓空間用完為止 SQL> begin? ??2? ?for i in 1001 .. 100000 loop ??3? ? insert into t1 values(i,'gyj'||i); ??4? ?commit; ??5? ?end loop; ??6? ?end; ??7??/ begin * ERROR at line 1: ORA-01653: unable to extend table GYJ.T1 by 8 in tablespace TP2 ORA-06512: at line 3 SQL> flashback table t1 to scn 6177172; Flashback complete. 查原來1000行記錄的前5行的rowid,與原來的rowid不一樣了 SQL> select rowid,id from t1 where id>=1 and id<=5; ROWID? ?? ?? ?? ?? ?? ?? ? ID ------------------ ---------- AAASvnAAIAAAAAcAFr? ?? ?? ? 1 AAASvnAAIAAAAAcAFs? ?? ?? ? 2 AAASvnAAIAAAAAcAFt? ?? ?? ? 3 AAASvnAAIAAAAAcAFu? ?? ?? ? 4 AAASvnAAIAAAAAcAFv? ?? ?? ? 5 查原來1000行記錄前5行所在的文件號(hào),塊號(hào),行號(hào),與原來的塊號(hào)行號(hào)不一樣了 SQL> select id,dbms_rowid.rowid_relative_fno(rowid) file#,dbms_rowid.rowid_block_number(rowid) block#,dbms_rowid.rowid_row_number(rowid) row# from t1 where id>=1 and id<=5; ? ?? ???ID? ?? ?FILE#? ???BLOCK#? ?? ? ROW# ---------- ---------- ---------- ---------- ? ?? ?? ?1? ?? ?? ? 8? ?? ?? ?28? ?? ???363 ? ?? ?? ?2? ?? ?? ? 8? ?? ?? ?28? ?? ???364 ? ?? ?? ?3? ?? ?? ? 8? ?? ?? ?28? ?? ???365 ? ?? ?? ?4? ?? ?? ? 8? ?? ?? ?28? ?? ???366 ? ?? ?? ?5? ?? ?? ? 8? ?? ?? ?28? ?? ???367 我做這個(gè)實(shí)驗(yàn)是把表空間搞小一點(diǎn)這樣更方便觀察,在t1表先添加1000條記錄,然后delete,最后再向里面插一些記錄直到期把空間占完,這樣最后新插入的記錄會(huì)占用原來1000條記錄的空間。。。 完畢!
**********本博客所有內(nèi)容均為原創(chuàng),如有轉(zhuǎn)載請(qǐng)注明作者和出處!!!********** QQ: ? ? ? ?252803295 Email: ? ?oracledba_cn@hotmail.com Blog: ? ? ?http://blog.csdn.net/guoyJoe ITPUB: ??http://www.itpub.net/space-uid-28460966.html OCM: ? ??http://education.oracle.com/education/otn/YGuo.HTM 答案在:http://blog.csdn.net/guoyjoe/article/details/8624392 Oracle@Paradise 總?cè)?127149411 Oracle@Paradise No.1群:177089463(已滿) Oracle@Paradise No.2群:121341761 Oracle@Paradise No.3群:140856036 |
轉(zhuǎn)載于:https://blog.51cto.com/guoyjoe/1429053
總結(jié)
以上是生活随笔為你收集整理的flashback table肯定会造成rowid跟着修改的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: RHEL5.4在线调整磁盘分区大小
- 下一篇: 数学分析(Tom M.Apostol)