9 Replies Latest reply: Nov 22, 2012 3:59 AM by IGorbatovsky RSS

    Create standby after failover

    IGorbatovsky
      Hello all,

      Recently I had to perform a failover on my standby DB, because my Primary Db had a hardware problem. Now I have to recreate our previously well worked environment. But I stuck just on the first step when I try to restore controlfile. It seems that restore process doesn't recognize controlfile, created for standby, in repository, although the information is there.

      Here are my steps. I think they will tell you more than my long explanations.


      On now primary DB:

      bash-3.2$ tnsping stbill

      TNS Ping Utility for HPUX: Version 10.2.0.4.0 - Production on 11-NOV-2012 13:14:01

      Copyright (c) 1997, 2007, Oracle. All rights reserved.

      Used parameter files:
      */oracle2/10.2.0/network/admin/sqlnet.ora*


      Used TNSNAMES adapter to resolve the alias
      Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521))) (CONNECT_DATA = (UR = A) (SERVER = DEDICATED) (SERVICE_NAME = bill)))
      OK (0 msec)
      bash-3.2$ rman target /

      Recovery Manager: Release 10.2.0.4.0 - Production on Sun Nov 11 13:14:26 2012

      Copyright (c) 1982, 2007, Oracle. All rights reserved.

      connected to target database: BILL (DBID=1733626124)

      RMAN> backup current controlfile for standby;

      Starting backup at 11-NOV-12
      using target database control file instead of recovery catalog
      allocated channel: ORA_DISK_1
      channel ORA_DISK_1: sid=2703 devtype=DISK
      channel ORA_DISK_1: starting full datafile backupset
      channel ORA_DISK_1: specifying datafile(s) in backupset
      including standby control file in backupset
      channel ORA_DISK_1: starting piece 1 at 11-NOV-12
      channel ORA_DISK_1: finished piece 1 at 11-NOV-12
      piece handle=/backup/bill/ora_df799074913_s18254_s1 tag=TAG20121111T131513 comment=NONE
      channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
      Finished backup at 11-NOV-12

      RMAN> list backup of controlfile;


      List of Backup Sets
      *===================*

      BS Key Type LV Size Device Type Elapsed Time Completion Time
      ------- ---- -- ---------- ----------- ------------ ---------------
      *17383 Full 44.75M SBT_TAPE 00:00:04 15-DEC-11*

      BP Key: 44516 Status: AVAILABLE Compressed: NO Tag: TAG20111215T014102
      Handle: full_backup<bill_18121:769916462:1>.ctl Media: MSL_4048_drive1
      Control File Included: Ckp SCN: 224591537903 Ckp time: 15-DEC-11

      BS Key Type LV Size Device Type Elapsed Time Completion Time
      ------- ---- -- ---------- ----------- ------------ ---------------
      *17384 Full 44.75M SBT_TAPE 00:00:49 15-DEC-11*

      BP Key: 44517 Status: AVAILABLE Compressed: NO Tag: TAG20111215T014108
      Handle: c-1733626124-20111215-00 Media: MSL_4048_drive1
      Control File Included: Ckp SCN: 224591550862 Ckp time: 15-DEC-11

      BS Key Type LV Size Device Type Elapsed Time Completion Time
      ------- ---- -- ---------- ----------- ------------ ---------------
      *17387 Full 44.75M SBT_TAPE 00:00:04 15-DEC-11*

      BP Key: 44520 Status: AVAILABLE Compressed: NO Tag: TAG20111215T071237
      Handle: arch_backup<bill_18125:769936357:1>.ctl Media: MSL_4048_drive1
      Control File Included: Ckp SCN: 224624133160 Ckp time: 15-DEC-11

      BS Key Type LV Size Device Type Elapsed Time Completion Time
      ------- ---- -- ---------- ----------- ------------ ---------------
      *17388 Full 44.75M SBT_TAPE 00:00:49 15-DEC-11*

      BP Key: 44521 Status: AVAILABLE Compressed: NO Tag: TAG20111215T071242
      Handle: c-1733626124-20111215-01 Media: MSL_4048_drive1
      Control File Included: Ckp SCN: 224624137556 Ckp time: 15-DEC-11

      BS Key Type LV Size Device Type Elapsed Time Completion Time
      ------- ---- -- ---------- ----------- ------------ ---------------
      *17461 Full 45.00M SBT_TAPE 00:00:49 09-NOV-12*

      BP Key: 44594 Status: AVAILABLE Compressed: NO Tag: TAG20121109T184521
      Handle: c-1733626124-20121109-1a Media: c8a4e60a:4db50d68:1b98:0002
      Control File Included: Ckp SCN: 293195890346 Ckp time: 09-NOV-12

      BS Key Type LV Size Device Type Elapsed Time Completion Time
      ------- ---- -- ---------- ----------- ------------ ---------------
      *17499 Full 44.86M DISK 00:00:02 11-NOV-12*

      BP Key: 44633 Status: AVAILABLE Compressed: NO Tag: TAG20121111T131513
      Piece Name: /backup/bill/ora_df799074913_s18254_s1
      Standby Control File Included: Ckp SCN: 293442044150 Ckp time: 11-NOV-12

      RMAN> exit
      Recovery Manager complete.
      bash-3.2$ scp /backup/bill/ora_df799074913_s18254_s1 oracle@192.168.1.10:/backup/bill
      Password:

      ora_df799074913_s18254_s1 100% 45MB 22.4MB/s 00:02

      bash-3.2$ rman

      Recovery Manager: Release 10.2.0.4.0 - Production on Sun Nov 11 13:20:33 2012

      Copyright (c) 1982, 2007, Oracle. All rights reserved.

      RMAN> connect target /

      connected to target database: BILL (DBID=1234567892)

      RMAN> connect auxiliary sys/pass@stbill

      connected to auxiliary database: BILL (not mounted)

      *RMAN> run {allocate auxiliary channel 'ch1' type DISK;*
      *2> allocate auxiliary channel 'dev_1' type 'sbt_tape' parms 'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=bill)';*
      *3> allocate auxiliary channel 'dev_2' type 'sbt_tape' parms 'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=bill)';*
      *4> allocate auxiliary channel 'dev_3' type 'sbt_tape' parms 'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=bill)';*
      *5> set until scn =292650739066;*
      *6> duplicate target database for standby;*
      *7> release channel ch1;release channel dev_1;release channel dev_2;release channel dev_3;}*

      using target database control file instead of recovery catalog
      allocated channel: ch1
      channel ch1: sid=3285 devtype=DISK

      allocated channel: dev_1
      channel dev_1: sid=3287 devtype=SBT_TAPE
      channel dev_1: Data Protector A.06.11/PHSS_42698/PHSS_42699/DPSOL_00481/DPLNX_

      allocated channel: dev_2
      channel dev_2: sid=3286 devtype=SBT_TAPE
      channel dev_2: Data Protector A.06.11/PHSS_42698/PHSS_42699/DPSOL_00481/DPLNX_

      allocated channel: dev_3
      channel dev_3: sid=3289 devtype=SBT_TAPE
      channel dev_3: Data Protector A.06.11/PHSS_42698/PHSS_42699/DPSOL_00481/DPLNX_

      executing command: SET until clause

      Starting Duplicate Db at 11-NOV-12

      contents of Memory Script:
      *{*
      set until scn 292650739066;
      restore clone standby controlfile;
      sql clone 'alter database mount standby database';
      *}*
      executing Memory Script

      executing command: SET until clause

      Starting restore at 11-NOV-12

      released channel: ch1
      released channel: dev_1
      released channel: dev_2
      released channel: dev_3
      RMAN-00571: ===========================================================
      RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
      RMAN-00571: ===========================================================
      RMAN-03002: failure of Duplicate Db command at 11/11/2012 13:22:09
      RMAN-03015: error occurred in stored script Memory Script
      RMAN-06026: some targets not found - aborting restore
      RMAN-06024: no backup or copy of the control file found to restore

      RMAN>



      Thank you in advance for you valuable replies

      Regards,

      I. Gorbatovsky
        • 1. Re: Create standby after failover
          Shivananda Rao
          Hello,

          It just looked like you are on 10g, and you have taken the backup of the controlfile of the primary database (Type : STANDBY), but I do not see you taking the level 0 backup of the primary database to restore it to the standby server.

          Refer these on how to create the standby database on 10g

          http://docs.oracle.com/cd/B19306_01/server.102/b14239/create_ps.htm
          http://www.idevelopment.info/data/Oracle/DBA_tips/Data_Guard/DG_40.shtml
          • 2. Re: Create standby after failover
            IGorbatovsky
            Hello,
            Thank you for your reply.
            I took full backup and it can be seen when I rman> list backup; I just didn't include it in my commands' list.
            Actually this is not the first time I create physical standby and on this system it is the 3rd one, but last times we had our standby database been destroyed and I used well documented method creating it again. Now we have to create standby vice versa from primary database previously acted as standby. And it turned out it is not the same way as we used before. But I can't figure out the reason.
            • 3. Re: Create standby after failover
              Shivananda Rao
              Ok Good !!

              Can you try removing the "set until SCN" clause in your duplicate script ?
              • 4. Re: Create standby after failover
                Richard Harrison .
                Hi,
                Make sure you have the redo log that was currency when you created the standby control file also backed up with rman.

                So switch log file on primary then backup all your archive logs.

                Then retry the command.

                Cheers,
                Harry
                • 5. Re: Create standby after failover
                  IGorbatovsky
                  This SCN came from select distinct next_change# from v$archived_log where sequence# in (select max(sequence#) from v$archived_log); it lets me recover to the nearest present point.
                  If I omit this my standby db will be recovered only to the point of my full backup and it is 3 days old. Will I be able to come to the point I need if removing SCN will work? And how? Just putting needed archivelogs to the place where they are put for standby?
                  • 6. Re: Create standby after failover
                    IGorbatovsky
                    Hi Harry,
                    I have sql 'alter system archive log current'; in my full backup script. So, I think it does that what you mentioned.
                    • 7. Re: Create standby after failover
                      Richard Harrison .
                      Hi,
                      But is that archive log actually backed up by the script?

                      Harry
                      • 8. Re: Create standby after failover
                        CKPT
                        As per your log file, RMAN duplicate can able to restore database and even it can able to mount it.
                        Now instance is already mounted. Run below command and post output and of course you can remove "UNTIL SCN" because however you are restoring for standby database.

                        make sure instance is in "MOUNT"
                        RMAN> restore database preview;
                        • 9. Re: Create standby after failover
                          IGorbatovsky
                          Hello all,

                          I was able to duplicate target database for standby by removing "until scn" clause. As the script I get SCN from was made by another DBA and was in disaster recovery plan of course I trust it without any questions, but it turned out to be wrong. Now we have our standby up and running.

                          Thank you all for your valuable advices, they draw a picture that helped me in resolving this issue.

                          Regards,
                          I. Gorbatovsky