Sunday 12 July 2015

Why do we need odd number of voting disks ?


The reason for the odd number of voting disks is to solve the "split-brain" problem. The split-brain problem occurs when the cluster interconnect goes down and each node cannot obtain a heartbeat from the other nodes. At this time, each node in the cluster thinks they are the only one alive and they think they should become the "master node". There can be only one master node. Each half thinks they are the brains of the operation, which we cannot allow.
So how do we resolve this? 
We set up a race. Each candidate node wants to be the master so we put it up to a vote. Whichever contestant gets the most votes wins. So node 1 contacts the first voting disk and says "I am here first so I am the master!". Simultaneously, node 2 contacts the second voting disk and says  "I am here first so I am the master!". They both can't be right. If there were an even number of voting disks, then it is possible that each candidate node could come up with exactly half the number of total votes and we would have a tie, which must be resolved. Now the real race begins. The two nodes run to the third and final voting disk. The node that gets there first now has 2 votes to 1, wins the election, and becomes the master node in the cluster.

Saturday 4 July 2015

Turning Flashback ON possible when the database is open(starting from 11gR2)

Starting from 11gR2 oracle allows us to  enable the  flashback even the database is in open mode.
But this was not possible in earlier versions, till 11gR1 we can enable the flashback only when the database is in mount mode.


Simulated the situation below with the detailed steps :

11gR2 :

$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Jul 18 04:56:02 2011

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select flashback_on, log_mode, open_mode from v$database;

FLASHBACK_ON       LOG_MODE OPEN_MODE
------------------ ------------ --------------------
NO         ARCHIVELOG   READ WRITE

SQL> alter database flashback on;

Database altered.

SQL> select flashback_on, log_mode, open_mode from v$database;

FLASHBACK_ON       LOG_MODE OPEN_MODE
------------------ ------------ --------------------
YES        ARCHIVELOG   READ WRITE

SQL> alter database flashback off;

Database altered.

SQL> select flashback_on, log_mode, open_mode from v$database;

FLASHBACK_ON       LOG_MODE OPEN_MODE
------------------ ------------ --------------------
NO         ARCHIVELOG   READ WRITE