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



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

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

RMAN BACKUP & RECOVERY. Recovery Manager. Veeratteshwaran Sridhar

HOW TO. RMAN Restore for Standby 10gR2

Database Disaster Recovery using only RMAN Backups

Oracle 10g Feature: RMAN Incrementally Updated Backups

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

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

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

12. User-managed and RMAN-based backups.

Recover Oracle Database upon losing all Control Files

DOCUMENTATION ORACLE BACKUP & RESTORE OPERATIONS

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

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

Oracle Database 10g: Backup and Recovery

Recreate Physical Standby Database after Recovery of Primary Database

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

Database Recovery For Newbies

Getting all the pieces: Reliable Backup/Recovery

Oracle Backup and Recover 101. Osborne Press ISBN

Oracle Database 12c Recovery Manager New Features

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

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

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

Oracle 11g DBA Training Course Content

BrightStor ARCserve Backup

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

Oracle Database Cross Platform Migration Lucy Feng, DBAK

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

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

PRM For Oracle Database 3.1 GUI:

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

11. Configuring the Database Archiving Mode.

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

TECHNICAL REPORT. Nimble Storage Oracle Backup and Recovery Guide

Oracle 11g Database Administration

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

11. Oracle Recovery Manager Overview and Configuration.

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

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

Cross Platform Transportable Tablespaces Migration in Oracle 11g

Demos - Workshop. -- Configure the RMAN

Objectif. Participant. Prérequis. Pédagogie. Oracle Database 11g - Administration Workshop II - LVC. 5 Jours [35 Heures]

Oracle Database 11g: Administration And Backup & Recover

Oracle Database 10g: Backup and Recovery 1-2

Oracle Database 11g: Administration Workshop II

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

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

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

Oracle Data Recovery Advisor

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

Oracle Recovery Manager

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

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

Oracle Database 11g: Administration Workshop II DBA Release 2

Configuring Backup Settings Configuring and Managing Persistent Settings for RMAN Configuring Autobackup of Control File Backup optimization

Oracle Database 11g: Administration Workshop II DBA Release 2

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

Maximize Availability With Oracle Database 12c

Oracle Database 11g: Administration Workshop II Release 2

Pass4Sure.1z0-034_120.Q&A

Oracle Database B

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

Oracle TDE Tablespace Encryption

Oracle Data Guard for High Availability and Disaster Recovery

Installation Companion Oracle Data Guard on Amazon EC2 Configuration Guide

Oracle Database 10g: Administration Workshop II Release 2

Oracle Database B

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

D12CBR Oracle Database 12c: Backup and Recovery Workshop NEW

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/-

Backup and Recovery. Oracle RMAN 11 g. Oracle Press ORACLG. Matthew Hart. Robert G. Freeman. Mc Graw Hill. Lisbon London Madrid Mexico City Milan

HP LeftHand SAN Solutions

Oracle9i Database: Advanced Backup and Recovery Using RMAN

ORACLE CORE DBA ONLINE TRAINING

CommVault Simpana 7.0 Software Suite. und ORACLE Momentaufnahme. Robert Romanski Channel SE

Oracle Database Security and Audit

OCP: Oracle Database 12c Administrator Certified Professional Study Guide. Exam 1Z0-063

Oracle Backup & Recovery

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

UNIVERSITY AUTHORISED EDUCATION PARTNER (WDP)

Backing Up Oracle Databases with Handy Backup

Cross-Platform Oracle Database Migration Using Transportable Tablespaces and EMC Open Replicator for Symmetrix

Oracle 11g DBA Online Course - Smart Mind Online Training, Hyderabad. Oracle 11g DBA Online Training Course Content

CA ARCserve Backup for Linux

DBMS Questions. 3.) For which two constraints are indexes created when the constraint is added?

Zero Downtime Backup solution for Oracle10g

How To Recover From A Crash On An Orgsoorora Database

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

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

Oracle Database 12c: Admin, Install and Upgrade Accelerated

<Insert Picture Here> RMAN Configuration and Performance Tuning Best Practices

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

EMC CLARiiON SnapView and MirrorView for Oracle Database 10g Automatic Storage Management

Oracle 9i Database Release 2 Enterprise Edition

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

EMC NetWorker Module for Oracle Release 5.0

Transcription:

Oracle 11gR2 : Recover dropped tablespace using RMAN tablespace point in time recovery Mohamed Azar Oracle DBA http://mohamedazar.wordpress.com 1 Mohamed Azar http://mohamedazar.wordpress.com

