How-to backup Oracle RAC 11gR2 Database with RMAN

RAC and single instance RMAN backup is similar, but…

Backup of a 11gR2 RAC database is similar to that of a single instance 11gR2 database. There is an important difference though… assuming that you – like me – schedule a non-RAC backup by cron on the database node, using local RMAN scripting. If the node you scheduled the backup on, is down, your backup simply cannot run!

So it’s obviously wrong to use the same processing method on a RAC cluster node that at the start of the backup might be offline, purposely or not. To make sure my RMAN backup will still be running when all but one node is offline, I use DBMS_SCHEDULER in combination with RMAN scripting, placed in a directory that’s shared by all nodes.

Don’t change your RMAN backup script, but…

Not in scope now is the RMAN scripting itself… as long as you don’t use explicit connections or parallelism, and do use the FRA on ASM for all your recovery files, your code can remain the same, with one notable exception…. As of 11gR2 RAC, Oracle wants your snapshot controlfile to be on a shared location [ID 1472171.1]… I use the FRA on ASM, but an ACFS mounted directory will also do.

If you are familiar with 11gR2 Grid Infrastructure and RAC, creating a shared ACFS mounted directory should pose no problems. Just use ASMCA to create an ACFS volume on one of your ASM disk groups, and then the shared file system on some pre-created OS directory…. I use /shared.

Use DBMS_SCHEDULER for scheduling…

11gR2 DBMS_SCHEDULER is RAC aware, and DBMS_JOB is not. That’s why you should use DBMS_SCHEDULER instead of DBMS_JOB to schedule the backup of a RAC database. Before defining the job:

The local time zone of all RAC nodes must be identical, and preferably the same as the DBMS_SCHEDULER default time zone… check the OS time zones and the default time zone of DBMS_SCHEDULER.

1) On all RAC nodes, check the local time zone ( /etc/localtime in OL 6.3 ), and set identical:

[root etc]# ln -s /usr/share/zoneinfo/Europe/Amsterdam localtime

2) Check date and time:

[root etc]# date

3) Configure the default timezone in DBMS_SCHEDULER with “sqlplus / as sysdba”:

DBMS_SCHEDULER is quite impressive, and delivers a lot of possible options for the definition of a job. I stick to the simple ones, and accept as many default values as possible.

1) Create the backup job with “sqlplus / as sysdba”, but do not enable or schedule it yet.

If you wonder over the second argument… this is the one parameter of my RMAN script, that controls the number of days the database-copy lags the original, and the selection of archivelogs to be deleted at the end of the backup.

Test the backup job…

Now, first of all, test the backup job. When you encounter problems, check if your code is using full file and directory names – mandatory with DBMS_SCHEDULER – , and if your script has the executable bit enabled.

Job starts on any one instance that’s up and running, but…

Take in mind that this backup configuration is “sticky”… meaning that DBMS_SCHEDULER always tries to start the backup on the node where the last backup was successfully executed. And although this configuration works well when the instance, used by RMAN, keeps online during the backup, a failover of RMAN backup sessions at sudden node or instance collapse to remaining up-and-running instances, is untested…. see the next 2 paragraphs.

Use a RAC service to limit the job’s RMAN database connections…

Not strictly necessary, but I use an extra RAC service ( CLUSTER_BACKUP ), running on all nodes, for RMAN to connect by. The standard “rman target /” in my standard backup script then changes to “rman target sys/*****@RAC_BACKUP_NETSERVICE”, where “RAC_BACKUP_NETSERVICE” is the TNSNAMES.ORA net service name, on top of host <LOCAL_NODE_NAME> and service_name CLUSTER_BACKUP. A TNSNAMES.ORA with the above settings is configured on each and every node.This is to make certain RMAN doesn’t spread its database connections over more than 1 instance, once the backup job has started.

RMAN backup should failover, but…

I’m not really sure if this is still necessary in 11gR2, and by adjusting the TNSNAMES.ORA entry – from host <LOCAL_NODE_NAME> to host <CLUSTER_SCAN_NAME> – you may in theory achieve some cluster failover capabilities. After all, why should RMAN connections be so very different from standard client connections, which all – if setup correctly! – use the <CLUSTER_SCAN_NAME> to connect..? Anyone who tested a failover with this kind of setting during backup and sudden instance shutdown?

meta

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 236 other subscribers

Email Address

About

AMIS is internationally recognized for its deep technological insight in Oracle technology. This knowledge is reflected in the presentations we deliver at international conferences such as Oracle OpenWorld, Hotsos and many user conferences around the world. Our AMIS Technology Blog, the most referred Oracle technology knowledge base outside the oracle.com domain. However you arrived here, we appreciate your interest in AMIS. Link to our Google+ Profile AMIS