95979031 oracle database backup and recovery

49
7/27/2019 95979031 Oracle Database Backup and Recovery http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 1/49 ORACLE DATABASE BACKUP AND REC BEST PRACTICES AND NEW FEATURE Presented by techaccess Team

Upload: aoe1831

Post on 02-Apr-2018

233 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 1/49

ORACLE DATABASE BACKUP AND RECBEST PRACTICES AND NEW FEATURE

Presented by techaccess Team

Page 2: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 2/49

Partners

Page 3: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 3/49

Agenda

Oracle Data Protection Planning & Solutions.Oracle Backup and Recovery Solutions

Physical Data ProtectionUser Managed backupRecovery ManagerOracle Secure Backup

Logical Data protectionExport and ImportOracle Data PumpFlashback Technologies

Recovery AnalysisData Recovery Advisor

Page 4: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 4/49

Identify and prioritize critical dataDesign recovery requirements around data criticality

Assess tolerance for data loss – Recovery Point Objective (RPO)How frequently should backups be taken?Point in time recovery required?

Assess tolerance for downtime – Recovery Time Objective (RTO)Downtime: Problem identification + Recovery planning + system recoveryTiered RTO per level of granularity, e.g. Database, tablespace, table, row

Determine backup retention policyOnsite, offsite, long-term

Assess data protection requirementsPhysical: Disasters, outages, failures, corruptionsLogical: Human errors, application errors

Assess Recovery RequirementsFirst Step in Data Protection Planning

Page 5: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 5/49

Interdependent RTO and RPO activities

Business Process recovered

shows that a businessprocess's RTO and RPOcan involve severalinterdependent andsequential activities

Page 6: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 6/49

Overview of Oracle Data Pump

Data Pump Quick Start for Exp/Imp Users

New Features of Oracle Data Pump

Advanced Features of Oracle Data Pump

Getting the most from Oracle Data Pump

Oracle Data Pump

Page 7: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 7/49

Data Pump Overview: Background and Usage

Replacement for old exp and imp utilitiesFaster and more feature-rich than older utilitiesAvailable starting in Oracle 10g, Data Pump is the new export/import mechanismAs of Oracle 11g, original Export is no longer supported for general useTypical uses for Data Pump Export/Import

Logical backup of schema/tableRefresh test system from productionUpgrade (either cross-platform, or with storage reorg)Move data from production to offline usage (e.g. data warehouse, ad-hoc query)

Typical results for data load/unloadexpdp is ~2x faster than original expimpdp is ~15-40x faster than original impUsing PARALLEL can further improve performance

Page 8: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 8/49

Improved SpeedDirect path load/unloadParallel workers

FlexibilityINCLUDE or EXCLUDE many more object typesREMAP schema, tablespace, data fileUse multiple dump files for parallelism and ease of file management

Database Feature SupportEncrypted columnsNetwork move over dblinksNewer data types

Data Pump Overview: Features

Page 9: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 9/49

Directory ObjectUsed for reading and writing dump filesAllows DBA to control where files will be written on the server systemDefault object DATA_PUMP_DIR created as of Oracle Database 10g Release 2

Interactive Command-lineAllows the user to monitor and control Data Pump jobsMany job parameters can be adjusted “on the fly”

Example of Directory Object Usage:Create the directory as a privileged user:

$ sqlplus sys/<pwd> as SYSDBA

SQL> CREATE DIRECTORY scott_dirAS ‘/usr/apps/datafiles ’; SQL> GRANT READ,WRITE ON DIRECTORY scott_dir TO scott;SQL> exit

User scott can then export/import using Data Pump:expdp scott/<pwd> DIRECTORY=scott_dir dumpfile=scott.dmp

Data Pump Quick Start

Page 10: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 10/49

Tuning ParametersData Pump handles most tuning internally

New command line clientsexpdp/impdp instead of exp/imp

Parameter changes: a few examples Interactive Command-line

Data Pump Parameter Original Exp/Imp Parameter

SCHEMAS OWNERREMAP_SCHEMA TOUSER

CONTENT=METADATA_ONLY ROWS=N

EXCLUDE=TRIGGER TRIGGERS=N

Data Pump Quick Start

Page 11: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 11/49

New Features: Network Mode

expdp scott/tiger network_link=db1 tables=emp dumpfile=scott.dmp directory=mydir

Produces a local dump file set using the contents of a remote databaseRequires a local, writeable database to act as an agentMay be parallelizedWill generally be significantly slower than exporting to a file on a local device

impdp system/manager network_link=db1 directory=mydir

