- What is in the headers of datafiles and blocks?
- What is SCN?
- When does SCN change, at commit or at checkpoint?
- When a query runs how does Oracle find that this data is in that block of that file?
The header of a datafile shows lots of information about the datafile. The data file's number is in the header along with the number of the tablespace it belongs to. The SCN of the last checkpoint is stored here too. To see all of the information stored in a datafile header, query the V$DATAFILE_HEADER view.
The header of a block contains information like the type of segment the block belongs to and the SCN of the last transaction that modified that block. For a more advanced description, please look here. On this web page, look for the header titled "Block Headers."
The SCN is the System Change Number. Oracle uses the SCN to keep track of the relative time changes or actions that occur in the database. The SCN is sequentially increasing so that a lower SCN occurs some time before a higher SCN. A transaction will obtain an SCN at commit. It will also obtain an SCN at the start of the transaction, so that if the system has a failure, Oracle will know when that transaction started in relation to all other changes in the database. SCNs are also acquired by certain background processes as well as for opening the database.