為何DDL會產生兩次commit操作

來源:互聯網
上載者:User

以下是我做的測試,在ddl完成之前 就提交了。

1.、會話1上的操作
SQL> select * from t2;
no rows selected
SQL> insert into t2 values(1,'gyj1');
1 row created.
SQL> drop table t200;
drop table t200
*
ERROR at line 1:

ORA-00942: table or view does not exist

2、會話2上的操作
SQL> select * from t2;
ID NAME
---------- ----------
1 gyj1

在會話2能看到會話1中插入資料。

3、繼續實驗
drop table t2;
select current_scn from v$database;
create table t2 (id int,name varchar2(10));
select current_scn from v$database;

SQL> select current_scn from v$database;
create table t2 (id int,name varchar2(10));
select current_scn from v$database;
CURRENT_SCN
-----------
2030192
SQL>
Table created.
SQL>
CURRENT_SCN
-----------
2030199
SQL> select object_id from dba_objects where object_name='T2' and wner='GYJ';
OBJECT_ID
----------
76443

alter system dump logfile '/u01/app/oracle/oradata/ocp/redo01.log' scn min 2030192 scn max 2030199;
從日誌中轉存的部分內容:
REDO RECORD - Thread:1 RBA: 0x0000b5.000000fb.0058 LEN: 0x0060 VLD: 0x01
SCN: 0x0000.001efa71 SUBSCN: 1 12/06/2012 07:33:07
CHANGE #1 TYP:0 CLS:33 AFN:3 DBA:0x00c00100 OBJ:4294967295 SCN:0x0000.001efa70 SEQ:2OP:5.4 ENC:0 RBL:0
ktucm redo: slt: 0x001d sqn: 0x000004db srt: 0 sta: 9 flg: 0x2 ktucf redo: uba: 0x00c0028d.01a2.03 ext: 2 spc: 7832 fbi: 0

REDO RECORD - Thread:1 RBA: 0x0000b5.00000100.01bc LEN: 0x0170 VLD: 0x01
SCN: 0x0000.001efa72 SUBSCN: 1 12/06/2012 07:33:07
CHANGE #1 MEDIA RECOVERY MARKER SCN:0x0000.00000000 SEQ:0 OP:24.1 ENC:0
REDO RECORD - Thread:1 RBA: 0x0000b5.00000102.0010 LEN: 0x00dc VLD: 0x05
SCN: 0x0000.001efa75 SUBSCN: 1 12/06/2012 07:33:07
(LWN RBA: 0x0000b5.00000102.0010 LEN: 0001 NST: 0001 SCN: 0x0000.001efa73)
CHANGE #1 TYP:0 CLS:33 AFN:3 DBA:0x00c00100 OBJ:4294967295 SCN:0x0000.001efa71 SEQ:1 OP:5.4 ENC:0 RBL:0

在這兩個scn之間有兩個OP=5.4的操作,即commit操作。

查看本欄目更多精彩內容:http://www.bianceng.cnhttp://www.bianceng.cn/database/Oracle/

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.