Moves a portion of a database to a new database without creating a dump fileIdeal when the footprint of the dump file set needs to be minimizedMay be parallelizedPrimarily a convenience: will generally be slower than exporting to a file, copying the fileover the network, and importing to the target Parallelization

N

R

P

I

S

Page 12: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 12/49

New Features: Restartability

N

R

P

I

S

Data Pump jobs may be restarted without loss of data and withonly minimal loss of time

Restarts may follow:System failure (e.g., loss of power)

Database shutdown

Database failure

User stop of Data Pump job

Internal failure of Data Pump job

Exceeding dumpfile space on export

Page 13: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 13/49

New Features: Restartability

N

R

P

I

S

expdp system/manager attach=myjobExport> start_job

Export writes out objects based upon object typeOn restart, any uncompleted object types are removed from the dump file and thequeries to regenerate them are repeatedFor data, incompletely written data segments (i.e., partitions or unpartitioned tables) areremoved and the data segments are totally rewritten when the job continues

impdp system/manager attach=myjobImport> start_job

Restart is based upon the state of the individual objects recorded in the master tableIf object was completed, it is ignored on restartIf object was not completed, it is reprocessed on restartIf object was ‘in progress’ and its creation time is consistent with the previous run, it isreprocessed, but ‘duplicate object’ errors are ignored

Page 14: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 14/49

Page 15: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 15/49

expdp system/manager directory=mydir dumpfile=a%u.dmp parallel=2

There should be at least one file available per degree of parallelism. Wildcardingfilenames (%u) is helpfulAll metadata is exported in a single thread of executionTypically each partition or unpartitioned table will be processed by a single worker threadIn certain cases, a very large partition will be processed across multiple threads of execution using parallel query

impdp system/manager directory=mydir dumpfile=a%u.dmp parallel=6

Degree of parallelization in import does not have to match degree of parallelization usedfor exportProcessing of user data is split among the workers as is done for exportCreation of package bodies is parallelized by splitting the definitions of packages acrossmultiple parallel workersIndex building is parallelized by temporarily specifying a degree clause when an index iscreated

New Features: Parallelization

N

R

P

I

S

Page 16: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 16/49

New Features: Include/Exclude

N

R

P

I

S

impdp hr/hr directory=mydir dumpfile=mydump exclude=index

Fine grained object selection is allowed for both expdp and impdp

Objects may be either excluded or included

List of object types and a short description of them may be foundin the following views:

DATABASE_EXPORT_OBJECTSSCHEMA_EXPORT_OBJECTS

TABLE_EXPORT_OBJECTS

Page 17: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 17/49

expdp hr/hr directory=mydir dumpfile=mydump exclude=index,trigger

Objects described by the Exclude parameter are omitted from the jobObjects that are dependent upon an excluded object are also excluded.(e.g., grants and statistics upon an index are excluded if an index isexcluded)Multiple object types may be excluded in a single job

impdp hr/hr directory=mydir dumpfile=mydump include=procedure,function

Objects described by the Include parameter are the only objects included inthe jobObjects that are dependent upon an included object are also included.(e.g., grants upon a function are included if the function is included)Multiple object types may be included in a single job

N

R

P

I

S

New Features: Include/Exclude

Page 18: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 18/49

Page 19: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 19/49

Overview of Oracle FlashBack

Enable Flash back technologyFlash Back Functions

New Features of Flashback in Oracle 11g Release 2

Fast ‘Rewind’ of Logical Errors

Oracle Flashback technologies

Page 20: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 20/49

Flashback Technologies: Overview

Oracle9i introduced Flashback Query to provide a simple, powerful andcompletely non-disruptive mechanism for recovering from human errors.Oracle Database 10g extended the Flashback Technology to provide fast andeasy recovery at the database, table, row, and transaction level. Low impact

Flashback Database – restore database to any point in timeFlashback Drop – restore accidentally dropped tables (based on free space in tablespace)Flashback Table – restore contents of tables to any point in time (undo-based)Flashback Query – back out transaction and all subsequent conflicting transactions (redo-based)Flashback Transaction – back out transaction and all subsequent conflicting transactions(redo-based)

Page 21: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 21/49

Flashback Technologies: Overview

Flashback Database is implemented using a new type of log file calledFlashback Database logs.The Oracle database server periodically logs before images of datablocks in the Flashback Database logsFlashback revolutionizes error recovery

View ‘good’ data as of a past point -in-timeSimply rewind data changesTime to correct error equals time to make error

Excellent tool for configuring QA, Dev and Training databasesFlashback is easy – simple commands, no complex procedure

0

20

40

60

80

