Get the App
SLTechnology News&Howtos  ›  Database  › 

What is ORACLE SCN?

Shulou Source: shulou.com Published: 2022-05-31 14:31:17 11月15日 Update

This article mainly explains "What is ORACLE SCN", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let Xiaobian take you to learn "What is ORACLE SCN"!

Oracle scn is the full name of system change number, which translates to system change number. It records the state of Oracle at a given moment. Moreover, only changes will match the corresponding SCN. Only when a row is inserted, deleted, or updated does the state of the database change.

Oracle sorts events that occur within the system through SCN, which increments in SGA like a continuously increasing sequence number. It is critical for data recovery after a database instance crash.

SCN Principle:

When a transaction inserts or modifies data, Oracle first writes a new SCN to the rollback segment. If the transaction commits, lgwr immediately writes the commit record of the transaction to the redo log file, which gets a unique SCN number.

How SCN helps database recovery after instance crash:

Whenever the database performs a checkpoint operation, Oracle writes a start scn number to the header of the datafile, and the control file maintains an SCN value for each datafile called stop scn. Whenever the instance stops normally, Oracle copies the start scn number in the header of the data file to the stop scn number in the data file in the control file. When restarting the database after a normal shutdown, recovery is not required because scn in the data file and scn in the control file match each other. If the instance stops abnormally, which causes the SCN in the control file and data file header to be inconsistent, Oracle considers the instance to be in need of recovery.

At this point, I believe that everyone has a deeper understanding of "what is ORACLE SCN", may wish to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

Tags: Data file instance database control transaction content only state system change learning practical deeper important consistent one line continuous event full name Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Shulou Information Linux MySQL Microsoft