Recovery from Corrupted/deleted Undo datafile without backup, after last Clean Shutdown in NOARCHIVE/ARCHIVE mode.

Similar documents
12. User-managed and RMAN-based backups.

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

Database Recovery For Newbies

Recover Oracle Database upon losing all Control Files

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

Recreate Physical Standby Database after Recovery of Primary Database

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

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

RMAN BACKUP & RECOVERY. Recovery Manager. Veeratteshwaran Sridhar

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

Oracle TDE Tablespace Encryption

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

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

11. Configuring the Database Archiving Mode.

DOCUMENTATION ORACLE BACKUP & RESTORE OPERATIONS

Oracle 10g Feature: RMAN Incrementally Updated Backups

Oracle Backup and Recover 101. Osborne Press ISBN

PRM For Oracle Database 3.1 GUI:

Delivery Method: Instructor-led, group-paced, classroom-delivery learning model with structured, hands-on activities.

UNIVERSITY AUTHORISED EDUCATION PARTNER (WDP)

Producing Readable Output with SQL*Plus

Oracle 11g DBA Training Course Content

Oracle Database 12c: Admin, Install and Upgrade Accelerated

D12C-AIU Oracle Database 12c: Admin, Install and Upgrade Accelerated NEW

LOGGING OR NOLOGGING THAT IS THE QUESTION

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

DATA RECOVERY IN OODBMS USING FLASHBACK

Database Disaster Recovery using only RMAN Backups

Chapter 1. Writing Basic. SQL Statements

Oracle Database 10g: Administration Workshop II Release 2

Getting all the pieces: Reliable Backup/Recovery

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

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

What's the Point of Oracle Checkpoints? Harald van Breederode Oracle University 29-OCT-2009

Cross Platform Transportable Tablespaces Migration in Oracle 11g

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

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

Oracle Database 12c Recovery Manager New Features

Oracle Database: SQL and PL/SQL Fundamentals NEW

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

Subqueries Chapter 6

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

Database Access from a Programming Language: Database Access from a Programming Language

Database Access from a Programming Language:

Oracle Database Security and Audit

REDCENTRIC SOFTWARE ORACLE PLUG-IN FOR SOLARIS AGENT X86 VERSION

Oracle Database 11g: Administration I

Lesson 5 Administrative Users

SAP Note FAQ: SAP HANA Database Backup & Recovery

Oracle Database Cross Platform Migration Lucy Feng, DBAK

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

Oracle Architecture. Overview

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

Oracle Data Guard for High Availability and Disaster Recovery

SQL*Plus User s Guide and Reference

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

SQL Introduction Chapter 7, sections 1 & 4. Introduction to SQL. Introduction to SQL. Introduction to SQL

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

ORACLE DATABASE ADMINISTRATION PROGRAM LEARNING OUTCOMES

How To Recover From A Crash On An Orgsoorora Database

Setup Flashback Database on Data Guard Physical Standby Database for SAP Customers

Oracle Backup & Recovery

Oracle9i Data Guard: SQL Apply Best Practices. An Oracle White Paper September 2003

Oracle 11g Database Administration

Displaying Data from Multiple Tables

NEC Storage NV Series

Displaying Data from Multiple Tables. Chapter 4

HOW TO. RMAN Restore for Standby 10gR2

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

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

Maximum Availability Architecture. Oracle Best Practices for High Availability. Oracle Active Data Guard Oracle Data Guard 11g

Automatic Backup in Oracle Database

COURCE TITLE DURATION. Oracle Database 11g: Administration Workshop I

Oracle Data Guard Fast Start Failover understood!

Oracle Data Recovery Advisor

Analysis One Code Desc. Transaction Amount. Fiscal Period

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

Zero Downtime Backup solution for Oracle10g

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

TECHNICAL REPORT. Nimble Storage Oracle Backup and Recovery Guide

CA ARCserve Backup for Windows

CWMS System Backup / Oracle Backup and Recovery

SAP HANA Backup and Recovery (Overview, SPS08)

High Availability for Oracle 10g Using Double-Take

BrightStor ARCserve Backup

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

VMware Backup & Recovery

AT&T Global Network Client for Windows Product Support Matrix January 29, 2015

Database Design. Marta Jakubowska-Sobczak IT/ADC based on slides prepared by Paula Figueiredo, IT/DB

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

Oracle Database 11g: Administration Workshop I

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

Oracle Database Creation for Perceptive Process Design & Enterprise

Backup Server: User Manual. Version 2.1-p2

Oracle Database Security. Nathan Aaron ICTN 4040 Spring 2006

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

Many DBA s are being required to support multiple DBMS s on multiple platforms. Many IT shops today are running a combination of Oracle and DB2 which

