Site icon Database Tutorials

Performing SwitchOver

In today’s article we will be learning how to Performing SwitchOver.

1. First, we move the logs in our live database.

(PRIMARY_1)

(PRIMARY_2)

2. We check the SWITCHOVER status of the primary database. The result of this operation should be “SESSION ACTIVE” or “TO STANDBY”.

(PRIMARY_1)

3. We check the SWITCHOVER status of our standby database. The result of this operation should be “SESSION ACTIVE” or “NOT ALLOWED”.

(STANDBY_1)

We also check the status of our STANDBY database.

4. Now we SWITCH our PRIMARY database to STANDBY.

(PRIMARY_1)

(PRIMARY_2)

5. It is necessary to DEFER the sending of logs for a while because the PRIMARY database is not up yet.

(PRIMARY_1)

6. Now we can set our STANDBY database to PRIMARY.

(STANDBY_1)

7. We can initialize our old PRIMARY database, our current STANDBY database, to the REDO LOG APPLY process.

(PRIMARY_1)

8. If we want, we can open our STANDBY database (former primary) with READ ONLY MODE.

(PRIMARY_1)

Let’s check the database we opened in READ ONLY MODE, is it really READ ONLY?

9. After the above process, let’s check the status of our PRIMARY and STANDBY databases.

(PRIMARY_1)

(STANDBY_1)

10. Let’s check if the “LOG SHIPPING” operation between PRIMARY and STANDBY databases works correctly.

Before INSERT, we check the status of the logs.

(PRIMARY_1) (Standby)

I’m entering new data into the database.

(STANDBY_1) (Primary)

After the INSERT, we check the log status.

(PRIMARY_1) (Standby)

Now we can check if the data is coming to our standby database.

11. As seen in the previous operation step, the SWITCHOVER operation has been completed successfully. Our PRIMARY database is now Standby, our STANDBY database is now Primary.

12. The ALERT_LOG output when performing the SWITCHOVER operation is as follows.

(PRIMARY_1)

(STANDBY_1)

 

Exit mobile version