`

RMAN: RAC Backup and Recovery using RMAN [ID 243760.1] Metalink

阅读更多

"Checked for relevance on 21-Dec-2008"

 

RAC Backup and Recovery using RMAN

 

Objectives:

===========

 

1. Verify the database mode and archive destination.

2. Verify connectivity using sqlnet for target and catalog.

3. Determine your backup device

4. Understand how to create an RMAN persistent configuration for a RAC env.

5. Create backups to disk using

6. Backupset Maintenance using the configured retention policy

7. Restore and Recover

    a. complete

    b. incomplete

8. Review and understand the impact of resetlogs on the catalog.

9. RMAN Sample Commands

 

 

 

Configuration:

==============

 

This discussion is for a 2-node Oracle RAC Cluster.

The logs are being archived to their respective node.

We are allocating channels to each node to enable the autolocate feature

of RMAN in a RAC env.

 

 

1. Verify the databases are in archivelog mode and archive destination.

 

 a. NODE 1: thread 1

 

SQL> archive log list;

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            /u02/app/oracle/product/9.2.0/dbs/arch

Oldest online log sequence     20

Next log sequence to archive   21

Current log sequence           21

 

 b. NODE 2: thread 2

 

SQL> archive log list

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            /u02/app/oracle/product/9.2.0/dbs/arch

Oldest online log sequence     8

Next log sequence to archive   9

Current log sequence           9

 

 

2. Verify connectivity to the target nodes and catalog if used.

 

 a. % setenv TNS_ADMIN $ORACLE_HOME/network/admin

 b. % sqlplus /nolog

 c. SQL> connect sys/pwd@node1 as sysdba

 d. SQL> connect sys/pwd@node2 as sysdba

 e. SQL> connect rman/rman@rcat

 

3. Set your testing areas.

 

Testing HOME for logs:  /u02/home/usupport/rman

 

Backups HOME Location:  /rman/V920

 

 

4. Connect using RMAN to verify and set the controlfile persistent configuration.

   The controlfiles are shared between the instances so configuring the control-

   file on node 1 also sets it for all nodes in the RAC cluster.

 

 a. Alway note the target DBID

     connected to target database: V920 (DBID=228033884)

 

 b. Default Configuration

 

RMAN configuration parameters are:

CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

CONFIGURE BACKUP OPTIMIZATION OFF; # default

CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default

CONFIGURE CONTROLFILE AUTOBACKUP ON;

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default

CONFIGURE DEVICE TYPE DISK PARALLELISM 1; # default

CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE MAXSETSIZE TO UNLIMITED; # default

CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u02/app/oracle/product/9.2.0/dbs/snapcf_V9201.f'; # default

 

 

 c. Make changes to the default that fit your business requirements.

    Note the retention policy can be set "TO REDUNDANCY x" or it can

    be set "TO RECOVERY WINDOW OF x DAYS", this is new in Oracle9i.

 

    In this example, using PARALLELISM 2 as 2 nodes are used.

    The PARALLELISM will than automaticly start 2 channels and will

    use the related CONFIGURE CHANNEL for additional clauses.

 

CONFIGURE RETENTION POLICY TO REDUNDANCY 3;

CONFIGURE BACKUP OPTIMIZATION OFF;

CONFIGURE DEFAULT DEVICE TYPE TO DISK;

CONFIGURE CONTROLFILE AUTOBACKUP ON;

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/rman/V920/%F';

CONFIGURE DEVICE TYPE DISK PARALLELISM 2;

CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1;

CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;

CONFIGURE MAXSETSIZE TO UNLIMITED;

CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/rman/V920/snapcf_V92321.f';

CONFIGURE CHANNEL 1 DEVICE TYPE DISK connect 'SYS/rac@node1';

CONFIGURE CHANNEL 2 DEVICE TYPE DISK connect 'SYS/rac@node2';

 

 

 d. Review/Verify your new configuration.

 

RMAN configuration parameters are:

CONFIGURE RETENTION POLICY TO REDUNDANCY 3;

CONFIGURE BACKUP OPTIMIZATION OFF;

CONFIGURE DEFAULT DEVICE TYPE TO DISK;

CONFIGURE CONTROLFILE AUTOBACKUP ON;

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/rman/V920/%F';

CONFIGURE DEVICE TYPE DISK PARALLELISM 2;

CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1;

CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;

CONFIGURE CHANNEL 1 DEVICE TYPE DISK CONNECT  'SYS/rac@node1';

CONFIGURE CHANNEL 2 DEVICE TYPE DISK CONNECT  'SYS/rac@node2';

CONFIGURE MAXSETSIZE TO UNLIMITED;

CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/rman/V920/snapcf_V92321.f';

 

 

5. Make a backup using the new persistent configuration parameters.

 

 a. Backup database with differential incremental 0 and then archived logs

    using the delete input option.

 

 

 backup incremental level 0

 format '/rman/V920/%d_LVL0_%T_%u_s%s_p%p'

 database;

 backup archivelog all format '/rman/V920/%d_AL_%T_%u_s%s_p%p'

 delete input;

 

 

 b. Backup again using differential inremental level 1

 

 

 backup incremental level 1

 format '/rman/V920/%d_LVL1_%T_%u_s%s_p%p'

 database;

 backup archivelog all format '/rman/V920/%d_AL_%T_%u_s%s_p%p'

 delete input;

 

 

 c. To simplify this in Oracle9i we can also use PLUS ARCHIVELOG

    Note: This uses a different alorithm then backup database and

    backup archivelog in separate commands.

 

 BACKUP incremental level 0

 format '/rman/V920/%d_LVL0_%T_%u_s%s_p%p'

 database PLUS ARCHIVELOG format '/rman/V920/%d_AL_%T_%u_s%s_p%p'

 delete input;

 

  Algorithm for PLUS ARCHIVELOG:

 

    1. Archive log current

    2. Backup archived logs

    3. Backup database level 0

    4. Archive log current

    5. Backup any remaining archived log created during backup

 

 

6. Backupset Maintenance using the configured retention policy

 

    RMAN> list backup summary;

          list backup by datafile;

          list backup of database;

          list backup of archivelog all;

          list backup of controlfile;

 

 Note: these above can be enhanced with the "until time" clause as well as

       the archivelog backups using "not backed up x times" to cut down on

       many copies of a log in several backupsets. Then continuing with SMR

       Server Managed Recovery use the change archivelog from...until...delete

       to remove old logs no longer needed on disk.

 

    RMAN> report obsolete;

 

    RMAN> delete obsolete;

          or

          delete noprompt obsolete;

 

    RMAN> report schema;

 

 

7. Restore and Recover

 

Complete Recovery

 

 a. With the database mounted on the node1 and nomount on node2 connect

    to the target and catalog using RMAN.

 

      rman target / catalog rman/rman@rcat

 

    This script will restore and recover the database completely and open.

    All previous backup will still be available for use because there was

    not RESETLOGS command given.

 

 run {

     restore database;

     recover database;

     alter database open;

     }

 

Incomplete Recovery

 

Note: If you are using instance registration the database must be mounted to

      register with the listener. This means you must use the current control

      file for restore and recovery or setup a dedicated listener if not

      already done. RMAN requires a dedicated server connection and does not

      work with using instance registration before mounting the controlfile.

      Using the autobackup controlfile feature requires the DBID of the

      TARGET database. It must be set when the database is not mounted and

      only the controlfile and spfile (in 9.2>) can be restored this way.

 

 

 a. shutdown node1 and node2

 

 b. startup nomount node2 and node1

 

 c. start rman

 

     > rman trace reco1.log

 

     RMAN> connect catalog rman/rman@rcat

 

     RMAN> set dbid=228033884;

 

     RMAN> connect target

 

 d. Restore the controlfile from autobackup

 

     % rman trace recocf.log

 

     RMAN> SET DBID=228033884;

 

     RMAN> CONNECT TARGET

 

 RUN

    {

     SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE disk TO '/rman/V920/%F';

      ALLOCATE CHANNEL d1 DEVICE TYPE disk;

       RESTORE CONTROLFILE FROM AUTOBACKUP

         MAXSEQ 5           # start at sequence 5 and count down (optional)

         MAXDAYS 5;         # start at UNTIL TIME and search back 5 days (optional)

     MOUNT DATABASE;

    }

 

 

 e. Verify what is available for incomplete recovery. We will recover to the

    highest scn log sequence and thread. We will use the log sequence in this

    case. Your options are "until time", "until scn", or "until sequence".

 

 

    SQL> select max(sequence#) from v$archived_log

      2  where thread#=1;

 

 MAX(SEQUENCE#)

 --------------

             25

 

    SQL> select max(sequence#) from v$archived_log

      2  where thread#=2;

 

 MAX(SEQUENCE#)

 --------------

             13

 

Note: In this case the scn is greater in thread 2 sequence# 13 then in

      sequence 25 from thread 1. So we will set the seqeunce to 14 for

      rman recovery because log recovery is always sequence+1 to end

      at +1 after applying the prior sequence.

 

 SQL> select sequence#, thread#, first_change#, next_change#

   2  from v$archived_log

   3  where sequence# in (13,25);

 

  SEQUENCE#    THREAD# FIRST_CHANGE# NEXT_CHANGE#

 ---------- ---------- ------------- ------------

         25          1       1744432      1744802

         13          2       1744429      1744805

 

 SQL> select sequence#, thread#, first_change#, next_change#

   2  from v$backup_redolog

   3  where sequence# in (13,25);

 

  SEQUENCE#    THREAD# FIRST_CHANGE# NEXT_CHANGE#

 ---------- ---------- ------------- ------------

         25          1       1744432      1744802

         13          2       1744429      1744805

 

 f. If using LMT Temporary tablespace the controlfile will have the syntax

    to add the tempfile after recovery is complete.

 

    SQL> alter database backup controlfile to trace;

 

 Example:

 # Commands to add tempfiles to temporary tablespaces.

 # Online tempfiles have complete s

分享到:
评论

相关推荐

    MetaLink-RMAN RAC Backup and Recovery using RMAN

    MetaLink-RMAN RAC Backup and Recovery using RMAN 希望对ORACLE使用者有点作用

    Oracle RMAN 11g Backup and Recovery

    1 Oracle Database 11g Backup and Recovery Architecture Tour . . . . . . . . . . . . . . 3 2 Introduction to the RMAN Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 ...

    Oracle RMAN 11g Backup and Recovery 英文版

    Oracle RMAN 11g Backup And Recovery (中文名:Oracle RMAN 11g 备份和恢复) 英文原版图书,Oracle官方出版,学习Oracle Rman备份和恢复的最佳学习资料,与大家一起分享。

    Oracle 12c Rman Backup and Recovery

    #### 一、RMAN(Recovery Manager)概述 在Oracle 12c版本中,RMAN是用于管理数据库备份和恢复的强大工具。它不仅可以帮助管理员执行数据库备份,还能进行灾难恢复操作,确保数据的安全性和完整性。RMAN能够自动...

    Oracle Database Backup and Recovery User's Guide.pdf

    #### 二、RMAN(Recovery Manager)备份与恢复 - **RMAN简介**:RMAN是Oracle提供的一种强大的备份与恢复工具,主要用于自动化数据库备份和恢复过程。 - **RMAN功能**: - **数据库备份**:可以备份整个数据库或...

    Oracle Database Backup and Recovery Basic 10.2.pdf

    该文档重点介绍了如何使用Recovery Manager (RMAN)进行常见的备份和恢复任务。 #### 版权声明 本书版权所有归Oracle公司所有,并受到版权法和其他知识产权法律保护。在未获得许可的情况下,不得进行逆向工程、拆解...

    McGraw.Oracle.RMAN.11g.Backup.and.Recovery.2010

    RMAN(Recovery Manager)是Oracle数据库自带的一个强大工具,专用于数据库的备份、恢复和维护。在Oracle 11g版本中,RMAN的功能得到了进一步增强,提供了更高效、更安全的数据保护方案。 RMAN的基本概念包括:备份...

    RAC+RMAN单实例的恢复

    本篇文章将详细介绍如何在RAC(Real Application Clusters)环境下通过RMAN(Recovery Manager)进行单实例数据库的恢复过程。恢复的目标是在一个单实例环境中实现,具体包括操作系统、数据库版本、IP地址、磁盘类型...

    Oracle单机通过rman迁移到RAC集群.docx

    在本案例中,需要将原有的Oracle单机数据库通过RMAN(Recovery Manager)迁移到一个新的RAC集群中。具体需求如下: 1. **构建RAC集群**:搭建一套包含多个节点的RAC集群。 2. **数据迁移**:利用RMAN进行异机恢复,...

    Backup and Recovery Basics

    本文将基于Oracle官方文档《Oracle Database Backup and Recovery Basics 10g Release 1 (10.1)》的内容,详细介绍Oracle数据库备份与恢复的基础概念和技术。 #### 二、备份与恢复的重要性 备份是指将数据存储为...

    Oracle 11.2.0.3 单实例 迁移到 11gR2 RAC 案例-- 使用RMAN 异机恢复

    本案例重点讲述了如何利用RMAN(Recovery Manager)工具进行Oracle 11.2.0.3单实例到11gR2 RAC的异机恢复操作。这一过程涉及多个关键步骤,包括数据备份、目标环境准备、恢复和配置调整。 首先,RMAN是Oracle数据库...

    rman.zip_oracle_rman

    Oracle RMAN(Recovery Manager)是Oracle数据库管理系统中一个强大的备份和恢复工具,它提供了全面的数据保护方案。在Oracle环境中,RMAN能够执行各种备份操作,包括冷备份和热备份,以确保数据的安全性和可恢复性...

    Veeam Rman Plugin for Oracle安装和使用手册.docx

    RMAN(Recovery Manager)是Oracle数据库的备份和恢复工具,VEEAM Rman Plugin for Oracle是基于RMAN的备份插件。该插件可以将Oracle数据库备份到VEEAM存储库中,提供了一个可靠的数据保护解决方案。 系统兼容要求 ...

    RMAN备份脚本及自动批处理windows.doc

    rman catalog rmanuser1/rmanuser1@orada target system/system@oradb CMDFILE 'F:\backup\orabackup.rcv' LOG 'F:\backup\oracle_%date%' ``` - 这个批处理文件用于调用RMAN脚本执行备份,并记录日志。 3. **...

    Oracle单机通过rman迁移到RAC集群.zip

    在本过程中,Recovery Manager (RMAN) 是Oracle提供的强大备份和恢复工具,它在迁移过程中扮演了关键角色。下面将详细解释这个迁移过程中的主要步骤和知识点。 一、理解RMAN RMAN是Oracle数据库管理的重要组成部分...

    oracle_9i_rman_backup_restore.rar

    Oracle 9i RMAN( Recovery Manager)是Oracle数据库系统中用于数据备份和恢复的重要工具。在Oracle 9i版本中,RMAN引入了许多增强功能,旨在提供更高效、可靠的数据库保护策略。以下是对RMAN备份与恢复技术的详细...

    oracle_rman增量备份脚本

    file=/dinglp/ora_managed/backup/export/rman.dmp log=/dinglp/ora_managed/backup/log/rman.log ``` 2. **导出RMAN数据Shell脚本`exp_rman.sh`:** - 定义执行命令所需的环境变量。 ```bash #!/bin/bash ...

    计算机等考三级数据库基础:rac环境下更改归档模式.docx

    在RAC环境中,归档日志通常通过网络文件系统(NFS)共享或使用RMAN (Recovery Manager)在每个节点上分别备份,以便在需要时合并和恢复。这种策略保证了在多节点环境中归档日志的一致性和可用性。 总之,更改RAC环境...

Global site tag (gtag.js) - Google Analytics