Instance recovery and Oracle SCN

Source: Internet
Author: User
A simple understanding of oracle's SCN is its own time function, just like the linux system's own time, oracle also has its own set of time. When you close the database cleanly, shutdownimmediate or altersystemcheckpoint will write the SCN value to four locations, of which 3 are in controlfile and 1 is in datafi.

A simple understanding of oracle's SCN is its own time function, just like the linux system's own time, oracle also has its own set of time. When you shut down the database cleanly, shutdown immediate or use alter system checkpoint will write the SCN value to four locations, of which 3 are in controlfile and 1 is in datafi

A simple understanding of oracle's SCN is its own time function, just like the linux system's own time, oracle also has its own set of time.

When you close the database cleanly, shutdown immediate or use alter system checkpoint will write the SCN value to four locations, three of which are in controlfile and one in datafile header.

The three SCN in controlfile are: 1, system checkpoint SCN 2, datafile checkpoint SCN 3, and stop SCN.

--- System checkpoint SCN Query

SQL> select checkpoint_change # from v $ database;

--- Datafile checkpoint SCN Query

SQL> select name, checkpoint_change # from v $ datafile where name like '% user % ';

--- Stop SCN Query

SQL> select name, last_change # from v $ datafile where name like '% user % ';

The stop SCN is NUll when the database is in normal use.

The scn in the datafile header is: start SCN

--- Start SCN Query

SQL> select name, checkpoint_change # from v $ datafile_header were name like '% user % ';

1. Clean shutdown

When clean shutdown is enabled, the checkpoint is executed, and the stop scn of datafile is the same as the start scn in the control file. When the open database is used, Oracle checks whether the start scn in the datafile header is the same as the scn in the datafile stored in the control file. If it is the same, check whether the start scn of the datafile header is the same as the stop scn stored in the control file. If it is still the same, the database will be enabled normally; otherwise, recovery is required.

When the database is enabled, the stop scn stored in the control file will be restored to the NULL value, indicating that datafile is open in normal mode.

2. Abnormal shutdown

If SHUTDOWN is abnormal (shutdown abort), after you mount the database, you will find that the stop scn is not equal to the scn at other locations, but is equal to NULL, which means that Oracle does not perform a checkpoint during shutdown, instance crash recovery (instance recovery) is required for the next boot ).

Note:

(1) when starting the database, if the stop scn = NULL is found, instancecrash recovery is required;

(2) when starting the database, if the start scn with the datafile header is not equal to the datafile scn stored in CONTROLFILE, Media recovery is required.

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.