참고자료
SQL> DROP TABLE T1 PURGE;
SQL> CREATE TABLE T1( C1 INT, C2 VARCHAR2( 10 ) );
SQL> INSERT INTO T1 SELECT LEVEL, 'AAA' FROM DUAL CONNECT BY LEVEL < 4;
SQL> COMMIT;
SQL> SHOW PARAMETER USER
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
license_max_users integer 0
parallel_adaptive_multi_user boolean TRUE
user_dump_dest string /usr/local/oracle/admin/luxtv/
udump
SQL>
커밋이 완료되었습니다.
SQL> SELECT ROWID, DBMS_ROWID.ROWID_RELATIVE_FNO( ROWID ) AS RELATIVE_FNO
2 , DBMS_ROWID.ROWID_BLOCK_NUMBER( ROWID ) AS BLOCK_NUMBER
3 , C1
4 FROM T1;
ROWID RELATIVE_FNO BLOCK_NUMBER C1
------------------ ------------ ------------ ----------
AAApU+AAGAAABsnAAA 6 6951 1
AAApU+AAGAAABsnAAB 6 6951 2
AAApU+AAGAAABsnAAC 6 6951 3
SQL> DELETE FROM T1 WHERE C1 = 1;
1 행이 삭제되었습니다.
SQL> ALTER SYSTEM DUMP DATAFILE 6 BLOCK 6951; --커밋 전 데이터 블록
시스템이 변경되었습니다.
SQL> SELECT SID FROM V$MYSTAT WHERE ROWNUM <= 1;
SID
----------
314
SQL> SELECT XIDUSN, XIDSLOT, XIDSQN
2 FROM V$TRANSACTION
3 WHERE ADDR = (SELECT TADDR FROM V$SESSION WHERE SID = 314 );
XIDUSN XIDSLOT XIDSQN
---------- ---------- ----------
10 29 52233
SQL> ALTER SYSTEM DUMP UNDO HEADER '_SYSSMU10$'; --커밋 전 언두 헤더
시스템이 변경되었습니다.
SQL> ALTER SYSTEM DUMP UNDO BLOCK '_SYSSMU10$' XID 10 29 52233; --커밋 전 언두 블럭
시스템이 변경되었습니다.
SQL> COMMIT;
커밋이 완료되었습니다.
SQL> ALTER SYSTEM DUMP DATAFILE 6 BLOCK 6951; 커밋 후 데이터 블록
시스템이 변경되었습니다.
SQL> ALTER SYSTEM DUMP UNDO HEADER '_SYSSMU10$'; --커밋 후 언두 헤더
시스템이 변경되었습니다.
SQL> ALTER SYSTEM DUMP UNDO BLOCK '_SYSSMU10$' XID 10 29 52233; --커밋 후 언두 블럭
시스템이 변경되었습니다.
--소문자는 다른 세션 2
SQL> select count(*) from t1;
COUNT(*)
----------
2
SQL> ALTER SYSTEM DUMP DATAFILE 6 BLOCK 6951; -- 다른 세션에서 READ 후 데이터 블록
시스템이 변경되었습니다.
SQL> ALTER SYSTEM DUMP UNDO HEADER '_SYSSMU10$'; -- 다른 세션에서 READ 후 언두 헤더
시스템이 변경되었습니다.
SQL> ALTER SYSTEM DUMP UNDO BLOCK '_SYSSMU10$' XID 10 29 52233; -- 다른 세션에서 READ 후 언두 블럭
시스템이 변경되었습니다.
SQL> DELETE FROM T1 WHERE C1 = 2;
1 행이 삭제되었습니다.
SQL> SELECT XIDUSN, XIDSLOT, XIDSQN
2 FROM V$TRANSACTION
3 WHERE ADDR = (SELECT TADDR FROM V$SESSION WHERE SID = 314 );
XIDUSN XIDSLOT XIDSQN
---------- ---------- ----------
3 20 50124
SQL> ALTER SYSTEM DUMP DATAFILE 6 BLOCK 6951; -- DML 후 데이터 블록
SQL> ALTER SYSTEM DUMP UNDO HEADER '_SYSSMU3$'; -- DML 후 언두 헤더
SQL> ALTER SYSTEM DUMP UNDO BLOCK '_SYSSMU3$' XID 3 20 50124; -- DML 후 언두 블럭
{CODE:SQL}
Start dump data blocks tsn: 7 file#: 6 minblk 6951 maxblk 6951
buffer tsn: 7 rdba: 0x01801b27 (6/6951)
scn: 0x0003.7d3a87ee seq: 0x03 flg: 0x02 tail: 0x87ee0603
frmt: 0x02 chkval: 0x0000 type: 0x06=trans data
Block header dump: 0x01801b27
Object id on Block? Y
seg/obj: 0x2953e csc: 0x03.7d3a8800 itc: 2 flg: E typ: 1 - DATA
brn: 0 bdba: 0x1801b21 ver: 0x01 opc: 0
inc: 0 exflg: 0
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x0007.020.0000d758 0x00800476.5916.21 C--- 0 scn 0x0003.7d3a87ee
0x02 0x000a.01d.0000cc09 0x00800382.509f.21
data_block_dump,data header at 0x1ae69a64
===============
tsiz: 0x1f98
hsiz: 0x18
pbl: 0x1ae69a64
bdba: 0x01801b27
76543210
flag=
{CODE}
SELECT DBMS_UTILITY.DATA_BLOCK_ADDRESS_FILE (TO_NUMBER('00800382','XXXXXXXXX') ) FROM DUAL --상대 파일 번호
SELECT DBMS_UTILITY.DATA_BLOCK_ADDRESS_BLOCK (TO_NUMBER('00800382','XXXXXXXXX') ) FROM DUAL --블록 번호
{CODE}
{CODE:SQL}
********************************************************************************
Undo Segment: _SYSSMU10$ (10)
********************************************************************************
TRN TBL::
index state cflags wrap# uel scn dba parent-xid nub stmt_num cmt
{CODE}
{CODE:SQL}
********************************************************************************
Undo Segment: _SYSSMU10$ (10)
xid: 0x000a.01d.0000cc09
Low Blk : (0, 0)
High Blk : (2, 127)
Object Id : ALL
Layer : ALL
Opcode : ALL
Level : 2
********************************************************************************
UNDO BLK: Extent: 2 Block: 121 dba (file#, block#): 2,0x00000382 <--
xid: 0x000a.01d.0000cc09 seq: 0x509f cnt: 0x21 irb: 0x21 icl: 0x0 flg: 0x0000 <--
*
rdba ( 0x00000001 ) 이라면 이렇게 되지 않을까?( 시간관계상 테스트는 못해봤음 ㅡㅡ^ ) |
---|
{CODE:SQL} ******************************************************************************** Undo Segment: _SYSSMU10$ (10) xid: 0x000a.01d.0000cc09 Low Blk : (0, 0) High Blk : (2, 127) Object Id : ALL Layer : ALL Opcode : ALL Level : 2 |
********************************************************************************
UNDO BLK: Extent: 2 Block: 121 dba (file#, block#): 2,0x00000382 <--
xid: 0x000a.01d.0000cc09 seq: 0x509f cnt: 0x21 irb: 0x21 icl: 0x0 flg: 0x0000
*
********************************************************************************
UNDO BLK: Extent: 2 Block: 121 dba (file#, block#): 2,0x00000383 <--
xid: 0x000a.01d.0000cc09 seq: 0x509f cnt: 0x21 irb: 0x21 icl: 0x0 flg: 0x0000
*
{CODE:SQL}
Start dump data blocks tsn: 7 file#: 6 minblk 6951 maxblk 6951
buffer tsn: 7 rdba: 0x01801b27 (6/6951)
scn: 0x0003.7d3a8b1f seq: 0x01 flg: 0x02 tail: 0x8b1f0601 <--
frmt: 0x02 chkval: 0x0000 type: 0x06=trans data
Block header dump: 0x01801b27
Object id on Block? Y
seg/obj: 0x2953e csc: 0x03.7d3a8800 itc: 2 flg: E typ: 1 - DATA
brn: 0 bdba: 0x1801b21 ver: 0x01 opc: 0
inc: 0 exflg: 0
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x0007.020.0000d758 0x00800476.5916.21 C--- 0 scn 0x0003.7d3a87ee – 7d3a87ee == 2100987886
0x02 0x000a.01d.0000cc09 0x00800382.509f.21 --U- 1 fsc 0x0008.7d3a8b1f – 7d3a8b1f == 7d3a8b1f
data_block_dump,data header at 0x1ae69a64
===============
tsiz: 0x1f98
hsiz: 0x18
pbl: 0x1ae69a64
bdba: 0x01801b27
76543210
flag=
{CODE}
SELECT TO_NUMBER('7d3a87ee','XXXXXXXXX') FROM DUAL --2100987886
SELECT TO_NUMBER('7d3a8b1f','XXXXXXXXX') FROM DUAL --2100988703
{CODE}
{CODE:SQL}
********************************************************************************
Undo Segment: _SYSSMU10$ (10)
********************************************************************************
TRN TBL::
index state cflags wrap# uel scn dba parent-xid nub stmt_num cmt
{CODE}
{CODE:SQL}
*******************************************************************************
Undo Segment: _SYSSMU10$ (10)
xid: 0x000a.01d.0000cc09
Low Blk : (0, 0)
High Blk : (2, 127)
Object Id : ALL
Layer : ALL
Opcode : ALL
Level : 2
+++++++++++ XID mismatch. Some records may not belong to specified transaction.
+ WARNING + Block xid: 0x000a.01b.0000cc05 dba (file#, block#): 2,0x00000382
+++++++++++ Input xid: 0x000a.01d.0000cc09
********************************************************************************
UNDO BLK: Extent: 2 Block: 121 dba (file#, block#): 2,0x00000382
xid: 0x000a.01b.0000cc05 seq: 0x509f cnt: 0x24 irb: 0x24 icl: 0x0 flg: 0x0000
*
{CODE}
{CODE:SQL}
Start dump data blocks tsn: 7 file#: 6 minblk 6951 maxblk 6951
buffer tsn: 7 rdba: 0x01801b27 (6/6951)
scn: 0x0003.7d3a8b1f seq: 0x01 flg: 0x02 tail: 0x8b1f0601
frmt: 0x02 chkval: 0x0000 type: 0x06=trans data
Block header dump: 0x01801b27
Object id on Block? Y
seg/obj: 0x2953e csc: 0x03.7d3a8800 itc: 2 flg: E typ: 1 - DATA
brn: 0 bdba: 0x1801b21 ver: 0x01 opc: 0
inc: 0 exflg: 0
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x0007.020.0000d758 0x00800476.5916.21 C--- 0 scn 0x0003.7d3a87ee
0x02 0x000a.01d.0000cc09 0x00800382.509f.21 --U- 1 fsc 0x0008.7d3a8b1f
data_block_dump,data header at 0x1ae69a64
===============
tsiz: 0x1f98
hsiz: 0x18
pbl: 0x1ae69a64
bdba: 0x01801b27
76543210
flag=
{CODE}
{CODE:SQL}
********************************************************************************
Undo Segment: _SYSSMU10$ (10)
********************************************************************************
TRN TBL::
index state cflags wrap# uel scn dba parent-xid nub stmt_num cmt
{CODE}
{CODE:SQL}
********************************************************************************
Undo Segment: _SYSSMU10$ (10)
xid: 0x000a.01d.0000cc09
Low Blk : (0, 0)
High Blk : (2, 127)
Object Id : ALL
Layer : ALL
Opcode : ALL
Level : 2
+++++++++++ XID mismatch. Some records may not belong to specified transaction.
+ WARNING + Block xid: 0x000a.00a.0000cc02 dba (file#, block#): 2,0x00000382
+++++++++++ Input xid: 0x000a.01d.0000cc09
********************************************************************************
UNDO BLK: Extent: 2 Block: 121 dba (file#, block#): 2,0x00000382
xid: 0x000a.00a.0000cc02 seq: 0x509f cnt: 0x3d irb: 0x3d icl: 0x0 flg: 0x0000
*
{CODE}
{CODE:SQL}
Start dump data blocks tsn: 7 file#: 6 minblk 6951 maxblk 6951
buffer tsn: 7 rdba: 0x01801b27 (6/6951)
scn: 0x0003.7d3a946b seq: 0x01 flg: 0x04 tail: 0x946b0601
frmt: 0x02 chkval: 0x8f4a type: 0x06=trans data
Block header dump: 0x01801b27
Object id on Block? Y
seg/obj: 0x2953e csc: 0x03.7d3a8800 itc: 2 flg: E typ: 1 - DATA
brn: 0 bdba: 0x1801b21 ver: 0x01 opc: 0
inc: 0 exflg: 0
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x0003.014.0000c3cc 0x008005e0.5007.15
data_block_dump,data header at 0x1ae69a64
===============
tsiz: 0x1f98
hsiz: 0x18
pbl: 0x1ae69a64
bdba: 0x01801b27
76543210
flag=
{CODE}
{CODE:SQL}
********************************************************************************
Undo Segment: _SYSSMU3$ (3)
********************************************************************************
TRN TBL::
index state cflags wrap# uel scn dba parent-xid nub stmt_num cmt
{CODE}
{CODE:SQL}
********************************************************************************
Undo Segment: _SYSSMU3$ (3)
xid: 0x0003.014.0000c3cc
Low Blk : (0, 0)
High Blk : (2, 127)
Object Id : ALL
Layer : ALL
Opcode : ALL
Level : 2
********************************************************************************
UNDO BLK: Extent: 2 Block: 87 dba (file#, block#): 2,0x000005e0
xid: 0x0003.014.0000c3cc seq: 0x5007 cnt: 0x15 irb: 0x15 icl: 0x0 flg: 0x0000
*
{CODE}
US# NAME SCNBAS SCNWRP STATUS$
{CODE:SQL}
SQL> DROP TABLE T2 PURGE;
SQL> CREATE TABLE T2( C1 NUMBER, C2 VARCHAR2( 10 ) );
SQL> INSERT INTO T2 SELECT LEVEL, 'C2' FROM DUAL CONNECT BY LEVEL <= 1000;
SQL> SELECT RELATIVE_FNO, BLOCK_NUMBER, COUNT(*) CNT
2 FROM (
3 SELECT ROWID, DBMS_ROWID.ROWID_RELATIVE_FNO( ROWID ) AS RELATIVE_FNO
4 , DBMS_ROWID.ROWID_BLOCK_NUMBER( ROWID ) AS BLOCK_NUMBER
5 , C1
6 FROM T2
7 )
8 GROUP BY RELATIVE_FNO, BLOCK_NUMBER;
RELATIVE_FNO BLOCK_NUMBER CNT
SQL> SELECT SID FROM V$MYSTAT WHERE ROWNUM <= 1;
SID
SQL> SELECT XIDUSN, XIDSLOT, XIDSQN
2 FROM V$TRANSACTION
3 WHERE ADDR = (SELECT TADDR FROM V$SESSION WHERE SID = 314 );
XIDUSN XIDSLOT XIDSQN
SQL> COMMIT;
커밋이 완료되었습니다.
SQL> ALTER SYSTEM DUMP DATAFILE 6 BLOCK 6960;
시스템이 변경되었습니다.
SQL> ALTER SYSTEM DUMP UNDO HEADER '_SYSSMU2$';
시스템이 변경되었습니다.
{CODE}
{CODE:SQL}
SQL> SELECT RELATIVE_FNO, BLOCK_NUMBER, COUNT(*) CNT
2 FROM (
3 SELECT ROWID, DBMS_ROWID.ROWID_RELATIVE_FNO( ROWID ) AS RELATIVE_FNO
4 , DBMS_ROWID.ROWID_BLOCK_NUMBER( ROWID ) AS BLOCK_NUMBER
5 , C1
6 FROM T2
7 )
8 GROUP BY RELATIVE_FNO, BLOCK_NUMBER;
RELATIVE_FNO BLOCK_NUMBER CNT
SQL> DELETE FROM T2;
1000 행이 삭제되었습니다.
SQL> SELECT SID FROM V$MYSTAT WHERE ROWNUM <= 1;
SID
SQL> SELECT XIDUSN, XIDSLOT, XIDSQN
2 FROM V$TRANSACTION
3 WHERE ADDR = (SELECT TADDR FROM V$SESSION WHERE SID = 297 );
XIDUSN XIDSLOT XIDSQN
SQL> ALTER SYSTEM DUMP DATAFILE 6 BLOCK 6960; --커밋 전 데이터 블록 덤프
시스템이 변경되었습니다.
SQL> ALTER SYSTEM DUMP UNDO HEADER '_SYSSMU4$'; --커밋 전 언두 헤더
시스템이 변경되었습니다.
SQL> ALTER SYSTEM FLUSH BUFFER_CACHE;
시스템이 변경되었습니다.
SQL> COMMIT;
커밋이 완료되었습니다.
SQL> ALTER SYSTEM DUMP DATAFILE 6 BLOCK 6960; -- Buffer Flush, COMMIT 후 데이터 블록 덤프
시스템이 변경되었습니다.
SQL> ALTER SYSTEM DUMP UNDO HEADER '_SYSSMU4$'; -- Buffer Flush, COMMIT 후 언두 헤더
시스템이 변경되었습니다.
SQL> select count(*) from t2; --다른 세션에서 실행
COUNT(*)
SQL> ALTER SYSTEM DUMP DATAFILE 6 BLOCK 6960; -- READ 후 데이터 블록 덤프
시스템이 변경되었습니다.
SQL> ALTER SYSTEM DUMP UNDO HEADER '_SYSSMU4$'; -- READ 후 언두 헤더
시스템이 변경되었습니다.
{CODE}
{CODE:SQL}
Start dump data blocks tsn: 7 file#: 6 minblk 6960 maxblk 6960
buffer tsn: 7 rdba: 0x01801b30 (6/6960)
scn: 0x0003.7d3b7844 seq: 0x01 flg: 0x02 tail: 0x78440601
frmt: 0x02 chkval: 0x0000 type: 0x06=trans data
Block header dump: 0x01801b30
Object id on Block? Y
seg/obj: 0x29591 csc: 0x03.7d3b782b itc: 2 flg: E typ: 1 - DATA
brn: 0 bdba: 0x1801b29 ver: 0x01 opc: 0
inc: 0 exflg: 0
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x0002.01e.0000ce65 0x0080020f.50e4.1d --U- 386 fsc 0x0000.7d3b7844
0x02 0x0000.000.00000000 0x00000000.0000.00
data_block_dump,data header at 0x175faa64
===============
tsiz: 0x1f98
hsiz: 0x316
pbl: 0x175faa64
bdba: 0x01801b30
76543210
flag=
{CODE}
{CODE:SQL}
********************************************************************************
Undo Segment: _SYSSMU2$ (2)
********************************************************************************
TRN CTL:: seq: 0x50e4 chd: 0x0005 ctl: 0x001e inc: 0x00000000 nfb: 0x0002
mgc: 0x8201 xts: 0x0068 flg: 0x0001 opt: 2147483646 (0x7ffffffe)
uba: 0x0080020f.50e4.19 scn: 0x0003.7d3b71e5
TRN TBL::
index state cflags wrap# uel scn dba parent-xid nub stmt_num cmt
{CODE}
{CODE:SQL}
Start dump data blocks tsn: 7 file#: 6 minblk 6960 maxblk 6960
buffer tsn: 7 rdba: 0x01801b30 (6/6960)
scn: 0x0003.7d3b787e seq: 0x20 flg: 0x00 tail: 0x787e0620
frmt: 0x02 chkval: 0x0000 type: 0x06=trans data
Block header dump: 0x01801b30
Object id on Block? Y
seg/obj: 0x29591 csc: 0x03.7d3b7879 itc: 2 flg: E typ: 1 - DATA
brn: 0 bdba: 0x1801b29 ver: 0x01 opc: 0
inc: 0 exflg: 0
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x0002.01e.0000ce65 0x0080020f.50e4.1d C--- 0 scn 0x0003.7d3b7844
0x02 0x0004.00d.0000e937 0x008006bc.555d.20
data_block_dump,data header at 0x6e76a64
===============
tsiz: 0x1f98
hsiz: 0x316
pbl: 0x06e76a64
bdba: 0x01801b30
76543210
flag=
{CODE}
{CODE:SQL}
********************************************************************************
Undo Segment: _SYSSMU4$ (4) -- 만약 언두 헤더가 2이라면
********************************************************************************
TRN CTL:: seq: 0x555d chd: 0x0000 ctl: 0x0028 inc: 0x00000000 nfb: 0x0002
mgc: 0x8201 xts: 0x0068 flg: 0x0001 opt: 2147483646 (0x7ffffffe)
uba: 0x008006ac.555d.16 scn: 0x0003.7d3b741d <-- 트랜잭션 슬롯 재사용으로 클린아웃을 위해 왼쪽 scn이 0x0003.7d3b7713 게 변경된다구 함
TRN TBL::
index state cflags wrap# uel scn dba parent-xid nub stmt_num cmt
{CODE}
{CODE:SQL}
Start dump data blocks tsn: 7 file#: 6 minblk 6960 maxblk 6960
buffer tsn: 7 rdba: 0x01801b30 (6/6960)
scn: 0x0003.7d3b787e seq: 0x20 flg: 0x04 tail: 0x787e0620
frmt: 0x02 chkval: 0xd8d5 type: 0x06=trans data
Block header dump: 0x01801b30
Object id on Block? Y
seg/obj: 0x29591 csc: 0x03.7d3b7879 itc: 2 flg: E typ: 1 - DATA
brn: 0 bdba: 0x1801b29 ver: 0x01 opc: 0
inc: 0 exflg: 0
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x0002.01e.0000ce65 0x0080020f.50e4.1d C--- 0 scn 0x0003.7d3b7844
0x02 0x0004.00d.0000e937 0x008006bc.555d.20
data_block_dump,data header at 0x6e76a64
===============
tsiz: 0x1f98
hsiz: 0x316
pbl: 0x06e76a64
bdba: 0x01801b30
76543210
flag=
{CODE}
{CODE:SQL}
********************************************************************************
Undo Segment: _SYSSMU4$ (4)
********************************************************************************
TRN CTL:: seq: 0x555d chd: 0x0000 ctl: 0x000d inc: 0x00000000 nfb: 0x0003
mgc: 0x8201 xts: 0x0068 flg: 0x0001 opt: 2147483646 (0x7ffffffe)
uba: 0x008006ac.555d.16 scn: 0x0003.7d3b741d
TRN TBL::
index state cflags wrap# uel scn dba parent-xid nub stmt_num cmt
{CODE}
{CODE:SQL}
Start dump data blocks tsn: 7 file#: 6 minblk 6960 maxblk 6960
buffer tsn: 7 rdba: 0x01801b30 (6/6960)
scn: 0x0003.7d3b78c1 seq: 0x01 flg: 0x00 tail: 0x78c10601
frmt: 0x02 chkval: 0x0000 type: 0x06=trans data
Block header dump: 0x01801b30
Object id on Block? Y
seg/obj: 0x29591 csc: 0x03.7d3b78c1 itc: 2 flg: E typ: 1 - DATA
brn: 0 bdba: 0x1801b29 ver: 0x01 opc: 0
inc: 0 exflg: 0
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x0002.01e.0000ce65 0x0080020f.50e4.1d C--- 0 scn 0x0003.7d3b7844
0x02 0x0004.00d.0000e937 0x008006bc.555d.20 C--- 0 scn 0x0003.7d3b78ac
data_block_dump,data header at 0x6e76a64
===============
tsiz: 0x1f98
hsiz: 0x316
pbl: 0x06e76a64
bdba: 0x01801b30
76543210
flag=
{CODE}
{CODE:SQL}``
********************************************************************************
Undo Segment: _SYSSMU4$ (4)
********************************************************************************
TRN CTL:: seq: 0x555d chd: 0x0000 ctl: 0x000d inc: 0x00000000 nfb: 0x0003
mgc: 0x8201 xts: 0x0068 flg: 0x0001 opt: 2147483646 (0x7ffffffe)
uba: 0x008006ac.555d.16 scn: 0x0003.7d3b741d
TRN TBL::
index state cflags wrap# uel scn dba parent-xid nub stmt_num cmt
{CODE}