Backup and recovery in RAC Environment

Source: Internet
Author: User
This section briefly introduces the backup and recovery operations for storing archived logs to the Cluster File System in the rac environment. The cluster file system uses the oracle ocfs2;

This section briefly introduces the backup and recovery operations for storing archived logs to the Cluster File System in the rac environment. The cluster file system uses the oracle ocfs2;

This section describes how to back up and completely restore data in the rac environment. rac backup and recovery are compared with those in a single instance database, but they are only somewhat extended in processing archived logs. Generally, archive logs can be stored in the ASM disk group, or in the cluster file system, NFS, or local file system. When the archive logs are stored in the ASM, when the cluster file system or NFS is used, the rac backup and recovery operations are basically the same as those under a single instance. The following scenario archive logs are stored on ASM!

1. View rac archive settings

[Oracle @ rac1 ~] $ Sqlplus/nolog
SQL * Plus: Release 10.2.0.5.0-Production on Mon Dec 12 20:09:56 2011
Copyright (c) 1982,201 0, Oracle. All Rights Reserved.

SQL> conn/as sysdba
Connected.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination + FRA
Oldest online log sequence 38
Next log sequence to archive 39
Current log sequence 39
SQL> alter system switch logfile;
System altered.

Ii. View archiving logs in the ASM disk group

[Oracle @ rac1 ~] $ Export ORACLE_SID = + ASM1
[Oracle @ rac1 ~] $ Asmcmd
ASMCMD> cd FRA
ASMCMD> ls
RACDB/
ASMCMD> cd racdb
ASMCMD> ls
ARCHIVELOG/
BACKUPSET/
CONTROLFILE/
ONLINELOG/
ASMCMD> ls archivelog
20151112_12/
ASMCMD> ls archivelog/20151112_12/
Thread_eclipseq_39.261.769724057
Thread_2_seq_15.265.769695387

Iii. Use rman to back up the database

[Oracle @ rac1 ~] $ Rman target/
Recovery Manager: Release 10.2.0.5.0-Production on Mon Dec 12 20:17:53 2011
Copyright (c) 1982,200 7, Oracle. All rights reserved.
Connected to target database: RACDB (DBID = 766822397)
RMAN> delete noprompt backupset;
RMAN> delete noprompt archivelog all;

RMAN> run {
2> allocate channel c1 device type disk;
3> allocate channel c2 device type disk;
4> backup incremental level 0
5> tag 'racdb _ bak_20121212'
6> format '/home/oracle/backup/racdb % U'
7> database plus archivelog
8> delete all input;
9> release channel c1;
10> release channel c2;
11>}

RMAN> list backup of database summary;

List of Backups
====================
Key ty lv s Device Type Completion Time # Pieces # Copies Compressed Tag
---------------------------------------------------------------------
7 B 0 A DISK 2011-12-12 20:34:22 1 1 NO RACDB_BAK_20121212
8 B 0 A DISK 2011-12-12 20:34:22 1 1 NO RACDB_BAK_20121212

4. create basic data

[Oracle @ rac1 ~] $ Sqlplus/nolog
SQL * Plus: Release 10.2.0.5.0-Production on Mon Dec 12 20:57:01 2011
Copyright (c) 1982,201 0, Oracle. All Rights Reserved.
SQL> conn/as sysdba
Connected.

SQL> create user test identified by hr account unlock
2 default tablespace users;
User created.

SQL> grant connect, resource to test;
Grant succeeded.

SQL> create table t1 (a number );
Table created.

SQL> insert into t1 values (1 );
1 row created.

SQL> commit;
Commit complete.

SQL> conn/as sysdba
Connected.
SQL> select file_name from dba_data_files where tablespace_name = 'users ';

FILE_NAME
----------------------------------------
+ DATA/racdb/datafile/users.259.769205541

5. delete users tablespace data files

[Oracle @ rac2 ~] $ Export ORACLE_SID = + ASM2
[Oracle @ rac2 ~] $ Asmcmd rm-rf + DATA/RACDB/datafile/USERS.259.769205541
ORA-15032: not all alterations saved med
ORA-15028: ASM file '+ DATA/RACDB/datafile/USERS.259.769205541' not dropped; currently being accessed (dbd error: OCIStmtExecute)
The above error is said to be an oracle bug. Unfortunately, in version 10.2.0.5, this problem cannot be solved. You can only stop the rac instance and delete the data file.