How To Fix A Backup On An Oracle 9I Database On A Pc Oracle9I On A Microsoft Powerbook On A Macbook Oracle.Com On A Blackberry Oracle Powerbook 2 On A Linux Computer On A Z

1 Backup/Restore Oracle 8i/9i

Transcription:

Recovery from Corrupted/deleted Undo datafile without backup, after last Clean Shutdown in NOARCHIVE/ARCHIVE mode. After last clean shutdown, while restarting DB we see database not coming up and found datafile to corrupted/deleted. In this case steps remain same for Archive and NoArchive mode. Contents 1) Check DB is NOArchive mode and Clean Shutdown DB... 2 2) Corrupt the UNDO datafile Simulate the scenario... 2 3) Now Start the DB, and initiate recover database command as below.... 3 4) Try to Offline the corrupted undo Datafile and open Database.... 4 5) Change the undo_management to Manual parameters and Restart DB... 5 6) Drop undo tablespace.... 6 7) Create undo TBS, Reset undo_management to AUTO and restart the DB.... 6 8) Re-check if the Parameters were unset.... 7 9) Verify the user data and database.... 8 Page 1 of 8

1) Check DB is NOArchive mode and Clean Shutdown DB SQL> select,open_mode,log_mode from v$database; OPEN_MODE LOG_MODE --------- -------------------- ------------ D041 READ WRITE NOARCHIVELOG SQL> archive log list Database log mode No Archive Mode Automatic archival Disabled Archive destination C:\Oracle\oradata\d041\arch Oldest online log sequence 24 Current log sequence 26 SQL> shut immediate; Database closed. Database dismounted. ORACLE instance shut down. 2) Corrupt the UNDO datafile Simulate the scenario C:\Oracle\oradata\d041>dbv FILE=UNDOTBS01.DBF DBVERIFY: Release 11.2.0.1.0 - Production on Sun Dec 29 11:17:30 2013 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. DBVERIFY - Verification starting : FILE = C:\ORACLE\ORADATA\D041\UNDOTBS01.DBF DBVERIFY - Verification complete Total Pages Examined : 2560 Total Pages Processed (Data) : 0 Total Pages Failing (Data) : 0 Total Pages Processed (Index): 0 Total Pages Failing (Index): 0 Total Pages Processed (Other): 168 Total Pages Processed (Seg) : 20 Total Pages Failing (Seg) : 0 Total Pages Empty : 2392 Total Pages Marked Corrupt : 0 Total Pages Influx : 0 Total Pages Encrypted : 0 Highest block SCN : 1080034 (0.1080034) Now Corrupt Undo file ================================ Manually adding data to undo file to the end of file to simulate corruption. C:\Oracle\oradata\d041>echo A >> UNDOTBS01.DBF C:\Oracle\oradata\d041>dbv FILE=UNDOTBS01.DBF DBVERIFY: Release 11.2.0.1.0 - Production on Sun Dec 29 11:18:24 2013 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. DBV-00600: Fatal Error - [21] [5] [0] [0] OR If you Edit using the Edit plus, and delete some content from middle of file. C:\Oracle\oradata\d041>dbv FILE=UNDOTBS01.DBF DBVERIFY: Release 11.2.0.1.0 - Production on Sun Dec 29 10:35:22 2013 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. DBV-00102: File I/O error on FILE (C:\ORACLE\ORADATA\D041\UNDOTBS01.DBF) during end read operation (7680) Page 2 of 8

3) Now Start the DB, and initiate recover database command as below. SQL> startup ORACLE instance started. Total System Global Area 368263168 bytes Fixed Size 1374668 bytes Variable Size 209716788 bytes Database Buffers 150994944 bytes Redo Buffers 6176768 bytes Database mounted. ORA-01157: cannot identify/lock data file 3 - see DBWR trace file ORA-01110: data file 3: 'C:\ORACLE\ORADATA\D041\UNDOTBS01.DBF' SQL> select,open_mode,log_mode from v$database; OPEN_MODE LOG_MODE ---------- -------------------- ------------ D041 MOUNTED NOARCHIVELOG Whenever DB shuts cleanly, CHECKPOINT_CHANGE# and LAST_CHANGE# must always be sync else they need to do crash/media recovery, as below SQL> set line 200 col LAST_TIME for a25 col name for a45 select,status,checkpoint_change#,last_change#,to_char(last_time,'dd-mon-yyyy HH24:MI:SS') LAST_TIME from v$datafile; STATUS CHECKPOINT_CHANGE# LAST_CHANGE# LAST_TIME --------------------------------------------- ------- ------------------ ------------ --------------------- C:\ORACLE\ORADATA\D041\SYSTEM01.DBF SYSTEM 1080041 1080041 29-DEC-2013 10:58:30 C:\ORACLE\ORADATA\D041\SYSAUX01.DBF 1080041 1080041 29-DEC-2013 10:58:30 C:\ORACLE\ORADATA\D041\UNDOTBS01.DBF 1080041 1080041 29-DEC-2013 10:58:30 C:\ORACLE\ORADATA\D041\USERS01.DBF 1080041 1080041 29-DEC-2013 10:58:30 C:\ORACLE\ORADATA\D041\EXAMPLE01.DBF 1080041 1080041 29-DEC-2013 10:58:30 SQL> recover database; ORA-00283: recovery session canceled due to errors ORA-01110: data file 3: 'C:\ORACLE\ORADATA\D041\UNDOTBS01.DBF' ORA-01157: cannot identify/lock data file 3 - see DBWR trace file ORA-01110: data file 3: 'C:\ORACLE\ORADATA\D041\UNDOTBS01.DBF' SQL> set line 200 col error for a20 select * from v$recover_file; FILE# _ ERROR CHANGE# TIME --------- ------- ------- -------------------- ---------- --------- 3 FILE NOT FOUND 0 Page 3 of 8

