7 Replies Latest reply: Apr 10, 2014 8:49 AM by petra-K RSS

    Switch to DR server

      Hi all,

       

      11.2.0.1

      Dataguard physical standby.

      We are going to switch to our DR site during holyweek season due to scheduled power shutdown/maintenance at our head office.

      I have not tested switchover yet for physical standby.

       

      I found 2 types of documents for the switchover procedures. Can you tell me if they are both good? or Which is better to use?

       

      Thanks

      pK

       

                                            DOC1:

                                            =====

      A. Switching Between Primary and Standby

       

      1. Ensure that application of logs in standby database is up to date prior to switching of databases.

       

      2. Change primary database to standby database and restart the new standby database by issuing the SQL commands below:

      SQL> alter database commit to switchover to physical standby with session shutdown;

      SQL> shutdown immediate;

      SQL> startup nomount;

      SQL> alter database mount standby database;

      SQL> alter database recover managed standby database using current logfile disconnect;

       

      3. Recheck application of logs to ensure that the last redo log from the primary database is already applied in the standby database.

       

      4. Change standby database to primary database and open new primary database by issuing the SQL commands below:

      SQL> alter database commit to switchover to primary with session shutdown;

      SQL> alter database open;



      DOC2:

      =====

       

      Database Switchover

      A database can be in one of two mutually exclusive modes (primary or standby). These roles can be altered at runtime without loss of data or resetting of redo logs. This process is known as a Switchover and can be performed using the following statements.

      -- Convert primary database to standby

      CONNECT / AS SYSDBA

      ALTER DATABASE COMMIT TO SWITCHOVER TO STANDBY;

      -- Shutdown primary database

      SHUTDOWN IMMEDIATE;

      -- Mount old primary database as standby database

      STARTUP NOMOUNT;

      ALTER DATABASE MOUNT STANDBY DATABASE;

      ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

      On the original standby database issue the following commands.

      -- Convert standby database to primary

      CONNECT / AS SYSDBA

      ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;

      -- Shutdown standby database

      SHUTDOWN IMMEDIATE;

      -- Open old standby database as primary

      STARTUP;

      Once this is complete, test the log transport as before. If everything is working fine, switch the primary database back to the original server by doing another switchover. This is known as a switchback.

        • 1. Re: Switch to DR server
          CKPT

          There are several option associated with the command and also changes according to the version.

          I would say take a look with the MOS documents

           

          11.2 Data Guard Physical Standby Switchover Best Practices using SQL*Plus (Doc ID 1304939.1)


          If you are using Broker


          11.2 Data Guard Physical Standby Switchover Best Practices using the Broker (Doc ID 1305019.1)


          • 2. Re: Switch to DR server

            Thanks Ckpt,

             

            Base on the docs above, it said:

            Verify that the standby database can be switched to the primary role

            Query the SWITCHOVER_STATUS column of the V$DATABASE view on the standby database:

            SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;

             

            SWITCHOVER_STATUS
            -----------------
            TO PRIMARY

             

            I run this command at our standby database, but I got different result

             

            SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;

             

             

            SWITCHOVER_STATUS

            --------------------

            NOT ALLOWED

             

             

            Please help me what to do.

             

            Thanks,

            • 3. Re: Switch to DR server

              rm

              • 4. Re: Switch to DR server
                Veeresh.S

                Hi,

                 

                Add dest_id to the query, you will know the difference, its just sequence no that belong to different location.

                • 5. Re: Switch to DR server

                  Thanks Veeresh,

                   

                  Can you help why my standby has status  NOT ALLOWED  to switch to PRIMARY?

                  • 6. Re: Switch to DR server
                    Veeresh.S

                    petra-K wrote:

                     

                     

                    SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;

                     

                     

                    SWITCHOVER_STATUS

                    --------------------

                    NOT ALLOWED

                     

                     

                    Make sure physical standby database is in sync with the primary and database role is set to physical standby and primary on v$database respectively.

                     

                    check if log archive destination and other standby madatory parameters are configured properly on standby database.

                     

                    you can ignore and proceed further if switchover status is 'session active'......

                    • 7. Re: Switch to DR server

                      Thanks Veeresh,

                       

                      Can you give me what commands to run? for the checking?

                       

                       

                      At PRIMARY, I run:

                       

                      SQL>  ALTER SYSTEM SWITCH LOGFILE;

                       

                       

                      System altered.

                       

                       

                      At STANDBY, I checked if the log sequence is applied.

                       

                      SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#

                       

                      SEQUENCE# APPLIED

                      ---------- ---------

                            5712 YES

                            5713 YES

                            5714 YES

                            5715 YES

                            5716 YES

                            5717 YES

                       

                      And it is applied ok. I see the new 5717 now.