Database Disaster Recovery using only RMAN Backups



Similar documents
If you have not multiplexed your online redo logs, then you are only left with incomplete recovery. Your steps are as follows:

Oracle 12c Recovering a lost /corrupted table from RMAN Backup after user error or application issue

Oracle 11gR2 : Recover dropped tablespace using RMAN tablespace point in time recovery

Using RMAN to restore a database to another server in an ASM environment

Oracle 10g Feature: RMAN Incrementally Updated Backups

Backup/Restore Oracle 8i/9i/10g

RMAN What is Rman Why use Rman Understanding The Rman Architecture Taking Backup in Non archive Backup Mode Taking Backup in archive Mode

! " # #$ " " %" & "'( " "' ( ) " * ""! ). " / ( * ( "# 0! " ). '

DOCUMENTATION ORACLE BACKUP & RESTORE OPERATIONS

BrightStor ARCserve Backup

RMAN BACKUP & RECOVERY. Recovery Manager. Veeratteshwaran Sridhar

Oracle Database 10g: Backup and Recovery

Database Recovery For Newbies

HOW TO. RMAN Restore for Standby 10gR2

Strategies for Oracle Database Backup and Recovery: Case Studies. Mingguang Xu

Best Practices White Paper Using Oracle Database 10g Automatic Storage Management with FUJITSU Storage

Use RMAN to relocate a 10TB RAC database with minimum downtime. Tao Zuo tao_zuo@npd.com NPD Inc. 9/2011

This appendix describes the following procedures: Cisco ANA Registry Backup and Restore Oracle Database Backup and Restore

12. User-managed and RMAN-based backups.

Agenda. Overview Configuring the database for basic Backup and Recovery Backing up your database Restore and Recovery Operations Managing your backups

Recover Oracle Database upon losing all Control Files

Clonación de una Base de Datos Oracle 11gR2 Activa usando RMAN. CLONACIÓN DE UNA BASE DE DATOS ORACLE 11gR2 ACTIVA USANDO RMAN

Recreate Physical Standby Database after Recovery of Primary Database

Oracle Backup, Recovery, and Performance Tuning using EMC Avamar and Oracle RMAN

11. Oracle Recovery Manager Overview and Configuration.

Restore and Recovery Tasks. Copyright 2009, Oracle. All rights reserved.

Backing Up Oracle Databases with Handy Backup

Configuring Backup Settings. Copyright 2009, Oracle. All rights reserved.

Oracle Data Guard for High Availability and Disaster Recovery

PRM For Oracle Database 3.1 GUI:

Restoring To A Different Location With EBU And RMAN An AppsDBA Consulting White Paper

Using Recovery Manager with Oracle Data Guard in Oracle Database 10g. An Oracle White Paper April 2009

Oracle Recovery Manager 10g. An Oracle White Paper November 2003

Best Practices White Paper Using Oracle Database 11g R2 Automatic Storage Management with FUJITSU Storage (Windows version)

HP LeftHand SAN Solutions

ORACLE CORE DBA ONLINE TRAINING

Oracle Backup and Recover 101. Osborne Press ISBN

11. Configuring the Database Archiving Mode.

Getting all the pieces: Reliable Backup/Recovery

Oracle Database B

MapGuide Open Source Repository Management Back up, restore, and recover your resource repository.

CA ARCserve Backup for Linux

Using Recovery Manager with Oracle Data Guard in Oracle9i. An Oracle White Paper January 2007

Oracle 11g DBA Training Course Content

Performing Database and File System Backups and Restores Using Oracle Secure Backup

An Oracle White Paper March Backup and Recovery Strategies for the Oracle Database Appliance

ASM and for 3rd Party Snapshot Solutions - for Offhost. Duane Smith Nitin Vengurlekar RACPACK

1 Backup/Restore Oracle 8i/9i

An Oracle White Paper April Protecting Oracle Database Appliance Tape Backup with EMC NetWorker

TECHNICAL REPORT. Nimble Storage Oracle Backup and Recovery Guide

Support Document: Microsoft SQL Server - LiveVault 7.6X

Oracle Recovery Manager

Oracle Data Recovery Advisor

The safer, easier way to help you pass any IT exams. Exam : 1Z Upgrade Oracle9i/10g/11g OCA to Oracle Database 12c OCP.

Oracle Backup and Recovery Best Practices Dell Compellent Storage Center. Dell Compellent Technical Best Practices

Oracle Database B

Demos - Workshop. -- Configure the RMAN

