Oracle's database operations are recorded in the redo log for undo (rollback) or redo (redo) at the time of the database exception. Redo log is also divided into online (online log) and archive (archive log) two parts.
Oracle has 3 online log files by default, usually written in sequential order with one and the next, while full online log files are organized into archived logs. Within each online log, data may be filled in order or randomly.
Online logs and archive logs, are composed of a number of blocks, the file 1th as a file header, including the block size, the total number of blocks and other information, the 2nd block as the database header, including database information (such as version number, database ID, file ordinal, etc.). By default, the block size is 512bytes, there may be 1k, 2k, and so on (I have not encountered), so the redo log file size must be an integer multiple of 512 bytes.
Data format for block 1th:
struct fh0 { uint32_t unknown0; uint32_t unknown1; uint32_t unknown2; uint32_t unknown3; uint32_t Unknown4; uint32_t blocksize; // size per block (bytes), 512/1024 ... uint32_t Blockcount; // the total number of blocks in the current file (excluding the first block) uint32_t unknown5; uint8_t nouse[480];} Redo_fh0;
Redo_fh0
Data format for block 2nd:
typedefstructSCN {uint32_t scnbase; uint16_t Scnwrapper; uint16_t filler;} Redo_scn;typedefstructfh1 {redo_bh blockhead; uint32_t Unknown0; uint32_t COMVSN; //Compatibility Vsnuint32_t dbid; uint8_t dbname[8];//"ORCL" (SID)uint32_t controlseq; uint32_t filesize; uint32_t blocksize; uint16_t FileNum; uint16_t filetype; uint32_t Activid; uint8_t nouse0[ $];//0uint8_t descript[ -]; uint32_t NAB; //Next available blockuint32_t Resetcount; REDO_SCN RESETSCN; uint32_t HWS; //after 3 bytes is 0uint32_t thread; REDO_SCN LOWSCN; uint32_t Lowscntime; REDO_SCN NEXTSCN; uint32_t Nextscntime; uint32_t unknown11; REDO_SCN ENABLESCN; uint32_t Enablescntime; REDO_SCN THRCLOSESCN; uint32_t Thrclosescntime; uint8_t unknown13[ the]; REDO_SCN PREVRESETSCN; uint32_t Prevresetcount; uint8_t nouse1[ the];//0uint8_t unknown14[ $]; uint8_t nouse2[ -];//0}REDO_FH1;
redo_fh1
The 1th block is completely different from the rest of the block, it does not contain a block size and is not included in the total number of blocks. Starting with the 2nd block, the first 16 bytes of all data blocks are size, format:
struct BH { uint32_t signature; // Signature uint32_t Blocknum; // Block number uint32_t sequence; // Sequence Number uint16_t offset; // The highest bit 1 needs to be filtered out uint16_t Checksum;} REDO_BH;
REDO_BH
The following is a detailed study of archive logs.
Oracle 11g Archive Log Research _1