Where is the SCN number written?

Jack_Miller發表於2011-12-12
Does the SCN number get written to the online redo log files? What are all the places where the SCN number does get written?

The System Change Number (SCN) is how Oracle internally keeps track of the timing of events (i.e., transactions) in the database. The SCN does not have a time associated with it, but a higher SCN occurred after a lower SCN. There is no correlation between the SCN values and the time between when the SCNs were generated. Two SCNs that differ by a value of 10 could be generated one second apart or 10 minutes apart.

Since the online redo log files contain transaction information, it is useful to know when that transaction took place, relative to other transactions. So SCNs are written to the online redo log files. Any record written to the online redo log file has an associated SCN so the database will know when that change took place.

The SCN is stored in other places as well. One of the most important is the control files. The control file keeps track of changes to the database. As such, it needs to know the SCN.

The datafile headers also contain the SCN of the most recent transaction that changed the datafile's contents. When you start Oracle, Oracle checks the SCN in the datafile with the SCN in the control file. If the SCN in the datafile is "older" than the SCN in the control file, Oracle knows that the file needs recovery. When you make a tablespace READ ONLY, all of its datafiles have the SCN frozen, but Oracle does not worry about this because it knows the files have not had changes made to it.

Another place the SCN is stored is in the data block. The SCN in the block will show when the block's contents were last updated.


轉自:http://searchoracle.techtarget.com/answer/Where-is-the-SCN-number-written

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25791987/viewspace-713194/,如需轉載,請註明出處,否則將追究法律責任。

相關文章