Ensuring Data Protection Using Oracle Flashback Features - Presentation

Post on 19-Jan-2017

441 views 3 download

Transcript of Ensuring Data Protection Using Oracle Flashback Features - Presentation

Session ID:

Prepared by:

Ensuring Data Protection Using Oracle Flashback Features

1118

@pini_dibask

Pini Dibask,Oracle Domain Expert, Dell Software Group, R&D

2

Pini Dibask, Oracle Domain Expert, Dell Software R&D

Senior Oracle DBA with 10 years of experience

Oracle Certified Professional DBA (OCP)

Blogger: OracleDBPro.BlogSpot.com

Email: Pini.Dibask@Software.Dell.com

LinkedIn: http://Linkedin.com/in/pinidibask

Google+: https://Plus.Google.com/+PiniDibask87

Twitter: @pini_dibask

About Me …

Agenda

4

Agenda

Introduction to Data Protection for Oracle Databases

Oracle Flashback from A to Z

Versions 9i 10g 11g 12c

FlashbackQuery

• Flashback Version Query• Flashback Transaction Query• Flashback Table• Flashback Drop• Flashback Database

• Flashback Transaction• Flashback Data Archive (FDA)

FDA Enhancements

Introduction to Data Protection for Oracle Databases

6

Introduction to Data Protection

Wide term - Refers to protection from various scenarios, such as:

Natural Disasters• Floods• Earthquakes• Fires

Block Corruptions• Physical

Corruptions• Logical

Corruptions

Human Errors• Undesired DDL

Operations• Undesired DML

modifications

7

Data Protection Objectives

Ensuring high level of SLA (Service Level Agreement)

Enforcing the organization’s Data Protection policy

RPO (Recovery Point Objective)

RTO (Recovery Time Objective)

RPO RTO

Disaster OccursRestore Point Up and Running

Maximum amount of data a business can allow itself to lose

Maximum amount of downtime a business can incur until the system is up and running again

16:3016:00

17:00

8

Oracle HA & DR Solutions

Server Failures

Storage Failures

Site Failures

Corrupted FilesMissing Files

Human Errors

RAC & RAC One NodeFailover Clusters

ASM Normal RedundancyASM High Redundancy

Oracle Golden GateOracle Data Guard

RMAN User Managed Backups

Flashback Features

The Beginning Oracle Flashback Query (Version 9i)

10

Introduction to Oracle Flashback Query

First Oracle flashback feature

Introduced in Oracle version 9i

Allows viewing table’s contents in the past

11

 

Oracle Flashback Query - Demo

Step 1: Setup the Demo

12

 

Oracle Flashback Query - Demo cont'd

Step 2: Determine current SCN & Time, modify data

13

 

Oracle Flashback Query - Demo cont'd

Step 3: Query table’s contents prior to undesired modification

14

 

Oracle Flashback Query - Demo cont'd

Step 4: Recovering at row level using Flashback Query

How does it work?

16

 

How does the Flashback Query feature work?

Uses undo tablespace contents

Undo tablespace - key component in Oracle Databases

UNDO_RETENTION parameter

Autoextend undo tablespace

Specifies minimum retention period Oracle will attempt to honor

Fixed-Size undo tablespace

Undo Retention is being ignored

17

Undo Extent Types

Active - Used by running transactions

Unexpired - Within the UNDO_RETENTION period

Expired - Older than the UNDO_RETENTION period

UNDO_RETENTION = 900 (15 Minutes)

17:0016:00 16:15 16:30 16:45

Expired Unexpired

(Current Time)

18

 

Design your environment to support Flashback Query

Prerequisites

UNDO_MANAGEMENT parameter must be set to TRUE

Best Practices

Have proper undo tablespace size

Have proper value for UNDO_RETENTION parameter

Oracle 10g Flashback Features

Flashback Version Query Flashback Transaction Query Flashback Table Flashback Drop Flashback Database

20

Flashback Version Query

Allows viewing historical versions of a specific row or set of rows

Uses VERSIONS BETWEEN clause

VERSIONS_OPERATION column:

‘U’ indicates an UPDATE command

‘D’ indicates a DELETE command

‘I’ indicates an INSERT command

Flashback Version Query cont'd

21

Specify either TIMESTAMP or SCN

SCN MINVALUE AND MAXVALUE clause

Uses all available undo information

22

Flashback Version Query – Demo cont'd

23

View transaction’s information including undo SQL statements

Flashback Transaction Query

Prerequisite - Enable Minimal Supplemental Logging

Recover a table or set of tables to an historical point in time

FLASHBACK TABLE <Table Name> TO SCN;

FLASHBACK TABLE <Table Name> TO TIMESTAMP;

Prerequisites

Have either FLASHBACK object privilege or FLASHBACK ANY TABLE

Enable Row Movement – ALTER TABLE … ENABLE ROW MOVEMENT

Flashback Table

25

Flashback Table - Demo

26

Flashback Table - Demo cont'd

27

Flashback Table - Limitations

You cannot recover the table prior to a table definition change

Flashback is not supported for user SYS

28

Flashback Drop

Oracle 10g - RECYCLEBIN parameter was introduced

RECYCLEBIN defaults to “ON”

Dropped objects’ information is stored in USER_RECYCLEBIN

USER_RECYCLEBIN has a public synonym named RECYCLEBIN

29

Flashback Drop cont'd

It is possible to query the dropped table directly

The restore operation is straightforward

30

Flashback Drop cont'd

The table is restored with its original name

Dependent objects are restored with system-generated names

The table can be restored with a different name

Objects restored in a LIFO (Last In First Out) order

