Friday, March 27, 2020

Oracle Data Guard - How to rebuild PRIMARY after a Failover

If the primary database is not available for a long duration or suffered a permanent failure, then we have to consider a failover (not switchover) to the standby database to make it as the new primary database. Later, we also have to rebuild the old primary database and make it the new standby database.

Assumptions : 

a) The FLASHBACK database feature is turned on.
b) Oracle database version is Oracle 12c R1 (

Note: The last full backup on primary server must be successful and available. This will help in having at least a traditional backup/restore alternative in case the failover to the standby database is not successful.


Run the below steps on the standby server 

a) alter database recover managed standby database cancel; (Must return "Database altered" message quickly.)
b) alter database recover managed standby database finish; (Must return "Database altered" message quickly.)
c) alter database activate standby database; (Must return "Database altered" message quickly.)

At this stage, the database role must be turned as PRIMARY

d) shutdown immediate;
e) startup;

f) select to_char(standby_became_primary_scn) from v$database;  (NOTE THIS SCN value)

Now, it is strongly recommended to take a full database backup.

Rebuild OLD primary database

Run the below steps on the old primary server (which had a permanent problem that made you to do the failover in the first place).

1) shutdown immediate; (If it is already in running status)
2) startup mount;
3) flashback database to SCN nnnnn (Replace nnnnn with the actual SCN value noted in #f above)

4)  alter database convert to physical standby;
5) alter database recover managed standby database disconnect from session; (This will start the managed recovery process - MRP0 in the background)

6) select database_role from v$database; (Must show PHYSICAL STANDBY)

7) select switchover_status from v$database; It can show either "SWITCHOVER PENDING" or "NOT ALLOWED". Both are valid values.

Oracle database 8i to 12c R1 upgrade

This blog post provides the overall approach to upgrade from Oracle 8i (specifically to Oracle 12c R1 (specifically

Is your current version (8i R3) ?

If so, this is the approach. You have to perform two upgrades. The first one is called an intermediate upgrade.

We recommend you to use dbua tool (database upgrade assistant GUI tool) instead of export and import tools.

1) Oracle (8i R3) to Oracle

Do you have access to Oracle support ?

If so, request them to provide you Oracle software (base edition) through a service request.  Install this base software - Then download 8202632 which is the patch number for patchset and apply to the installed folder to bring it up to

Now do a direct upgrade from Oracle to 

2) In a separate path, install Oracle

Then upgrade the upgraded database to Oracle 
Related Posts Plugin for WordPress, Blogger...