This is new feature for Oracle 11g R2.Here I'm go to demonstrate How to recover dropped Tablespace using RMAN Tablespace point in time recovery. Step 1: Create Tablespace SQL> conn / as sysdba SQL> create tablespace testtbs datafile 'd:\backup\testtbs01.dbf' size 100m; Tablespace created. SQL> create user testtbs identified by testtbs default tablespace testtbs; User created. SQL> grant connect,resource to testtbs; Grant succeeded. SQL> conn testtbs/testtbs; SQL> create table test(empname varchar2(20),city varchar2(20)); Table created. SQL> insert into test values('azar','riyadh'); 1 row created. SQL> insert into test values('jabar','chennai'); 1 row created. SQL> commit; Commit complete. SQL> conn testdb/testdb; (Note : This table allocated for other tablespace, i just insert data for this table for check data consistent after doing TBPITR) SQL> create table d(empname varchar2(20)); Table created. SQL> insert into d values('kareem'); 1 row created. SQL> insert into d values('syed'); 2 Mohamed Azar http://mohamedazar.wordpress.com

1 row created. SQL> commit; Commit complete. Step 2: Backup database Plus archivelog C:\Users\mazar>set oracle_sid=azardb C:\Users\mazar>rman target sys/admin123 Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jan 1 15:39:34 2011 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. connected to target database: AZARDB (DBID=1652383192) RMAN> backup database plus archivelog; Starting backup at 01-JAN-11 current log archived using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=30 device type=disk Step 3: Note Current SCN SQL> conn / as sysdba SQL> select current_scn from v$database; CURRENT_SCN ----------- 8448197 Step 4: Drop tablespace SQL> drop tablespace testtbs including contents and datafiles; Tablespace dropped. Step 5: I just added data for another table allocated for other tablespace due to just check for data consistent. SQL> conn testdb/testdb; SQL> insert into d values('azmi'); 1 row created. 3 Mohamed Azar http://mohamedazar.wordpress.com

SQL> commit; Commit complete. Step 6: Create auxiliary & Recover tablespace using tablespace point in time recovery. C:\Windows\system32>rman target sys/admin123 Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jan 1 14:45:08 2011 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. connected to target database: AZARDB (DBID=1652383192) RMAN> run 2> recover tablespace testtbs 3> until scn 8448197 4> auxiliary destination 'D:\backupnew'; 5> Starting recover at 01-JAN-11 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=31 device type=disk RMAN-05026: WARNING: presuming following set of tablespaces applies to specified point-in-time List of tablespaces expected to have UNDO segments Tablespace SYSTEM Tablespace UNDOTBS2 Creating automatic instance, with SID='Bopd' initialization parameters used for automatic instance: db_name=azardb db_unique_name=bopd_tspitr_azardb compatible=11.2.0.0.0 db_block_size=8192 db_files=200 sga_target=280m processes=50 db_create_file_dest=d:\backupnew log_archive_dest_1='location=d:\backupnew' #No auxiliary parameter file used starting up automatic instance AZARDB Oracle instance started Total System Global Area 292933632 bytes Fixed Size 1374164 bytes 4 Mohamed Azar http://mohamedazar.wordpress.com

Variable Size 100665388 bytes Database Buffers 184549376 bytes Redo Buffers 6344704 bytes Automatic instance created List of tablespaces that have been dropped from the target database: Tablespace testtbs # set requested point in time set until scn 8448197; # restore the controlfile restore clone controlfile; # mount the controlfile sql clone 'alter database mount clone database'; # archive current online log sql 'alter system archive log current'; # avoid unnecessary autobackups for structural changes during TSPITR sql 'begin dbms_backup_restore.autobackupflag(false); end;'; executing command: SET until clause Starting restore at 01-JAN-11 allocated channel: ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: SID=59 device type=disk channel ORA_AUX_DISK_1: starting datafile backup set restore channel ORA_AUX_DISK_1: restoring control file channel ORA_AUX_DISK_1: reading from backup piece C:\APP\ORACLE\MAZAR\FLASH_RECOVERY_AREA\AZARDB\AUTOBACKUP\2011_01_01\O1_MF_N_739286122_6KXZOWTT_.BKP channel ORA_AUX_DISK_1: piece handle=c:\app\oracle\mazar\flash_recovery_area\azardb\autobackup\2011_01_01\o1_mf_n_739286122_6kxzow TT_.BKP tag=tag20110101t13152 1 channel ORA_AUX_DISK_1: restored backup piece 1 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:00 output file name=d:\backupnew\azardb\controlfile\o1_mf_6ky50oh2_.ctl Finished restore at 01-JAN-11 sql statement: alter database mount clone database sql statement: alter system archive log current sql statement: begin dbms_backup_restore.autobackupflag(false); end; # set requested point in time set until scn 8448197; # set destinations for recovery set and auxiliary set datafiles 5 Mohamed Azar http://mohamedazar.wordpress.com

