Skip to Main Content
  • Questions
  • Primary/Standby DB switch without data guard

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question.

Asked: August 07, 2020 - 12:57 am UTC

Last updated: August 10, 2020 - 3:57 am UTC

Version: 11.2.0.4.0

Viewed 1000+ times

You Asked

Hi Tom,

I have got primary/standby setup manually without Data Guard. The 2 instances are running on different Linux servers - same file system configuration.

The archive logs are copied and applied from primary to standby by scripts regularly.

What is the correct process to switch the role manually?

Here is what I did
1/ Do a log switch from primary, shutdown the primary

2/ Apply all outstanding archive logs to Standby

3/ Promote the standby to primary as below - that works fine
alter database activate standby database;
alter database open;

4/ Create Standby control file from the new primary :
alter database create standby control file as '/tmp/test.ctl';

5/ On old Primary server
overwrite the 3 control files with the newly created test.ctl and run below without issue:
startup nomount;
alter database mount standby database;

6/ When I start applying new archive logs from the new primary on the new standby DB I got following error:
SYS@test > recover standby database;
ORA-00283: recovery session canceled due to errors
ORA-19909: datafile 1 belongs to an orphan incarnation
ORA-01110: data file 1: '/database/oradata/test/system01.dbf'

What did I do wrong here?



and Connor said...

A while back (ie, I can't remember exactly when :-)) we introduced the concept of incarnations so that you could recover *through* a resetlogs command. In that way, when we saw archivelog (say) 1000 from a database, we would know if it was the archivelog #1000 from 2 weeks back, or the "new" archivelog #1000 which was created after a resetlogs command that came a couple of days ago.

What has probably happened is that your standby and primary are now different incarnations.

On each database, run in RMAN

list incarnation;

You can compare the two, and then reset the incarnation to bring them back in sync

reset database to incarnation nnn;

(Another reason to let DataGuard take care of all of this if possible)

Is this answer out of date? If it is, please let us know via a Comment

More to Explore

Administration

Need more information on Administration? Check out the Administrators guide for the Oracle Database