4) Try to Offline the corrupted undo Datafile and open Database. SQL> alter database datafile 3 offline; (Use this for Archive Log Mode) alter database datafile 3 offline * ERROR at line 1: ORA-01145: offline immediate disallowed unless media recovery enabled http://docs.oracle.com/cd/b28359_01/server.111/b28310/dfiles004.htm#admin11429 SQL> alter database datafile 3 offline for drop; (Use this for NOArchive Log Mode) Database altered. SQL> alter database open; Database altered. SQL> select name,open_mode from v$database; OPEN_MODE --------------- -------------------- D041 READ WRITE SQL> select * from v$recover_file; FILE# _ ERROR CHANGE# TIME ---------- ------- ------- -------------------- ---------- --------- 3 OFFLINE OFFLINE FILE NOT FOUND 0 SQL> col name for a45 set line 200 select name,status from v$datafile; STATUS ------------------------------------------------------------ ------- C:\ORACLE\ORADATA\D041\SYSTEM01.DBF SYSTEM C:\ORACLE\ORADATA\D041\SYSAUX01.DBF C:\ORACLE\ORADATA\D041\UNDOTBS01.DBF OFFLINE C:\ORACLE\ORADATA\D041\USERS01.DBF C:\ORACLE\ORADATA\D041\EXAMPLE01.DBF SQL> drop tablespace undotbs1 including contents and datafiles; drop tablespace undotbs1 including contents and datafiles * ERROR at line 1: ORA-30013: undo tablespace 'UNDOTBS1' is currently in use On checking parameter undo_management found to be AUTO as below, so it is not all allowing to Drop. SQL> show parameter undo TYPE VALUE ------------------------------------ -------------------------------- ------------- undo_management string AUTO Page 4 of 8

undo_tablespace string UNDOTBS1 SQL> show parameter rollback_segments TYPE VALUE ------------------------------------ -------------------------------- ------------- rollback_segments string 5) Change the undo_management to Manual parameters and Restart DB SQL> alter system set undo_management='manual' scope=spfile; System altered. SQL> alter system set rollback_segments=system scope=spfile; System altered. SQL> shut immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> Startup ORACLE instance started. Total System Global Area 368263168 bytes Fixed Size 1374668 bytes Variable Size 209716788 bytes Database Buffers 150994944 bytes Redo Buffers 6176768 bytes Database mounted. Database opened. SQL> select * from v$recover_file; FILE# _ ERROR CHANGE# TIME ---------- ------- ------- --------------- ---------- --------- 3 OFFLINE OFFLINE FILE NOT FOUND 0 SQL> select name,status from v$datafile; STATUS --------------------------------------------- ------- C:\ORACLE\ORADATA\D041\SYSTEM01.DBF SYSTEM C:\ORACLE\ORADATA\D041\SYSAUX01.DBF C:\ORACLE\ORADATA\D041\UNDOTBS01.DBF OFFLINE C:\ORACLE\ORADATA\D041\USERS01.DBF C:\ORACLE\ORADATA\D041\EXAMPLE01.DBF SQL> SELECT SEGMENT_, XACTS ACTIVE_TX, V.STATUS FROM V$ROLLSTAT V, DBA_ROLLBACK_SEGS WHERE TABLESPACE_ = 'UNDOTBS1' AND SEGMENT_ID = USN; no rows selected Page 5 of 8