11

31

Flashback Drop cont'd

Flashback Drop operation is not guaranteed

Table will not be available in the recycle bin if:

RECYCLEBIN = OFF

DROP TABLE command with PURGE clause

PURGE RECYCLEBIN or PURGE DBA_RECYCLEBIN commands

Entire containing tablespace has been dropped

Entire containing schema has been dropped

Space pressure in the containing tablespace

32

Flashback Database

Allows rewinding entire database to a past point in time

Does not require restoring database backups

Can be used to fix undesired logical data modifications

Cannot be used to recover block corruptions or file losses

Uses Flashback Logs that contain before images of blocks

Flashback Database - Prerequisites

Database must be running in ARCHIVELOG mode

FRA (Fast Recovery Area) must be enabled

33

FRA - Overview

Storage location which contains recovery-related files:

Flashback Logs

Backup Sets

Archive Redo Logs

Simplifies DBA’s daily tasks

Retains recovery-related files as long as they are needed

Delete them once they are no longer needed

34

35

Setting up the FRA and Flashback Database

Note: Prior to 11gR2, the ALTER DATABASE FLASHBACK ON

command had be executed when the instance was in a MOUNTED state

Flashback Database - Demo

36

Flashback Database - Demo cont'd

37

Flashback Database Options

In addition to the restore point, you can also specify:

SCN

Time

Before SCN

Before Time

Sequence

38

Oracle 10g Flashback Features - Summary

Flashback Query Enhancements

Flashback Version Query

Flashback Transaction

Query

Flashback Table

Additional Flashback Features

Flashback Drop

Flashback Database

39

Oracle 11gR1Flashback Features

Flashback Transaction Flashback Data Archive

Flashback Transaction

Cancel changes made by a transaction and dependent transactions

Uses DBMS_FLASHBACK.TRANSACTION_BACKOUT procedure

DBMS_FLASHBACK.TRANSACTION_BACKOUT parameters:

numtxns- Number of transactions

xids - List of transactions IDs

Options - Backout dependent transactions

Supplemental logging for primary key columns must be enabled

41

42

Flashback Transaction - Demo

42

43

Flashback Transaction - Demo cont'd

44

Flashback Data Archive (A.K.A Total Recall)

Long-term repository for storing undo records for flashback purposes

Transparent to the application

Flashback Data Archive has the following properties:

Tablespace - Where the information will be stored

Quota - Amount of storage in tablespace for FDA purposes

Retention - The amount of time information will be kept

FDBA background process takes care of the FDA-related tasks

45

Flashback Data Archive - Demo

46

Flashback Data Archive - Demo cont'd

Oracle 11gR2 Flashback Enhancements

48

11gR2 Flashback Enhancements

Flashback Database Enhancements

Enable Flashback Database feature with no downtime

Flashback Data Archive Enhancements

The following DDL commands can be executed on tables with FDA:

TRUNCATE TABLE

ALTER TABLE RENAME

DROP|TRUNCATE PARTITION

ALTER TABLE [ADD|DROP|RENAME|MODIFY] column

ALTER TABLE [ADD|DROP|RENAME|MODIFY] constraint

Oracle 12c Flashback Enhancements

12.1.0.1 Flashback Enhancements 12.1.0.2 Flashback Enhancements

50

Oracle 12c Flashback Enhancements

12.1.0.1 FDA New Features

User context information for transactions is tracked as well

Support for tables that use Hybrid Columnar Compression (HCC)

Support for exporting and importing Flashback Data Archive tables

12.1.0.2 FDA New Features

Support for Multitenant architecture (in addition to Non-CDB option)

Oracle Flashback Technology Licensing

52

Licensing

Feature Supported EditionsFlashback Query All Editions

Flashback Version Query All Editions

Flashback Table Enterprise Edition

Flashback Drop Enterprise Edition

Flashback Database Enterprise Edition

Flashback Data Archive(Versions earlier than 11.2.0.4)

Enterprise Edition + Oracle Advanced Compression

(extra cost option)

Flashback Data Archive(Versions 11.2.0.4 and above)

All Editions

Oracle Flashback Technology Summary

54

Flashback Technology - Summary

Allows recovering from various human errors with minimum effort and time

Should never be used as a replacement for traditional backups

Will not protect against the following scenarios:

Loss of data file or control file

Block corruptions

Software/Hardware failure

Site disasters

Should be used as a complementary solution for traditional backups

55

Flashback Scenarios

Scenario SolutionView historical data and generate historical reports Flashback Query +

FDA (Optional)

Compare historical changes of a specific row or set of rows Flashback Version Query

Obtain transaction information + associated undo SQL Flashback Transaction Query

Undo an entire transaction and its dependent transactions Flashback Transaction

Recover a table prior to undesired logical changes Flashback Table

Restore a table prior to a DROP TABLE command Flashback Drop

Restore entire database prior to undesired logical changes Flashback Database

56

References

Using Oracle Flashback Technology (Oracle Documentation)https://docs.oracle.com/database/121/ADFNS/adfns_flashback.htm

Using Flashback Database and Restore Points (Oracle Documentation)https://docs.oracle.com/database/121/BRADV/flashdb.htm

FLASHBACK TABLE command (Oracle Documentation)https://docs.oracle.com/database/121/SQLRF/statements_9012.htm#SQLRF01802

Oracle Total Recall (White Paper)http://www.oracle.com/technetwork/database/focus-areas/storage/total-recall-whitepaper-171749.pdf

Questions?

Thank You !Please complete the session evaluation

We appreciate your feedback and insight

You may complete the session evaluation via the mobile app