Wednesday, May 23, 2012

SWITHCOVER PROCESS


SWITHCOVER PROCESS


NOTE: - 172.31.1.7 PRIMARY DATABASE

1.Check List Activity (Primary, Local and Remote)

SQL> select name, switchover_status, database_role from v$database;

NAME SWITCHOVER_STATUS DATABASE_ROLE
--------- ------------------ ----------------
GEMS SESSIONS ACTIVE PRIMARY

SQL> select dest_id,dest_name,status, error from v$archive_dest;

    DEST_ID DEST_NAME                                          
---------- ----------------------------------------------------
          1 LOG_ARCHIVE_DEST_1                                  
          2 LOG_ARCHIVE_DEST_2                                  
          3 LOG_ARCHIVE_DEST_3                                  
          4 LOG_ARCHIVE_DEST_4                                  
          5 LOG_ARCHIVE_DEST_5                                  
          6 LOG_ARCHIVE_DEST_6                                  
          7 LOG_ARCHIVE_DEST_7                                  
          8 LOG_ARCHIVE_DEST_8                                  
          9 LOG_ARCHIVE_DEST_9                                  
        10 LOG_ARCHIVE_DEST_10                                

select sequence#,applied from v$archived_log order by 1;
SEQUENCE# APPLIED
--------- -----------
161512 NO
161512 YES
161512 YES
161513 NO
161513 YES
161513 YES
161514 NO
161514 YES
161514 YES

2. At Primary 172.31.1.7

           SQL> alter database backup controlfile to trace;(rename as bkp_ctl_280307.ctl in udump)

           SQL>  alter database create standby controlfile as '/global/export/std_280307.ctl';

           SQL> alter system switch logfile;

   After the archive is applied on both local and remote standby we can proceed  further.                  

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

       


   These will change the database role from primary to physical standby hence   now
                         
                        Primary (172.31.1.7) will be in Standby mode


      3. At Local Standby 172.31.1.3 (NEW PRIMARY DATABASE)

SQL> alter database recover managed standby database cancel;

                                  These will cancel the Managed Recovery Mode (MRM)

              SQL> recover standby database;

                                   These is for making assurance for no archive left for recovery

SQL> alter database commit to switchover to primary;

        These will change the database role from PHYSICAL STANDBY to PRIMARY

      4. SHUTDOWN BOTH THE INSTANCES AT 172.31.1.7 AND 172.31.1.3

172.31.1.7 172.31.1.3
        SQL> shutdown immediate         SQL> shutdown immediate
        Lsnrctl stop GEMS
(will stop the listener for application)
        lsnrctl stop LISTENER
(will stop the default listener )


5. START BOTH THE INSTANCES AT 172.31.1.7 AND 172.31.1.3 (follow steps properly)

172.31.1.3 172.31.1.7
       SQL> startup     SQL> startup nomount
       SQL>select name,switchover_status,
               database_role from v$database;     SQL> alter database mount standby database;
    SQL> alter database recover managed standby
              database disconnect from session;
          These will keep the database in MRM
      SQL>select name, switchover_status,
               database_role from v$database

6. SOME ACTIVITY HAS TO BE DONE ON 172.31.1.3

SQL> create tablespace templ tempfile  '/g09/app/oracle/oradata/GEMS/templ_01.dbf' size 2048m extent management local;
         
             SQL> alter database default temporary tablespace templ;

                 If you want to run application the

                 $ Lsnrctl start GEMS
                 $ Lsnrctl start LISTENER

7. Check the remote standby database status if not restart the instance

SQL> select name, switchover_status, database_role from v$database;

SQL> alter database recover managed standby database cancel;

SQL> recover managed standby database;

               SQL>shutdown immediate

              lsnrctl stop lsnrgemsr

               SQL> startup nomount

SQL> alter database mount standby database;

               SQL> alter database recover managed standby database disconnect from session;

SQL> select name, switchover_status, database_role from v$database;

NAME SWITCHOVER_STATUS DATABASE_ROLE
--------- ------------------ ----------------
GEMS SESSIONS ACTIVE PHYSICAL STANDBY

            $  lsnrctl start lsnrgemsr




In-order to do activity at 172.31.1.7 being standby

 SQL> q

NAME SWITCHOVER_STATUS DATABASE_ROLE
--------- ------------------ ----------------
GEMS SESSIONS ACTIVE PHYSICAL STANDBY

 SQL> alter database recover managed standby database cancel;

 SQL> recover managed standby database;

               SQL>shutdown immediate

             $  lsnrctl stop lsnrgemsr

Take the backup according to the policy


After activity at 172.31.1.7 in standby mode

               SQL> startup nomount


SQL> alter database mount standby database;


               SQL> alter database recover managed standby database disconnect from session;






          SQL> select name, switchover_status, database_role from v$database;


NAME SWITCHOVER_STATUS DATABASE_ROLE
--------- ------------------ ----------------
GEMS SESSIONS ACTIVE PHYSICAL STANDBY

              lsnrctl start lsnrgemsr







SWITCH BACK PROCESS


Note: In order to switch back 172.31.1.7 AS PRIMARY Database, it should be in standby mode, up and running

NOTE: - 172.31.1.3 (PRIMARY DATABASE)

1.Check List Activity (Primary (3), Local (7) and Remote (12))

SQL> select name, swithover_status, database_role from v$database;

SQL> select dest_id, dest_name, status, error from v$archive_dest;

SQL> select sequence#,applied from v$archived_log order by 1;

2. At Primary 172.31.1.3

    SQL> alter database backup controlfile to trace;

SQL> alter system switch logfile;

                      After the archive is applied on both local and remote standby we can proceed further
         

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

                           These will change the database role from primary to physical standby hence now
                            Primary (172.31.1.3) will be in Standby mode

  3. At Local Standby 172.31.1.7

SQL> alter database recover managed standby database cancel;

                                  These will cancel the Managed Recovery Mode (MRM)

              SQL> recover standby database;

                                   These is for making assurance for no archive left for recovery

SQL> alter database commit to switchover to primary;

     These will change the database role from PHYSICAL STANDBY to PRIMARY




4. SHUTDOWN BOTH THE INSTANCES  AT 172.31.1.7 AND 172.31.1.3

172.31.1.7 172.31.1.3
        SQL> shutdown immediate         SQL> shutdown immediate
        Lsnrctl stop GEMS
(will stop the listener for application)
        lsnrctl stop LISTENER
(will stop the default listener )

5. START BOTH THE INSTANCES AT 172.31.1.7 AND 172.31.1.3 (follow steps properly)

172.31.1.7 172.31.1.3
       SQL> startup     SQL> startup nomount
       SQL>select name,switchover_status,
               database_role from v$database     SQL> alter database mount standby database;
      Lsnrctl start GEMS
      Lsnrctl start LISTENER     SQL> alter database recover managed standby
              database disconnect from session;
          These will keep the database in MRM
ALTER SYSTEM SET log_archive_dest_state_2=enable scope=both       SQL>select name,switchover_status,
               database_role from v$database

6. Check the remote standby database status if not restart the instance

SQL> select  name,swithover_status,database_role from v$database;

SQL> alter database recover managed standby database cancel;

SQL> recover managed standby database;

               SQL>shutdown immediate

              lsnrctl stop lsnrgemsr

               SQL> startup nomount

SQL> alter database mount standby database;

               SQL> alter database recover managed standby database disconnect from session;
SQL> select name, swithover_status,database_role from v$database;

              lsnrctl start lsnrgemsr



No comments:

Post a Comment