CA ARCserve Backup for Windows

Oracle9i Database: Advanced Backup and Recovery Using RMAN

How To Restore An Org Server With Anor Backup For Windows (Oracle)

Maximum Availability Architecture. Oracle Best Practices For High Availability

Simplifying Online Backup Operations for Microsoft Exchange, SQL and Oracle with Hitachi Protection Manager Software

REDCENTRIC SOFTWARE ORACLE PLUG-IN FOR SOLARIS AGENT X86 VERSION

D78850GC10. Oracle Database 12c Backup and Recovery Workshop. Summary. Introduction. Prerequisites

Oracle Database Cross Platform Migration Lucy Feng, DBAK

Oracle Database 10g: Backup and Recovery 1-2

An Oracle White Paper June Protecting Oracle Database Appliance Tape Backup with Oracle Secure Backup

Oracle Database. Backup and Recovery Basics 10g Release 1 (10.1) Part No. B

SAP with Oracle Real Application Clusters 11g Release 2 and Oracle Automatic Storage Management 11g Release 2

NEC Storage NV Series

How To Backup An Org Database On An Org Server On A Pc Oracle Server On Anorora (Orora) With A Backup And Restore Option On A Windows (Ororora).Org (Orroboron

EMC NetWorker Module for Oracle Release 5.0

Backup Types. Backup and Recovery. Categories of Failures. Issues. Logical. Cold. Hot. Physical With. Statement failure

WHITE PAPER. Oracle RMAN Design Best Practices with Data Domain. Storage. Deduplication

An Oracle White Paper January Oracle Database Backup Service A Technical White Paper

High Availability for Oracle 8 Using Double-Take

Zen Internet. Online Data Backup. Zen Vault Professional Plug-ins. Issue:

RMAN Recipes for Oracle Database 11g : A Problem-Solution Approach by Darl Kuhn, Sam Alapati and Arup Nanda Apress. (c) Copying Prohibited.

Oracle Data Guard. Caleb Small Puget Sound Oracle Users Group Education Is Our Passion

Using Physical Replication and Oracle Database Standard Edition for Disaster Recovery. A Dbvisit White Paper

DATABOKS Offsite Backup Server v4.4. User s Guide

Oracle. Brief Course Content This course can be done in modular form as per the detail below. ORA-1 Oracle Database 10g: SQL 4 Weeks 4000/-

High Performance Oracle RAC Clusters A study of SSD SAN storage A Datapipe White Paper

How to protect, restore and recover SQL 2005 and SQL 2008 Databases

Rob Zoeteweij Zoeteweij Consulting

SAP HANA Backup and Recovery (Overview, SPS08)

Feature. Database Backup and Recovery Best Practices

Using HP StoreOnce Backup systems for Oracle database backups

CA ARCserve Backup for Windows

CA ARCserve Backup for Windows

SQL-BackTrack the Smart DBA s Power Tool for Backup and Recovery

Oracle Database 11g: Administration Workshop I Release 2

RMAN in the Trenches: To Go Forward, We Must Backup

MAX_RMAN_08137_IGNORE=5 DISK_RETENTION_POLICY='RECOVERY WINDOW OF 7 DAYS'

Oracle Database 11g: Administration Workshop I Release 2

Oracle Database 12c Recovery Manager New Features

Transcription:

12 th Apr, 2010 PURPOSE This paper demonstrates how an Oracle Database can be recovered or reconstructed by using only the RMAN Backup files (from Disks) in case of a complete server crash. CASE STUDY Every DBA has to ensure that his hours spent in planning and testing the Backup-Recovery Strategy is reliable. Especially that, it should be relied upon when any unexpected scenarios occur. We DBAs, always tend to be at ease when our scheduled backup jobs are performing well and are error-free; followed by couple of satisfactory recovery simulation/testing scenarios. Nevertheless, there are always scenarios which may be left unanticipated during the Backup-Recovery Testing. One such scenario was haunting me since couple of days. What we are going to see here is the must-have Recovery Test Case that every DBA, who has implemented RMAN Backups, needs to test before relying on his/her Backup-Recovery Strategy. Let's take an example to elaborate the case and demonstrate how to go about with its resolution. Let s say, I have a full RMAN Backup including archivelog backups maintained on Disks. Let's assume that all the backup files are in recoverable conditions and the RMAN Backups include the following files: 1. RMAN Full Backup files 2. RMAN Archivelog files 3. Controlfile and SPFILE autobackup And then, let s say one fine morning the Production Database Server goes completely offline, due to a major crash and the server requires a complete rebuild. The only way to recover the server is to rebuild the entire server, or to have us recover the complete Environment and the Database (from the RMAN Backups) on to another Server. Here, I will demonstrate how we can recover or reconstruct the Oracle Database by using only the RMAN Backups that are made available on Disks. 1

Before we take our case to the RMAN Backups, 2 pre-conditions need to be fulfilled: 1. A Server (the same server or a new one) should be made available in a state where Oracle Product can be installed; i.e., it should be brought online with a functional Operating System and necessary Environment Configurations, same as how it was before the crash. 2. Same version of Oracle Product (including any patch sets) needs to be installed with which the RMAN Backup was taken. This is critical for the recovery to be successful. For the demonstration, the Operating System used Microsoft Windows 2003 and the Oracle Database Product used 10g R2 (10.2.0.4) Standard Edition. The following steps would outline the procedures for recovering the Database using only RMAN Backup: 1. Create the Oracle Service 2. Create the relevant folder hierarchy under <ORACLE_BASE> directory 3. Restore the SPFILE from autobackup, and use the SPFILE to start the instance in NOMOUNT state 4. Restore the controlfile from autobackup, and MOUNT the database 5. Restore the Database from RMAN backup files 6. Recover the Database from RMAN backup files, and OPEN the database with RESETLOGS 2

GETTING STARTED 1. Create the Oracle Service We need to create an Oracle Service using 'oradim' utility, without passing any PFILE information C:\>oradim -new -sid DBTEST -intpwd DBTEST Instance created. NOTE: 10g onwards, we can directly specify the SPFILE for oracle service creation; thanks to the newly introduced SPFILE option in oradim utility. 2. Create the relevant folder hierarchy under <ORACLE_BASE> directory Now, we need to create the relevant directories for Oracle Database, as follows: a. Create BDUMP, CDUMP, and UDUMP directories under '<ORACLE_ BASE>\admin' directory, b. Create <DATABASE_NAME> directory under '<ORACLE_BASE>\oradata' directory; in our case DBTEST. 3. Restore the SPFILE from autobackup, and use the SPFILE to start the instance in NOMOUNT state Here, we need to connect to the Recovery Manager using the rman utility, and then start the Recovery process. First we need to set the Database ID (DBID) of the Database. At times, we may or may not know the DBID of the Database. There are 2 ways to find the DBID: a. If RMAN Backup text logs are maintained, the DBID can be found when the initial connection is made to the target, or b. If autobackup is enabled and has the autobackup format set (let s say the format is '%F'), then the filename of the autobackup has the DBID in it. In our case, 'c-1106578690-20100408-00' is the name of the autobackup file; so the DBID should be '1106578690'. 3

Next, we need to set the autobackup location, which will help us identify the location of all the RMAN files. In our case, the RMAN autobackup and backup files are located at '\\testdb\dbtest\'. C:\>set oracle_sid=dbtest C:\>rman target / Recovery Manager: Release 10.2.0.1.0 - Production on Thu Apr 8 11:40:10 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database (not started) RMAN> set dbid=1106578690; executing command: SET DBID RMAN> startup force nomount; startup failed: ORA-01078: failure in processing system parameters LRM-00109: could not open parameter file 'C:\ORACLE\PRODUCT\10.2.0\DB_2\DATABASE\INITDBTEST.ORA' starting Oracle instance without parameter file for retrival of spfile Oracle instance started Total System Global Area Fixed Size Variable Size Database Buffers Redo Buffers 159383552 bytes 1247828 bytes 58721708 bytes 92274688 bytes 7139328 bytes RMAN> SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '\\testdb\dbtest\%f'; executing command: SET CONTROLFILE AUTOBACKUP FORMAT using target database control file instead of recovery catalog NOTE: It is a good practice to generate the text logs whenever your RMAN backup runs and have the command show all run before the backup and list backup after the backup completes. This ensures that we have information on the complete set of RMAN configurations and a list of all the backups with their details in the text log. Next, we need to restore the SPFILE from the autobackup file and then use it to restart the instance in NOMOUNT state. You can approach this in two ways, as demonstrated below: a. Restoring the SPFILE from the autobackup to a non-default location: We can restore the SPFILE to a non-default location by using any one of the below 2 methods: 4 RMAN> restore spfile to 'C:\spdbtest01.ora' from autobackup;

OR, allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=36 devtype=disk channel ORA_DISK_1: looking for autobackup on day: 20100408 channel ORA_DISK_1: autobackup found: \\testdb\dbtest\c-1106578690-20100408- 00 channel ORA_DISK_1: SPFILE restore from autobackup complete RMAN> restore spfile to 'C:\spdbtest02.ora' from "\\testdb\dbtest\c- 1106578690-20100408-00"; channel ORA_DISK_1: autobackup found: \\testdb\dbtest\c-1106578690-20100408- 00 channel ORA_DISK_1: SPFILE restore from autobackup complete Now, we need to restart the instance in NOMOUNT state using the restored parameter file. RMAN> shutdown immediate Oracle instance shut down Remember that we have just restored the SPFILE in a non-default location and hence we would require referring a PFILE that should be referencing the SPFILE, so as to start the instance. For this, we need to create a text file, 'init<sid>.ora', and then mention the path and name of the restored SPFILE in it. In our case, the initdbtest.ora would contain only the following statement: SPFILE=C:\spdbtest01.ora Next, we need to start the instance in NOMOUNT state using the newly created PFILE (referencing the SPFILE). RMAN> startup force pfile= C:\initDBTEST.ora nomount Oracle instance started Total System Global Area Fixed Size Variable Size Database Buffers Redo Buffers 377487360 bytes 1249080 bytes 113246408 bytes 255852544 bytes 7139328 bytes 5

b. Restoring the SPFILE from the autobackup to the default location: We can restore the SPFILE to the default location ( <ORACLE_HOME>/database in Windows) by using any one of the below 2 methods: OR, RMAN> restore spfile from autobackup; channel ORA_DISK_1: looking for autobackup on day: 20100408 channel ORA_DISK_1: autobackup found: \\testdb\dbtest\c-1106578690-20100408- 00 channel ORA_DISK_1: SPFILE restore from autobackup complete RMAN> restore spfile from "\\testdb\dbtest\c-1106578690-20100408-00"; channel ORA_DISK_1: autobackup found: \\testdb\dbtest\c-1106578690-20100408- 00 channel ORA_DISK_1: SPFILE restore from autobackup complete The SPFILE has been restored in the DATABASE directory of the default home location. Oracle will now automatically look for an SPFILE in this location when you try to start the instance RMAN> shutdown immediate Oracle instance shut down Start the instance in NOMOUNT state. Here, we do not need to reference any PFILE or SPFILE, which makes the task a lot simpler. RMAN> startup force nomount; Oracle instance started Total System Global Area Fixed Size Variable Size Database Buffers Redo Buffers 377487360 bytes 1249080 bytes 113246408 bytes 255852544 bytes 7139328 bytes 6

4. Restore the controlfile from autobackup, and MOUNT the database Once the database is restarted in NOMOUNT state, we need to restore the controlfiles so as to restore and recover the database using the RMAN Backups. Again here, we can restore the controlfiles by using any one of the below 2 methods: RMAN> restore controlfile from autobackup; allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=156 devtype=disk recovery area destination: C:\oracle\flash_recovery_area database name (or database unique name) used for search: DBTEST channel ORA_DISK_1: no autobackups found in the recovery area channel ORA_DISK_1: looking for autobackup on day: 20100408 channel ORA_DISK_1: autobackup found: \\testdb\dbtest\c-1106578690-20100408-00 channel ORA_DISK_1: control file restore from autobackup complete output filename=c:\oracle\oradata\dbtest\control01.ctl output filename=c:\oracle\oradata\dbtest\control02.ctl output filename=c:\oracle\oradata\dbtest\control03.ctl OR, RMAN> restore controlfile from "\\testdb\dbtest\c-1106578690-20100408-00"; channel ORA_DISK_1: restoring control file channel ORA_DISK_1: restore complete, elapsed time: 00:00:10 output filename=c:\oracle\oradata\dbtest\control01.ctl output filename=c:\oracle\oradata\dbtest\control02.ctl output filename=c:\oracle\oradata\dbtest\control03.ctl 5. Restore the Database from RMAN backup files With the restored controlfiles, we are now in a position to restore the Database. We need to mount the Instance first and then restore the database files from the backup. RMAN> alter database mount; database mounted RMAN> restore database; 7 Starting implicit crosscheck backup at 08-APR-10

allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=156 devtype=disk Crosschecked 4 objects Finished implicit crosscheck backup at 08-APR-10 Starting implicit crosscheck copy at 08-APR-10 Finished implicit crosscheck copy at 08-APR-10 searching for all files in the recovery area cataloging files... no files cataloged channel ORA_DISK_1: starting datafile backupset restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set restoring datafile 00001 to C:\ORACLE\ORADATA\DBTEST\SYSTEM01.DBF restoring datafile 00002 to C:\ORACLE\ORADATA\DBTEST\UNDOTBS01.DBF restoring datafile 00003 to C:\ORACLE\ORADATA\DBTEST\SYSAUX01.DBF restoring datafile 00004 to C:\ORACLE\ORADATA\DBTEST\USERS01.DBF restoring datafile 00005 to C:\ORACLE\ORADATA\DBTEST\TOOLS01.DBF restoring datafile 00006 to C:\ORACLE\ORADATA\DBTEST\ORT_TBSP01.DBF restoring datafile 00007 to C:\ORACLE\ORADATA\DBTEST\OR_TBSP01.DBF restoring datafile 00008 to C:\ORACLE\ORADATA\DBTEST\OR_TBSP02.DBF restoring datafile 00009 to C:\ORACLE\ORADATA\DBTEST\OR_TBSP03.DBF restoring datafile 00010 to C:\ORACLE\ORADATA\DBTEST\OR_TBSP04.DBF restoring datafile 00011 to C:\ORACLE\ORADATA\DBTEST\ORT_INDX01.DBF restoring datafile 00012 to C:\ORACLE\ORADATA\DBTEST\ORT_INDX02.DBF restoring datafile 00013 to C:\ORACLE\ORADATA\DBTEST\OR_INDX01.DBF restoring datafile 00014 to C:\ORACLE\ORADATA\DBTEST\OR_INDX02.DBF restoring datafile 00015 to C:\ORACLE\ORADATA\DBTEST\OR_INDX03.DBF restoring datafile 00016 to C:\ORACLE\ORADATA\DBTEST\OR_TEST01.DBF restoring datafile 00017 to C:\ORACLE\ORADATA\DBTEST\PY_TBSP01.DBF restoring datafile 00018 to C:\ORACLE\ORADATA\DBTEST\IT_INDX01.DBF restoring datafile 00019 to C:\ORACLE\ORADATA\DBTEST\IT_TBSP01.DBF restoring datafile 00020 to C:\ORACLE\ORADATA\DBTEST\PY_TBSP02.DBF restoring datafile 00021 to C:\ORACLE\ORADATA\DBTEST\PY_INDX01.DBF channel ORA_DISK_1: reading from backup piece \\TESTDB\DBTEST\DBTEST_04LAJPNP_1_1_20100408 channel ORA_DISK_1: restored backup piece 1 piece handle=\\testdb\dbtest\dbtest_04lajpnp_1_1_20100408 tag=tag20100408t110945 channel ORA_DISK_1: restore complete, elapsed time: 00:31:38 8

6. Recover the Database from RMAN backup files, and OPEN the database with RESETLOGS Once restoration of the database is complete, we need to recover the database by applying the archivelogs from the backup. RMAN> recover database; Starting recover at 08-APR-10 starting media recovery channel ORA_DISK_1: starting archive log restore to default destination channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=32 channel ORA_DISK_1: reading from backup piece \\TESTDB\DBTEST\DBTEST_05LAJR4F_1_1_20100408 channel ORA_DISK_1: restored backup piece 1 piece handle=\\testdb\dbtest\dbtest_05lajr4f_1_1_20100408 tag=tag20100408t113335 channel ORA_DISK_1: restore complete, elapsed time: 00:00:04 archive log filename=c:\oracle\flash_recovery_area\dbtest\archivelog\2010_04_08\o1_mf_1_32_ 5VVJG77X_.ARC thread=1 sequence=32 channel default: deleting archive log(s) archive log filename=c:\oracle\flash_recovery_area\dbtest\archivelog\2010_04_08\o1_mf_1_32_ 5VVJG77X_.ARC recid=33 stamp=715790711 unable to find archive log archive log thread=1 sequence=33 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of recover command at 04/08/2010 14:45:21 RMAN-06054: media recovery requesting unknown log: thread 1 seq 33 lowscn 27801294 Don't panic when you see the above Error Message. You just need to open the database with RESETLOGS option, as there are no more archivelogs to apply. RMAN> alter database open resetlogs; database opened The Database Disaster Recovery using RMAN is now complete. NOTE: If it s a Production Database Recovery, take a Full Backup before you make the database available for the end users. 9