Home » Server Options » RAC & Failsafe » Why does RAC have two different SCN? (oracle_11gR2, HPUX)
Why does RAC have two different SCN? [message #677109] Mon, 19 August 2019 22:59 Go to next message
kalenko
Messages: 40
Registered: January 2018
Member
Hi,

As my understanding, in Rac environment, there are two or more instances and there is only one database. But why does Rac environment have multiple SCN, each instance has one SCN. Why does one database have multiple SCN. Please explain to me why?

Thanks.

[Updated on: Mon, 19 August 2019 23:28]

Report message to a moderator

Re: Why does RAC have two different SCN? [message #677110 is a reply to message #677109] Tue, 20 August 2019 00:40 Go to previous messageGo to next message
John Watson
Messages: 8960
Registered: January 2010
Location: Global Village
Senior Member
THere is one SCN, maintained in the controlfile.
Re: Why does RAC have two different SCN? [message #677111 is a reply to message #677110] Tue, 20 August 2019 01:24 Go to previous messageGo to next message
kalenko
Messages: 40
Registered: January 2018
Member
John Watson wrote on Tue, 20 August 2019 00:40
THere is one SCN, maintained in the controlfile.
Here is my production database query result, you can notice that there are two SCN:
SQL> select inst_id, current_scn from gv$database;
   INST_ID                    CURRENT_SCN
---------- ------------------------------
         1                 10192277795005
         2                 10192277795013

SQL> 
If I stand at the command window, which SCN can I use in my flashback table statement?
Re: Why does RAC have two different SCN? [message #677112 is a reply to message #677111] Tue, 20 August 2019 01:38 Go to previous messageGo to next message
John Watson
Messages: 8960
Registered: January 2010
Location: Global Village
Senior Member
No. Each instance is reporting the current scn, as of the time of the query as seen by each instance. GV$ views are populated by a union all of queries run in each instance. The content is not protected by undo, hence no read consistency.
Re: Why does RAC have two different SCN? [message #677113 is a reply to message #677109] Tue, 20 August 2019 01:40 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator

You can read this paper: SCN What, why, and how?. It is quite old but accurate for your Oracle version.


What happens in RAC?
In RAC, instance that receive the update from external system will increase the SCN of the database SCN to the new higher SCN. When other instances query for next SCN, immediately that SCN increase will be propagated to other instances too.
Re: Why does RAC have two different SCN? [message #677115 is a reply to message #677112] Tue, 20 August 2019 01:50 Go to previous messageGo to next message
kalenko
Messages: 40
Registered: January 2018
Member
I don't say I will flashback the GV$ view. What I mean is before I flashback a table, I have to get the current SCN, I run the query above and which SCN can I use for this scenario?
Re: Why does RAC have two different SCN? [message #677116 is a reply to message #677115] Tue, 20 August 2019 01:53 Go to previous messageGo to next message
John Watson
Messages: 8960
Registered: January 2010
Location: Global Village
Senior Member
I'll try to explain again, in even simpler terms.

Log on to one instance, and query v$database. Then log on to the other instance, and query v$database. The results will not be the same. That is all a GV$ view is: a UNION ALL of queries run in each instance. There is no reason why the results would be the same.
Re: Why does RAC have two different SCN? [message #677117 is a reply to message #677116] Tue, 20 August 2019 02:11 Go to previous message
kalenko
Messages: 40
Registered: January 2018
Member
John Watson wrote on Tue, 20 August 2019 01:53
I'll try to explain again, in even simpler terms.

Log on to one instance, and query v$database. Then log on to the other instance, and query v$database. The results will not be the same. That is all a GV$ view is: a UNION ALL of queries run in each instance. There is no reason why the results would be the same.
OK, I've got the answer for my question. I will query the v$database for the SCN and continue to work in the current session or work in the session which connects to the same instance. Is this correct?

[Updated on: Tue, 20 August 2019 02:13]

Report message to a moderator

Previous Topic: How to find block device from oracleasm disk?
Next Topic: Root.sh failed
Goto Forum:
  


Current Time: Thu Nov 21 06:52:39 CST 2024