set newname for clone datafile 1 to new; set newname for clone datafile 8 to new; set newname for clone datafile 2 to new; set newname for clone tempfile 1 to new; set newname for datafile 3 to "D:\BACKUP\TESTTBS01.DBF"; # switch all tempfiles switch clone tempfile all; # restore the tablespaces in the recovery set and the auxiliary set restore clone datafile 1, 8, 2, 3; switch clone datafile all; executing command: SET until clause renamed tempfile 1 to D:\BACKUPNEW\AZARDB\DATAFILE\O1_MF_TEMP_%U_.TMP in control file Starting restore at 01-JAN-11 using channel ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: starting datafile backup set restore channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set channel ORA_AUX_DISK_1: restoring datafile 00001 to D:\BACKUPNEW\AZARDB\DATAFILE\O1_MF_SYSTEM_%U_.DBF channel ORA_AUX_DISK_1: restoring datafile 00008 to D:\BACKUPNEW\AZARDB\DATAFILE\O1_MF_UNDOTBS2_%U_.DBF channel ORA_AUX_DISK_1: restoring datafile 00002 to D:\BACKUPNEW\AZARDB\DATAFILE\O1_MF_SYSAUX_%U_.DBF channel ORA_AUX_DISK_1: restoring datafile 00003 to D:\BACKUP\TESTTBS01.DBF channel ORA_AUX_DISK_1: reading from backup piece C:\APP\ORACLE\MAZAR\FLASH_RECOVERY_AREA\AZARDB\BACKUPSET\2011_01_01\O1_MF_NNNDF_TAG20110101T131020_6 KXZDFVB_. BKP channel ORA_AUX_DISK_1: restored backup piece 1 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:03:06 Finished restore at 01-JAN-11 datafile 1 switched to datafile copy input datafile copy RECID=388 STAMP=739291881 file name=d:\backupnew\azardb\datafile\o1_mf_system_6ky53y6c_.dbf datafile 8 switched to datafile copy 6 Mohamed Azar http://mohamedazar.wordpress.com

input datafile copy RECID=389 STAMP=739291881 file name=d:\backupnew\azardb\datafile\o1_mf_undotbs2_6ky53yjt_.dbf datafile 2 switched to datafile copy input datafile copy RECID=390 STAMP=739291881 file name=d:\backupnew\azardb\datafile\o1_mf_sysaux_6ky53yg4_.dbf # set requested point in time set until scn 8448197; # online the datafiles restored or switched sql clone "alter database datafile 1 online"; sql clone "alter database datafile 8 online"; sql clone "alter database datafile 2 online"; sql clone "alter database datafile 3 online"; # recover and open resetlogs recover clone database tablespace "TESTTBS", "SYSTEM", "UNDOTBS2", "SYSAUX" delete archivelog; alter clone database open resetlogs; executing command: SET until clause sql statement: alter database datafile 1 online sql statement: alter database datafile 8 online sql statement: alter database datafile 2 online sql statement: alter database datafile 3 online Starting recover at 01-JAN-11 using channel ORA_AUX_DISK_1 starting media recovery archived log for thread 1 with sequence 17 is already on disk as file C:\APP\ORACLE\MAZAR\FLASH_RECOVERY_AREA\AZARDB\ARCHIVELOG\2011_01_01\O1_MF_1_17_6KY53B3J_.ARC channel ORA_AUX_DISK_1: starting archived log restore to default destination channel ORA_AUX_DISK_1: restoring archived log archived log thread=1 sequence=16 channel ORA_AUX_DISK_1: reading from backup piece C:\APP\ORACLE\MAZAR\FLASH_RECOVERY_AREA\AZARDB\BACKUPSET\2011_01_01\O1_MF_ANNNN_TAG20110101T131514_6 KXZOPGN_. BKP channel ORA_AUX_DISK_1: piece handle=c:\app\oracle\mazar\flash_recovery_area\azardb\backupset\2011_01_01\o1_mf_annnn_tag20110101t1 31514_6KXZOPGN_.BKP tag=tag20 110101T131514 channel ORA_AUX_DISK_1: restored backup piece 1 channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01 7 Mohamed Azar http://mohamedazar.wordpress.com

