Logical Standby Upgrade


Logical Standby Upgrade : 


Step 1
Prepare for rolling upgrade
Database A : Primary
Database B : Logical

Database B > ALTER DATABASE STOP LOGICAL STANDBY APPLY;
Ensure compatible parameter same on both side
Step 2
Upgrade the logical standby database
Database A : Now Primary   :  Running on old Software
Database B : Now Logical     :  Running on new Software .
Step 3
Restart SQL Apply on the upgraded logical standby database
Database B > ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE;
Database B >  SELECT SYSDATE, APPLIED_TIME FROM V$LOGSTDBY_PROGRESS;
Step 4
Monitor events on the upgraded standby database
Database B >  SELECT EVENT_TIMESTAMP, EVENT, STATUS FROM DBA_LOGSTDBY_EVENTS  ORDER BY EVENT_TIMESTAMP;

Any row returned indicate that not all of the changes that occurred on Database A have been applied to Database B . So decide whether to continue
Step 5
Begin a switchover
Database A >  ALTER DATABASE COMMIT TO SWITCHOVER TO LOGICAL STANDBY;

Database A : Now Logical   :  Running on old Software
Database B : Now Logical   :  Running on new Software .
Step 6
Import any tables that were modified during the upgrade
If unsupported tables were modified/DML  durimg upgrade(will appear in output of Step 4 ) , you can import them
Step 7
Complete the switchover and activate user applications
Database B > SELECT SWITCHOVER_STATUS FROM V$DATABASE; (TO PRIMARY)
Database B > ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;

Database A : Now Logical   :  Running on old Software
Database B : Now Primary : Running on new Software . .Unprotected
Step 8
Upgrade the old primary database
Database A : Now Logical   :  Running on new Software
Database B : Now Primary : Running on new Software . Redo getting accumulated.Unprotected
Step 9
Start SQL Apply on the old primary database
Database A > ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE NEW PRIMARY db_link_to_b;
Note : Redo is sent from Database B to Database A
Step 10
Optionally, raise the compatibility level on both databases

Step 11
Monitor events on the new logical standby database
Database A >  SELECT EVENT_TIMESTAMP, EVENT, STATUS FROM DBA_LOGSTDBY_EVENTS  ORDER BY EVENT_TIMESTAMP;

Any row returned indicate that not all of the changes that occurred on Database B have been applied to Database A . So decide whether to continue with this Logical Database A or want to recreate it.
Step 12
Optionally, perform another switchover
To come back to the original roles