Oracle promotes the database scn and oraclescn by modifying the control file scn

Source: Internet
Author: User

Oracle promotes the database scn and oraclescn by modifying the control file scn

Current scn of the database

The Code is as follows:
Idle> select checkpoint_change # from v $ database;

CHECKPOINT_CHANGE #
------------------
271743118

Idle> shutdown abort

The ORACLE routine has been disabled.
Scn in the analysis control file

 


Here we can see that the bold part is the database scn

The Code is as follows:
SQL> select to_number ('10327a59', 'xxxxxxxxxxx') from dual;

TO_NUMBER ('10327a59', 'xxxxxxxxxx ')
---------------------------------
271743577

The scn value here is slightly different from the value queried in the database, because there is a time difference between the query time point and the database I completely shut down, and this time difference has changed. the text box in red shows the block verification information of the control file.

Modify control file scn and verification information
The verification information is changed to 0, and the scn information can be modified as needed. Here, the scn of the database is changed to 57253932971026, according to the principle of the database, the scn after startup should be slightly greater than the scn value.


The Code is as follows:
SQL> select to_number ('123', 'xxxxxxxxxxxxxxxxxxxxx') from dual;

TO_NUMBER ('2008080', 'xxxxxxxxxxxxxxxxxxxx') (www.111cn.net)
---------------------------------------------
57253932971026

Start Database
Idle> startup mount
The ORACLE routine has been started.

The Code is as follows:
Total System Global Area 400846848 bytes
Fixed Size 2440024 bytes
Variable Size 289408168 bytes
Database Buffers 100663296 bytes
Redo Buffers 8335360 bytes

The database has been loaded.

The Code is as follows:
Idle> recover database;
Media recovery is completed.
Idle> alter database open;

The database has been changed.

Idle> select checkpoint_change # from v $ database;

CHECKPOINT_CHANGE #
------------------
57253932991028

After the database is started, the query scn is 57253932991028 (the current scn of the database) slightly greater than 57253932971026 (modifying the control file scn). It turns out that we can completely push the database scn by modifying the control file scn. no lab is highly risky. Do not test it in the production environment. You are solely responsible for the load.
From: http://www.111cn.net/database/Oracle/60235.htm


Why does an oracle data file have SCN?

Start scn
Oracle stores the scn of this checkpoint in the file header of each data file. This value is called Startup scn because it is used when the database instance is started,
Check whether database recovery is required.
Select name, checkpoint_change # from v $ datafile_header
Terminate scn
The ending scn of each data file is stored in the control file.
Select name, last_change # from v $ datafile
This SCN number is used to check whether instance recovery is required during database startup. Only when the database file status changes
When the database runs normally, this SCN is NULL for the online data files that can be read and written.

ORACLE has four SCN types: System checkpoint SCN

One important thing you lack here is the log. The checkpoint will first be recorded in the log. How can you know where to recover without this database?

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.