[Oracle @ rac2 ~] $ Srvctl stop database-d racdb
[Oracle @ rac2 ~] $ Srvctl status database-d racdb
Instance racdb1 is not running on node rac1
Instance racdb2 is not running on node rac2
[Oracle @ rac2 ~] $ Asmcmd rm-rf + DATA/RACDB/datafile/USERS.259.769205541

Vi. Recovery
The subsequent database Startup operation will fail. The log clearly tells us that the data file no. 4 does not exist.

[Oracle @ rac2 ~] $ Srvctl start database-d racdb
PRKP-1001: Error starting instance racdb1 on node rac1
CRS-0215: cocould not start resource 'ora. racdb. racdb1.inst '.
PRKP-1001: Error starting instance racdb2 on node rac2
CRS-0215: cocould not start resource 'ora. racdb. racdb2.inst '.

[Oracle @ rac1 ~] $ Tail-f/u01/app/oracle/admin/racdb/bdump/alert_racdb1.log
Errors in file/u01/app/oracle/admin/racdb/bdump/racdb1_dbw0_18977.trc:
ORA-01157: cannot identify/lock data file 4-see DBWR trace file
ORA-01110: data file 4: '+ DATA/racdb/datafile/users.259.769205541'
ORA-17503: ksfdopn: 2 Failed to open file + DATA/racdb/datafile/users.259.769205541
ORA-15012: ASM file '+ DATA/racdb/datafile/users.259.769205541' does not exist
ORA-1157 signalled during: alter database open...
Mon Dec 12 21:31:41 CST 2011

Shutting down instance (abort)
License high water mark = 1
Instance terminated by USER, pid = 19192

Start the database to the mount state and restore it using rman.
[Oracle @ rac2 ~] $ Srvctl start database-d racdb-o mount

[Oracle @ rac1 ~] $ Rman target/
Recovery Manager: Release 10.2.0.5.0-Production on Mon Dec 12 21:33:17 2011
Copyright (c) 1982,200 7, Oracle. All rights reserved.
Connected to target database: RACDB (DBID = 766822397, not open)

RMAN> restore datafile 4;
Starting restore at 2011-12-12 21:34:08
Using target database control file instead of recovery catalog
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: sid = 145 instance = racdb1 devtype = DISK

Channel ORA_DISK_1: starting datafile backupset restore
Channel ORA_DISK_1: specifying datafile (s) to restore from backup set
Restoring datafile 00004 to + DATA/racdb/datafile/users.259.769205541
Channel ORA_DISK_1: reading from backup piece/home/oracle/backup/racdb07mu24a1_1_1
Channel ORA_DISK_1: restored backup piece 1
Piece handle =/home/oracle/backup/racdb07mu24a1_1_1 tag = RACDB_BAK_20121212
Channel ORA_DISK_1: restore complete, elapsed time: 00:00:04
Finished restore at 2011-12-12 21:34:14

RMAN> recover datafile 4;
Starting recover at 2011-12-12 21:34:41
Using channel ORA_DISK_1

Starting media recovery

Archive log thread 1 sequence 42 is already on disk as file + FRA/racdb/archivelog/20151112_12/thread_eclipseq_42.265.769213867
Archive log thread 2 sequence 18 is already on disk as file + FRA/racdb/archivelog/20151112_12/thread_2_seq_18.261.769725271
Channel ORA_DISK_1: starting archive log restore to default destination
Channel ORA_DISK_1: restoring archive log
Archive log thread = 1 sequence = 41
Channel ORA_DISK_1: reading from backup piece/home/oracle/backup/racdb0bmu24qo_1_1
Channel ORA_DISK_1: restored backup piece 1
Piece handle =/home/oracle/backup/racdb0bmu24qo_1_1 tag = RACDB_BAK_20121212
Channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
Archive log filename = + FRA/racdb/archivelog/20151112_12/thread_eclipseq_41.266.769728883 thread = 1 sequence = 41
Channel ORA_DISK_1: starting archive log restore to default destination
Channel ORA_DISK_1: restoring archive log
Archive log thread = 2 sequence = 17
Channel ORA_DISK_1: reading from backup piece/home/oracle/backup/racdb0cmu24qo_1_1
Channel ORA_DISK_1: restored backup piece 1
Piece handle =/home/oracle/backup/racdb0cmu24qo_1_1 tag = RACDB_BAK_20121212
Channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Archive log filename = + FRA/racdb/archivelog/20151112_12/thread_2_seq_17.262.769728885 thread = 2 sequence = 17
Media recovery complete, elapsed time: 00:00:01
Finished recover at 2011-12-12 21:34:46

7. Verification

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.