Correction Time = Error Time + f(DB_SIZE)

Page 22: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 22/49

Enable and Disable Flashback Database

Make sure the database is in archive mode.Configure the recovery area by setting the twoparameters:

DB_RECOVERY_FILE_DEST

DB_RECOVERY_FILE_DEST_SIZE

Open the database in MOUNT EXCLUSIVEmode and turn on the flashback feature:

SQL> STARTUP MOUNT EXCLUSIVE;SQL> ALTER DATABASE FLASHBACK ON;

Set the Flashback Database retention target:

DB_FLASHBACK_RETENTION_TARGET

Disabling Flashback DatabaseSQL> ALTER DATABASE FLASHBAC

Determine if Flashback Database isSQL> select flashback_on

from v$database;

FLASHBACK_ON

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

YES

Page 23: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 23/49

Monitoring Flashback

Monitoring flashback databaseselect begin_time, flashback_data, db_data, redo_data, ESTIMATED_FLASHBACK_SIZEfrom v$flashback_database_stat;(this view estimate the amount of flashback logs generated at various times)

Monitor the Flashback Database retention targetselect *from v$flashback_database_log;(this view find out how far into the past you can flashback)

The default value for flashback retention time is 1440 minutesThis command shows the background process of flashback ‘ ora_rvwr ’ $ ps -ef | grep rvwroracle 25169 1 0 16:32:22 ? 0:00 ora_rvwr_grid

Page 24: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 24/49

Flashback Database

The database must be in mount state before using flashback database operationsflashback operation performs a point-in-time recovery, which is a form of incomplete recovso you need to open the database with the resetlogs clause after perform flashback operatiYou can flashback your database to the following

A specific point in time, specified by date and timeA specific SCN numberThe last resetlogs operationA named restore point

Flashback using RMANRMAN> flashback database to scn 1050951;RMAN> flashback database to time 'sysdate-2/60/24';RMAN> flashback database to restore point rp6;RMAN> flashback database to before resetlogs;

Page 25: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 25/49

Flashback Database

Flashback using SQL*PlusSQL> flashback database to timestamp to_date('1/22/2007 00:00:00','mm/dd/yyyy hh24:mi:ss');

SQL> flashback database to scn 1050900;

SQL> flashback database to restore point rp1;

Page 26: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 26/49

Flashback Drop

In Oracle Database 10g, When the table is dropped, it’s not reallyerased from the database; rather, it is renamed and placed in alogical container called the recycle bin, similar to the Recycle Binfound in Windows.

The extents allocated to the segment are not reallocated untilyou purge the object.

You can reinstate the dropped table any time using only onesimple command.

Page 27: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 27/49

Recycle bin

A recycle bin contains all the dropped database objects until,You permanently drop them with the PURGE command.

Recover the dropped objects with the FLASHBACK TABLE command.There is no room in the tablespace for new rows or updates to existing rows.

You can view the dropped objects in the recycle bin from two dictionary views:USER_RECYCLEBIN: list all dropped user objectsDBA_RECYCLEBIN: list all dropped system-wide objects

Show recyclebinYou can purge recycle bin object using following commandsSQL> purge recyclebin; (this statement purges user objects from recyclebin)

SQL> purge dba_recyclebin; (this statement purges All objects from recyclebin)

SQL> purge tablespace users; (this statement purges All objects belongs to users tablespace from recyclebin)

Page 28: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 28/49

A recycle bin contains all the dropped database objects until,You permanently drop them with the PURGE command.

Recover the dropped objects with the FLASHBACK TABLE command.

There is no room in the tablespace for new rows or updates to existing rows.

You can view the dropped objects in the recycle bin from two dictionary views:USER_RECYCLEBIN: list all dropped user objects

DBA_RECYCLEBIN: list all dropped system-wide objectsYou can purge recycle bin object using following commandsSQL> purge recyclebin; (this statement purges user objects from recyclebin)

SQL> purge dba_recyclebin; (this statement purges All objects from recyclebin)

