Update and redoupdate in redo

Source: Internet
Author: User

Update and redoupdate in redo
SQL> select * from v $ version where rownum = 1;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-Production
SQL>! Uname-
Linux localhost. localdomain 2.6.18-194. el5 #1 SMP Mon Mar 29 20:06:41 EDT 2010 i686 i686 i386 GNU/Linux
Bytes.
First, create a table tt and insert data:

SQL> select * from tt;

ID
----------
0
2
3
4
5
6
7
8
9
10


10 rows have been selected.

To facilitate subsequent research, you can force log switching:
Alter system switch logfile;
SQL> select * from v $ log;


GROUP # THREAD # SEQUENCE # bytes blocksize members arc status FIRST_CHANGE # FIRST_TIME
----------------------------------------------------------------------------------------------------------
NEXT_CHANGE # NEXT_TIME
--------------------------
1 1 592 52428800 512 1 yes inactive 10459317 23-6 months-15
10460687-6-15


2 1 593 52428800 512 1 yes inactive 10460687 23-6 months-15
10460698-6-15


3 1 594 52428800 512 1 no current 10460698 23-6 months-15
2.8147E + 14




SQL> select * from v $ logfile;


GROUP # STATUS TYPE
------------------------
MEMBER
Bytes ------------------------------------------------------------------------------------------------------------------------
IS _
---
3 ONLINE
/U01/app/oracle/oradata/orcl3939/redo03.log
NO


2 ONLINE
/U01/app/oracle/oradata/orcl3939/redo02.log
NO


1 ONLINE
/U01/app/oracle/oradata/orcl3939/redo01.log
NO


SQL> select sid, serial #, username from v $ session where username = 'hr ';


Sid serial # USERNAME
--------------------------------------------------
147 38 HR
SQL> update tt set id = 1 where id = 0;


1 row updated.


SQL> commit;


Submitted.



SQL> alter system dump logfile '/u01/app/oracle/oradata/orcl3939/redo03.log ';


The system has been changed.


SQL> select value from v $ diag_info where name = 'default Trace file ';


VALUE
--------------------------------------------------------------------------------
/U01/app/oracle/diag/rdbms/orcl3939/orcl3939/trace/orcl3939_ora_7209.trc


Before introducing the following content, let's talk about two concepts:
Redo record: A redo record is usually composed of a set of change vectors. It is a set of change vectors, representing changes to a database, such as dml operations, minimum unit for Database Change recovery. In this example, the update redo record includes the change vectors of the corresponding rollback segments and the change vectors of the corresponding data blocks.
Change vector: A change vector represents a change made to a data block in the database. The Change Vector includes the version number of the changed data block, the transaction operation code, the address of the changed slave data block (DBA), and the changed data. In this example, an update transaction contains a series of change vectors. Modifications to data blocks are a vector, and modifications to rollback segments are a vector.


The following is a trace file from a log file:


Redo record-Thread: 1 RBA: 0x000252. 00000004.0010 LEN: 0x0214 VLD: 0x0d
SCN: 0x0000. 009f9e26 SUBSCN: 1 06/23/2015 19:33:04
Change Vector 1:

CHANGE #1 TYP: 2 CLS: 1 AFN: 4 DBA: 0x01088f OBJ: 79489 SCN: 0x0000. 009f9a3d SEQ: 1 OP: 11.5 ENC: 0 RBL: 0
KTB Redo
Op: 0x11 ver: 0x01
Compat bit: 4 (post-11) padding: 1
Op: F xid: 0x0009. 006.00001023 uba: 0x00c00988. 051b. 39
Block cleanout record, scn: 0x0000. 009f9e23 ver: 0x01 opt: 0x02, entries follow...
Itli: 2 flg: 2 scn: 0x0000. 009f9a3d
KDO Op code: URP row dependencies Disabled
Xtype: XA flags: 0x00000000 bdba: 0x000008f hdba: 0x000008a
Itli: 1 ispac: 0 maxfr: 4858
Tabn: 0 slot: 0 (0x0) flag: 0x2c lock: 1 ckix: 191
Ncol: 1 nnew: 1 size: 1
Col 0: [2] c1 02 col 0 after modification, the value is 1, c1 is the symbol bit (hexadecimal number), 02 is the value bit
CHANGE #2 TYP: 0 CLS: 33 AFN: 3 DBA: 0x00c00100 OBJ: 4294967295 SCN: 0x0000. 009f9df2 SEQ: 2 OP: 5.2 ENC: 0 RBL: 0
Ktudh redo: slt: 0x0006 sqn: 0x00001023 flg: 0x0012 siz: 160 fbi: 0
Uba: 0x00c00988. 051b. 39 pxid: 0x0000. 000.00000000
CHANGE #3 TYP: 0 CLS: 33 AFN: 3 DBA: 0x00c00100 OBJ: 4294967295 SCN: 0x0000. 009f9e26 SEQ: 1 OP: 5.4 ENC: 0 RBL: 0
Ktucm redo: slt: 0x0006 sqn: 0x00001023 srt: 0 sta: 9 flg: 0x0
CHANGE #4 TYP: 0 CLS: 34 AFN: 3 DBA: 0x00c00988 OBJ: 4294967295 SCN: 0x0000. 009f9df2 SEQ: 3 OP: 5.1 ENC: 0 RBL: 0
Ktudb redo: siz: 160 spc: 522 flg: 0x0012 seq: 0x051b rec: 0x39
Xid: 0x0009. 006.00001023
Ktubl redo: slt: 6 rci: 0 opc: 11.1 [objn: 77450 objd: 79489 tsn: 4]
Undo type: Regular undo Begin trans Last buffer split: No
Temp Object: No
Tablespace Undo: No
0x00000000 prev ctl uba: 0x00c00988. 051b. 36
Prev ctl max cmt scn: 0x0000. 009f99e1 prev tx cmt scn: 0x0000. 009f99e9
Txn start scn: 0x0000. 009f9e05 logon user: 106 prev brb: 12585348 prev bcl: 0 BuExt idx: 0 flg2: 0
KDO undo record:
KTB Redo
Op: 0x04 ver: 0x01
Compat bit: 4 (post-11) padding: 1
Op: L itl: xid: 0x0004. 019.00000c0b uba: 0x00c01397. 030b. 38
Flg: C --- lkc: 0 scn: 0x0000. 009f926c
KDO Op code: URP row dependencies Disabled
Xtype: XA flags: 0x00000000 bdba: 0x000008f hdba: 0x000008a
Itli: 1 ispac: 0 maxfr: 4858
Tabn: 0 slot: 0 (0x0) flag: 0x2c lock: 0 ckix: 191
Ncol: 1 nnew: 1 size:-1
Col 0: [1] col 0 before 80 modification: The value is 0, 80 is the symbol bit (hexadecimal number)
The above is just a brief introduction to the content recorded in the log file during update. If you are interested, you can study delete, insert, and so on,

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.