Forum Discussion

jsilvestriOIT's avatar
11 years ago

Backing up Oracle databases configured using Data Guard

Ok, so I'm not huge into Netbackup (NBU), or Oracle, but our backup group has been dragged into issue, and I have been recruited to help solve it.

 

We are running NetBackup 7.6.0.1.  Its going mostly well.  We are doing file level backups successfully, and oracle backups successfully using our RMAN catalog and such.

 

However, we have recently been tasked to back up an Oracle database that has been configured with data guard.  This means this:

 

  • There are two databases, with two different SIDs
  • The databases are identical, configured as such that if one database fails, the other database covers as a failover database
  • One database is the Primary database, and one is set as the Standby database

We have NetBackup set up to backup both databases.  When the backups run, the Primary database succeeds with no issues.  The secondary database fails with

(5407) Database is in the wrong state (must be OPEN) for the requested action

So, here are the difficulties:

 

  1. Netbackup requires an instance name when setting up a oracle instance for backup - which should be equal to the SID.  We could just rely on our TNSNAMES.ora file to connect to the proper instance, but since NBU requires the SID when setting up the instance, and the primary and standby databases have different SIDs we cannot rely on the TNSNAME alone
  2. We don't manage the databases set up in the data guard configuration, so there is no way to tell if a failover event occurs until we get a failed backup on the main backup, which is not ideal

 

There should be a way to have one policy in NetBackup that covers this Oracle DB setup.  We should be able to back up whatever database is currently the "Primary" without worrying about ORACLE_SIDs.

 

Let me know if I need to provide more info for this issue to be discussed.

  • The ideal would be to have a virtual hostname and IP address associated with the online Instance.

    This way you would only have one hostname with one policy configured.

    The alternative would be to use crontab on each client to start the script.

    The script would then first check if the database is up, and only then start the backup.

  • Think that you either have to do offline backup of the passive/standby database or just run backup of the active database with possible different scripts on the two nodes. 

    In principle backup of the primary database should be enough as the passive database is a copy of the primary

    how does the DBA have configured the failover ? This determine what you have of options regarding backup

    Regards

    Michael

  • Michael,

    First, the failover is handled through TNSNAMES.  For example, this is the TNSNAMES entry for the failover set of databases:

    BKUP =
      (DESCRIPTION =
        (FAILOVER = ON)
        (LOAD_BALANCE = OFF)
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.100)(PORT = 1621)) #Primary
          (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.101)(PORT = 1621)) #Standby
        )
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = BKUP)
        )
      )
     

    So, when connecting to the database using the TNS Name, Oracle will first try the first IP, which points to the primary database, then it will try the secondary database in the second ip.

    I think this is how NBU handles the oracle backup is as follows:

    using the credentials given to NBU, Netbackup will log into the Host as the OS username and password given when setting up the Oracle Instance in Netbackup Management -> Applications -> Oracle -> All Instances

    it will then send the RMAN script generated from the dbtemplate to the client

    then it will run RMAN on the client in order to send the backup BACK to our catalog and our tape drives set up in netbackup.

    So I imagine the error occurs when we try to run the rman script from the one database that is in standby mode.

    There has to be a way for netbackup to handle this arrangement - Data Guard is not an obscure feature of Oracle databases.

    In the case that the primary DB fails, the whole idea of the failover database is that services will continue without interruption.  Shouldn't netbackup have a way to recognize the failover standby database without having to fail backing it up every night just in case of a failover?

  • Colleagues,

    Good post, I encontered similar issue with using NBU for backing up standby Oracle DB, however main problem concerns restoring not backup.

    My configuration is active-passive. Passive node is synchronized with primary DB by archive logs, I mean active DB sends archive logs to standby DB.

    Backup is always made of active node, so I do not have the same problem like described at the beginning of this post. When I change the role of my two DBs, still active node is backed up in result of this I have some backup images coming from host A and some from host B for the same logical DB. When I want to restore NBU sees these images like two different DBs, not the same, probably due to fact that images are identified by two different hosts.

    Using TDP provided by TSM this problem does not exist, so do you have any idea how to solve this in Netbqckup?

     

    Regards

  • The ideal would be to have a virtual hostname and IP address associated with the online Instance.

    This way you would only have one hostname with one policy configured.

    The alternative would be to use crontab on each client to start the script.

    The script would then first check if the database is up, and only then start the backup.

  • Thanks Marianne,

     

    I did also find that text you linked to in the Netbackup for Oracle Administrator's Guide: Unix, Windows, and Linux for version 7.6.0.1 on pages 203-205.

     

    We'll do our best to implement these solutions.  I think the virtual hostname mapped to the correct IP address would be our best shot - unfortunately at the moment we are still building the backup network and do not have DNS active for that network.

  • Marianne,

     

    Yes, now I consider sth based on a virtual name to have all backup images represented by the same name.

    In fact backup is not a problem, because backup is triggered automatically by script only on active node, but the real problem I have during restoring because images are identified by two different hosts names, so it is treated as two different environment

    rgrds