How to get the SCN value of the current database

xiaoxiao2021-03-06  58

How to get the SCN value of the current database

--SCN definition and acquisition

Last Updated:

THURSDAY, 2004-12-02 15:04

Eygle

SCN (System Change Number), that is, usually what we said, is a very important data structure in the database.

It defines the versions submitted in some exact time. It is given a unique SCN that is unique to the event when it is submitted. SCN provides Oracle's internal clock mechanism, which can be viewed as a logic clock, which is critical to recovery operations (Oracle only recovered according to SCN).

For many controversies for SCN, many people think that SCN refers to SYSTEM commit number, and usually SCN changes when submitting, so many times, these two nouns are often used alternately.

Which word is actually not the most important, it is important that we know that the SCN is a clock mechanism in Oracle, Oracle maintains the consistency of the database via SCN, and implements Oracle via an important recovery mechanism through SCN. The SCN is assigned by the LGWR order to indicate submit, rollback, and checkpoints.

Let's take a few ways to get the current SCN:

1. In Oracle9i, you can use dBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER to get

E.g:

SQL> SELECT DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER from DUAL

GET_SYSTEM_CHANGE_NUMBER

---------------------------------------------------------------------------------------------------------------------------------------

2982184

2. Before Oracle9i

Can be obtained by querying x $ ktuxe

X $ KTUXE ------------- [K] Ernel [T] RansAction [u] ndo transa [x] TION [E] NTRY (TABLE)

SQL> SELECT MAX (KTuxescnw * Power (2,32) KTUXESCNB) from W $ KTUXE;

Max (KTuxescnw * Power (2,32) KTUXESCNB)

------------------------------------

2980613

Author: eygle, Oracle technology followers, Oracle technical forum itpub.www.eygle.com from China is the biggest author's personal site you may contact the author by Guoqiang.Gai@gmail.com welcome to explore technical exchanges and links. exchange.

Original source:

http://www.eygle.com/faq/how.to.current.scn.of.database.htm

转载请注明原文地址:https://www.9cbs.com/read-85077.html

New Post(0)