SQL> purge tablespace users; (this statement purges All objects belongs to users tablespace from recyc

Flashback Drop

Page 29: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 29/49

After checking the contents of recycle bin, you can recover those object by one of thefollowing methodsSQL> flashback table accounts to before drop;

SQL> flashback table accounts to before drop rename to new_accounts;

SQL> flashback table "BIN$bQ8QU1bWSD2Rc9uHevUkTw==$0" to before drop;

You have an option to drop table permanently.SQL> drop table test purge;

SQL> purge table "BIN$0+ktoVChEmXgNAAADiUEHQ==$0";

Flashback Drop

Page 30: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 30/49

Flashback Table

Flashback Table allows you to recover a table or tables to a specific point in time without restorinbackup.When you use the Flashback Table feature to restore a table to a specific point in time, all associaobjects, such as, indexes, constraints, and triggers will be restoredFlashback Table operations are not valid for the following object types:

Tables that are part of a clusterMaterialized viewsAdvanced Queuing tables

Static data dictionary tablesSystem tablesPartitions of a tableRemote tables (via database link)

Table row movement must be enabled to flashback a table:SQL> ALTER TABLE billing ENABLE ROW MOVEMENT;

Page 31: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 31/49

Flashback Table

Data used to recover a table is stored in the undo tablespace. You can use the parameterUNDO_RETENTION to set the amount of time you want undo information retained in thedatabase.The default value for UNDO_RETENTION is 900 seconds (15 minutes).When an active transaction uses all the undo tablespace, the system will start reusing undospace that would have been retained unless you have specified RETENTION GUARANTtablespace.To create an undo tablespace with the RETENTION GUARANTEE option, issue the follo

command:SQL> CREATE UNDO TABLEAPCE undo_tbsDATAFILE ‘/u02/oradata /grid/undo_tbs01.dbf’ SIZE 1 G RETENTION GUARANTEE;

You must have the FLASHBACK TABLE or FLASHBACK ANY TABLE system privilegFlashback Table feature

Page 32: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 32/49

Flashback Table

This statement brings a table ‘billing’ back to a certain SCN number;SQL> FLASHBACK TABLE billing TO SCN 76230;

This statement brings a table ‘billing’ back to a certain timestamp:

SQL> FLASHBACK TABLE billing

TO TIMESTAMP

TO_TIMESTAMP(‘06/25/03 12:00:00’,’MM/DD/YY HH:MI:SS’);

Page 33: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 33/49

Flashback Version Query

Flashback Query was first introduced in Oracle9i, to provide a way for you to view historical data

In Oracle 10g, this feature has been extended.

You can now retrieve all versions of the rows that exist or ever existed between the time the queryissued and a point back in time.

You can use the VERSIONS BETWEEN clauses to retrieve all historical data related to a row.

The Flashback Versions Query feature retrieves all committed occurrences of the row.

The row history data is stored in the undo tablespace.

The undo_retention initialization parameter specifies how long the database will keep the amouncommitted undo information.

If a new transaction need to use undo space and there is not enough free space left, any undoinformation older than the specified undo retention period will be overwritten.

You can set the undo tablespace option to RETENTION GUARANTEE to retain all row historie

Page 34: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 34/49

Flashback Version Query Example

SQL> create table emp (name varchar2(10),salary number(8,2));

Table created.

SQL> insert into emp values ('DANIEL',2000);

1 row created

SQL> commit;

Commit complete.

SQL> update emp set salary = 3000 where name = 'DANIEL';

1 row updated.

SQL> commit;

Commit complete.

SQL> select * from emp;

NAME SALARY

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

DANIEL 3000

SQL> select * from emp

versions between scn minvalue

NAME SALARY

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

DANIEL 3000

DANIEL 2000

Page 35: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 35/49

Flashback Transaction Query

It provides a way for you to view changes made to the database at the transaction level.

It allows you to diagnose problems in your database and perform analysis and audit transactions.

You can use this feature in conjunction with the Flash Versions Query feature to roll back the chanmade by a transaction.

You can retrieve the transaction history from flashback_transaction_query view:

Name Null? Type

------------------------------------ -------- --------------XID RAW(8)

START_SCN NUMBER

START_TIMESTAMP DATE

COMMIT_SCN NUMBER etc

Page 36: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 36/49

Flashback Transaction Query

SQL> select xid, start_scn, start_timestamp, table_name, undo_sql

from flashback_transaction_query

where xid = '0009001F000000B2‘;

XID START_SCN START_TIMESTAMP TABLE_NAME UNDO_SQL

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

0009001F000000B2 714980 Feb 21 2004 23:30:31 EMP update "ORACLE"."EMP" set "SALARY" = ‘20

ROWID = 'AAAMWJAAEAAAAFsAAA

Page 37: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 37/49

Flashback Data Archive 11g R2 New Feature

Transparently tracks historical changes to all Oracle data in a highly secure and efficimanner:“Secure”

No possibility to modify historical data

Retained according to your specifications

Automatically purged based on your retention policy

“Efficient” Special kernel optimizations to minimize performance overhead of capturing historical data

Stored in compressed form in tablespaces to minimize storage requirements

Completely transparent to applications

Easy to set up

Page 38: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 38/49

Flashback Data Archive Overview

A flashback data archive is ahistorical data store.

Oracle Database 11g automaticallytracks and archives the data in tables

enabled for Flashback Data archivewith a new Flashback Data archivebackground process, FBDA

Page 39: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 39/49

Flashback Data Archive Overview

The Flashback Data Archivebackground process, FBDA, startswith the database.

FBDA operates first on the undo in thebuffer cache.In case the undo has already left thebuffer cache, FBDA could also read therequired values from the undo

segments.FBDA consolidates the modified rows of flashback archive –enabled tables andwrites them into the appropriate historytables, which make up the flashbackdata archive.

Page 40: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 40/49

Flashback Data Archive Workflow

Create the flashback data archive.Optionally, specify the default flashback data archive.

Enable the flashback data archive.

View flashback data archive data.

Page 41: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 41/49

Flashback Data Archive Configuration

Using a default flashback archive:1. Create a default flashback data archive:

CREATE FLASHBACK ARCHIVE DEFAULT fla2

TABLESPACE tbs1 QUOTA 10G RETENTION 2 YEAR;

2. Enable history tracking for a table:ALTER TABLE stock_data FLASHBACK ARCHIVE;

3. Disable history trackingALTER TABLE stock_data NO FLASHBACK ARCHIVE;

Page 42: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 42/49

Flashback Data Archive Maintenance

Adding space:ALTER FLASHBACK ARCHIVE fla1 ADD TABLESPACE tbs3 QUOTA 5G;

Changing retention time:ALTER FLASHBACK ARCHIVE fla1 MODIFY RETENTION 2 YEAR;

Purging data:ALTER FLASHBACK ARCHIVE fla1 PURGE BEFORE TIMESTAMP(SYSTIMESTAMP - INTERVAL '1' day

Dropping a flashback data archive:DROP FLASHBACK ARCHIVE fla1;

Viewing Flashback data archive*_FLASHBACK_ARCHIVE

*_FLASHBACK_ARCHIVE_TS

*_FLASHBACK_ARCHIVE_TABLES

Page 43: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 43/49

Flashback Data Archive Guidelines

To ensure database consistency, always perform a COMMIT or ROLLBACK operation befpast data.Remember that all flashback processing uses the current session settings, such as national and character set, not the settings that were in effect at the time being queried.To obtain an SCN to use later with a flashback feature, you can use theDBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER function.To compute or retrieve a past time to use in a query, use a function return value as a time st

an SCN argument. For example, add or subtract an INTERVAL value to the value of theSYSTIMESTAMP function.

To query past data at a precise time, use an SCN. If you use a time stamp, the actual time qmight be up to 3 seconds earlier than the time you specify. The Oracle database server useinternally and maps them to time stamps at a granularity of 3 seconds.

Page 44: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 44/49

Flashback transaction backout 11g R2

Logical recovery option to roll back a specific transaction and all its dependent transUsing redo logs and supplemental logging

Creating and executing compensating transactions

You finalize changes with commit or roll back.

Faster and easier than laborious manual approach

Page 45: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 45/49

Flashing back a transaction

You can flash back a transaction by usingEnterprise Manager or the command line.

Enterprise Manager uses the FlashbackTransaction Wizard, which calls theDBMS_FLASHBACK.TRANSACTION_BACKOUTprocedure with the NOCASCADE option.

If the PL/SQL call finishes successfully, it meansthat the transaction does not have anydependencies and a single transaction isbacked out successfully.

Page 46: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 46/49

Viewing a flashback Dependency Report

After choosing your backout option, the dependency report is visible in theDBA_FLASHBACK_TXN_STATE and DBA_FLASHBACK_TXN_REPORT view

Review the dependency report that shows all transactions which were backed out.

Commit the changes to make them permanent.

Roll back to discard the changes.

Page 47: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 47/49

Flashback database Enhancement in 11g R2

Enable Flashback Database while the database is open

Monitor Flashback Database by using the SOFAR and TOTALWORK columns of V$SESSION_LONGOPS

Page 48: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 48/49

Overview of Recovery Manager (RMAN)

Features of RMAN

RMAN Components

Repository Configuration in RMAN

New Features of RMAN in 11g R2

Fast ‘Rewind’ of Logical Errors

Recovery manager (RMAN)

Page 49: 95979031 Oracle Database Backup and Recovery

7/27/2019 95979031 Oracle Database Backup and Recovery

http://slidepdf.com/reader/full/95979031-oracle-database-backup-and-recovery 49/49

Overview of Recovery Manager (RMAN)

S