archived log file name=d:\backupnew\arc0000000016_0738861267.0001 thread=1 sequence=16 channel clone_default: deleting archived log(s) archived log file name=d:\backupnew\arc0000000016_0738861267.0001 RECID=777 STAMP=739291886 archived log file name=c:\app\oracle\mazar\flash_recovery_area\azardb\archivelog\2011_01_01\o1_mf_1_17_6ky53b3j_.arc thread=1 sequence=17 media recovery complete, elapsed time: 00:00:06 Finished recover at 01-JAN-11 database opened # make read only the tablespace that will be exported sql clone 'alter tablespace TESTTBS read only'; # create directory for datapump import sql "create or replace directory TSPITR_DIROBJ_DPDIR as '' D:\backupnew''"; # create directory for datapump export sql clone "create or replace directory TSPITR_DIROBJ_DPDIR as '' D:\backupnew''"; sql statement: alter tablespace TESTTBS read only sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''D:\backupnew'' sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''D:\backupnew'' Performing export of metadata... EXPDP> Starting "SYS"."TSPITR_EXP_Bopd": EXPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK EXPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE EXPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK EXPDP> Master table "SYS"."TSPITR_EXP_Bopd" successfully loaded/unloaded EXPDP> ****************************************************************************** EXPDP> Dump file set for SYS.TSPITR_EXP_Bopd is: EXPDP> D:\BACKUPNEW\TSPITR_BOPD_37645.DMP EXPDP> ****************************************************************************** EXPDP> Datafiles required for transportable tablespace TESTTBS: EXPDP> D:\BACKUP\TESTTBS01.DBF EXPDP> Job "SYS"."TSPITR_EXP_Bopd" successfully completed at 15:12:24 Export completed # shutdown clone before import shutdown clone immediate database closed 8 Mohamed Azar http://mohamedazar.wordpress.com

database dismounted Oracle instance shut down Performing import of metadata... IMPDP> Master table "SYS"."TSPITR_IMP_Bopd" successfully loaded/unloaded IMPDP> Starting "SYS"."TSPITR_IMP_Bopd": IMPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK IMPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE IMPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK IMPDP> Job "SYS"."TSPITR_IMP_Bopd" successfully completed at 15:16:47 Import completed # make read write and offline the imported tablespaces sql 'alter tablespace TESTTBS read write'; sql 'alter tablespace TESTTBS offline'; # enable autobackups after TSPITR is finished sql 'begin dbms_backup_restore.autobackupflag(true); end;'; sql statement: alter tablespace TESTTBS read write sql statement: alter tablespace TESTTBS offline sql statement: begin dbms_backup_restore.autobackupflag(true); end; Removing automatic instance Automatic instance removed auxiliary instance file D:\BACKUPNEW\AZARDB\DATAFILE\O1_MF_TEMP_6KY5C761_.TMP deleted auxiliary instance file D:\BACKUPNEW\AZARDB\ONLINELOG\O1_MF_4_6KY5BT82_.LOG deleted auxiliary instance file D:\BACKUPNEW\AZARDB\ONLINELOG\O1_MF_3_6KY5BQSZ_.LOG deleted auxiliary instance file D:\BACKUPNEW\AZARDB\ONLINELOG\O1_MF_2_6KY5BOYS_.LOG deleted auxiliary instance file D:\BACKUPNEW\AZARDB\ONLINELOG\O1_MF_1_6KY5BMV3_.LOG deleted auxiliary instance file D:\BACKUPNEW\AZARDB\DATAFILE\O1_MF_SYSAUX_6KY53YG4_.DBF deleted auxiliary instance file D:\BACKUPNEW\AZARDB\DATAFILE\O1_MF_UNDOTBS2_6KY53YJT_.DBF deleted auxiliary instance file D:\BACKUPNEW\AZARDB\DATAFILE\O1_MF_SYSTEM_6KY53Y6C_.DBF deleted auxiliary instance file D:\BACKUPNEW\AZARDB\CONTROLFILE\O1_MF_6KY50OH2_.CTL deleted Finished recover at 01-JAN-11 RMAN> Step 7: Check tablespace status SQL> select status,tablespace_name from dba_tablespaces where tablespace_name like 'TESTTBS%';; STATUS TABLESPACE_NAME --------- ------------------------------ OFFLINE TESTTBS 11 rows selected. 9 Mohamed Azar http://mohamedazar.wordpress.com

Alter tablespace online SQL> alter tablespace testtbs online; Tablespace altered. Step 8: Check table SQL> conn testtbs/testtbs; SQL> select * from tab; TNAME TABTYPE CLUSTERID ------------------------------ ------- ---------- TEST TABLE SQL> select * from test; EMPNAME CITY -------------------- -------------------- azar riyadh jabar chennai SQL> And also I'm go to check other table for data consistent. SQL> conn testdb/testdb; SQL> select * from d; EMPNAME -------------------- azmi kareem syed Now successfully recovered dropped tablespace using RMAN point in time recovery. 10 Mohamed Azar http://mohamedazar.wordpress.com