6) Drop undo tablespace. SQL> drop tablespace undotbs1 including contents and datafiles; Tablespace dropped. SQL> select * from v$rollname ; USN ---------- --------------------------------------------- 0 SYSTEM SQL> select SEGMENT_,SEGMENT_ID,status,tablespace_name from dba_rollback_segs ; SEGMENT_ SEGMENT_ID STATUS TABLESPACE_ ------------------------------ ---------- ---------------- ------------------------ SYSTEM 0 SYSTEM 7) Create undo TBS, Reset undo_management to AUTO and restart the DB. SQL> select * from v$tablespace; TS# INC BIG FLA ENC ---------- --------------------------------------------- --- --- --- --- 0 SYSTEM YES NO YES 1 SYSAUX YES NO YES 4 USERS YES NO YES 3 TEMP NO NO YES 6 EXAMPLE YES NO YES SQL> create undo tablespace UNDOTBS1 datafile 'C:\ORACLE\ORADATA\D041\UNDOTBS01.DBF' size 20M reuse; Tablespace created. SQL> Alter System set undo_management=auto scope=spfile; System altered. SQL> Alter System Reset rollback_segments; System altered. SQL> show parameter undo TYPE VALUE ------------------- ---------- ------------- undo_management string MANUAL undo_retention integer 900 undo_tablespace string UNDOTBS1 SQL> shut immediate; Database closed. Database dismounted. Page 6 of 8

ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 368263168 bytes Fixed Size 1374668 bytes Variable Size 209716788 bytes Database Buffers 150994944 bytes Redo Buffers 6176768 bytes Database mounted. Database opened. 8) Re-check if the Parameters were unset. SQL> show parameter rollback_segments TYPE VALUE ------------------------------------ -------------------------------- ------------ rollback_segments string SQL> show parameter undo TYPE VALUE ------------------------------------ -------------------------------- ------------ undo_management string AUTO undo_retention integer 900 undo_tablespace string UNDOTBS1 SQL> select SEGMENT_,SEGMENT_ID,status,tablespace_name from dba_rollback_segs ; SEGMENT_ SEGMENT_ID STATUS TABLESPACE_ ------------------------------ ---------- ---------------- ------------------------ SYSTEM 0 SYSTEM _SYSSMU20_2357329706$ 20 UNDOTBS1 _SYSSMU19_3758938093$ 19 UNDOTBS1 _SYSSMU18_3208537726$ 18 UNDOTBS1 _SYSSMU17_4050930344$ 17 UNDOTBS1 _SYSSMU16_4130629382$ 16 UNDOTBS1 _SYSSMU15_282708105$ 15 UNDOTBS1 _SYSSMU14_222891688$ 14 UNDOTBS1 _SYSSMU13_2419240782$ 13 UNDOTBS1 _SYSSMU12_1069090612$ 12 UNDOTBS1 _SYSSMU11_2414251578$ 11 UNDOTBS1 11 rows selected. SQL> SELECT SEGMENT_, XACTS ACTIVE_TX, V.STATUS FROM V$ROLLSTAT V, DBA_ROLLBACK_SEGS WHERE TABLESPACE_ = 'UNDOTBS1' AND SEGMENT_ID = USN; SEGMENT_ ACTIVE_TX STATUS ------------------------------ ---------- --------- _SYSSMU11_2414251578$ 0 _SYSSMU12_1069090612$ 0 _SYSSMU13_2419240782$ 0 _SYSSMU14_222891688$ 0 _SYSSMU15_282708105$ 0 Page 7 of 8

_SYSSMU16_4130629382$ _SYSSMU17_4050930344$ _SYSSMU18_3208537726$ _SYSSMU19_3758938093$ _SYSSMU20_2357329706$ 0 0 0 0 0 10 rows selected. 9) Verify the user data and database. SQL> conn scott/tiger Connected. SQL> set line 200 select * from emp; EMPNO E JOB MGR HIREDATE SAL COMM DEPTNO ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- 7369 SMITH CLERK 7902 17-DEC-80 800 20 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30 7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30 7566 JONES MANAGER 7839 02-APR-81 2975 20 7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30 7698 BLAKE MANAGER 7839 01-MAY-81 2850 30 7782 CLARK MANAGER 7839 09-JUN-81 2450 10 7788 SCOTT ANALYST 7566 19-APR-87 3000 20 7839 KING PRESIDENT 17-NOV-81 5000 10 7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30 7876 ADAMS CLERK 7788 23-MAY-87 1100 20 7900 JAMES CLERK 7698 03-DEC-81 950 30 7902 FORD ANALYST 7566 03-DEC-81 3000 20 7934 MILLER CLERK 7782 23-JAN-82 1300 10 14 rows selected. SQL> col name for a45 select name,status from v$datafile; STATUS --------------------------------------------- ------- C:\ORACLE\ORADATA\D041\SYSTEM01.DBF SYSTEM C:\ORACLE\ORADATA\D041\SYSAUX01.DBF C:\ORACLE\ORADATA\D041\UNDOTBS01.DBF C:\ORACLE\ORADATA\D041\USERS01.DBF C:\ORACLE\ORADATA\D041\EXAMPLE01.DBF SQL> select * from v$recover_file; no rows selected Page 8 of 8