Saturday, December 6, 2014

How to Backup and Restore a RAC Database

This article explains how to backup and recover a 2-node, 11gr2 or 12c RAC cluster on Linux. Backup and recovery operations for RAC databases are similar to single instance databases, however there are some differences.

  1. Setup FRA or recovery destination
  2. Enable archivelog mode
  3. Multiple backup channels configuration for RAC
  4. Backup your RAC database
  5. Stop your RAC database and remove users01.dbf file
  6. Restore and recover your RAC database

  1. Setup FRA or recovery destination.
-- Specify the size of the recovery destination
SQL> alter system set db_recovery_file_dest_size=50G SCOPE=BOTH SID='*';

-- Specify a shared recovery destination path (in this example, an ASM diskgroup)
SQL> alter system set db_recovery_file_dest = '+FRA_DG' SCOPE=BOTH SID='*';

  1. Enable archivelog mode:
-- Shut down the database first:
$ srvctl stop database –d BKISDB –o immediate

-- Mount the first instance from the SQL*Plus
SQL> startup mount;

--Switch to archivelog mode and start the database:
SQL> alter database archivelog;
SQL> alter database open;

-- Start the rest of the instances, use one of the following:
$ srvctl start database –d BKISDB
$ srvctl start instance –d BKISDB –I BKISDB2

-- Verify the database log mode
SQL> SELECT log_mode FROM v$database;
SQL> archive log list

  1. Multiple backup channels configuration for RAC:
-- Configure 2 parallel channels
RMAN> configure device type disk parallelism 2;

-- All RMAN backups followed after the configurations will automatically allocate two channels over instances 1 and 2, and the workload will be balanced across instances
RMAN> configure channel 1 device type disk connect 'sys/password@BKISDB_1';
RMAN> configure channel 2 device type disk connect 'sys/password@BKISDB_2';

  1. Backup your RAC database:
-- Backup database plus archive logs from either node
$ rman target /
RMAN> BACKUP  DATABASE PLUS ARCHIVELOG;

  1. Stop your RAC database and remove users01.dbf file:
-- Stop database
$ srvctl stop database -d BKISDB

-- Remove users01.dbf file:
ASMCMD> rm users01.dbf

-- Start database
$ srvctl start database -d BKISDB
PRCR-1079 : Failed to start resource ora.bkisdb.db
CRS-5017: The resource action "ora.bkisdb.db start" encountered the following error:
ORA-01157: cannot identify/lock data file 4 - see DBWR trace file
ORA-01110: data file 4: '+DATA/bkisdb/users01.dbf'
…….

  1. Restore and recover your RAC database:
-- Mount database
$ srvctl start database –d BKISDB -o mount

-- Restore database
$ rman target /
RMAN> restore database;

-- Recover database
RMAN> recover database;

-- Open database
RMAN> alter database open;

-- Restart your database
$ srvctl stop database –d BKISDB –o immediate
$ srvctl start database –d BKISDB

-- Check status
$ srvctl status db -d BKISDB
Instance BKISDB1 is running on node rac1
Instance BKISDB2 is running on node rac2


For more information see:

I hope this helps.

Please feel free to leave your questions or suggest improvements to this section.

No comments:

Post a Comment