drop restore point guarantee flashback database

For example, if the flashback retention target is 1 week, then you must ensure that online and archived redo logs that contain all changes for the past week are accessible. The control file can maintain a record of thousands of normal restore points with no significant effect on database performance. Less space is needed because each changed block is only logged once. The database restores the version of each block that is immediately before the target time. Flashback Database also provides an efficient alternative to rebuilding a failed primary database after a Data Guard failover. Like a normal restore point, a guaranteed restore point serves as an alias for an SCN in recovery operations. For example, the file is outside the DB_FLASHBACK_RETENTION_TARGET parameters. The chief differences between normal flashback logging and logging for guaranteed restore points are related to when blocks are logged and whether the logs can be deleted in response to space pressure in the fast recovery area. Because of the difference between sequential I/O and random I/O, a better indication of I/O overhead is the number of I/O operations issued for flashback logs. Later modifications to the same block do not cause the contents to be logged again unless another guaranteed restore point was created after the block was last modified. You could create a guaranteed restore point at the start of the upgrade. Thus, it is recommended to use a file system that avoids operating system file caching, such as ASM. You can also review AWR snapshots to pinpoint system usage caused by flashback logging. For guaranteed restore points, STORAGE_SIZE indicates the amount of disk space in the fast recovery area used to retain logs required to guarantee FLASHBACK DATABASE to that restore point. The following examples return the database to a specified SCN or restore point: Flashback Database is accessible through the RMAN command and SQL statement FLASHBACK DATABASE. If the instance is mounted, then the database must be shut down cleanly unless it is a physical standby database.

The variations of the command are as follows: RMAN indicates the SCN and time of the restore point, the type of restore point, and the name of the restore point. However, you can take the shrunken file offline, flash back the rest of the database, and then later restore and recover the shrunken data file. These block images can later be reused to reconstruct the data file contents for any moment at which logs were captured. Logging for Flashback Database and guaranteed restore points involves capturing images of data file blocks before changes are applied. The V$SYSSTAT statistics shown in Table 7-1 can tell you the number of I/O operations that your instance has issued for various purposes. For Oracle Real Application Clusters (Oracle RAC) databases, the fast recovery area must be in a clustered file system or in ASM. Flashback Database is similar to conventional point-in-time recovery in its effects. You cannot use FLASHBACK DATABASE to return to a point in time before the restore or re-creation of a control file. Use a relatively small stripe size such as 128 KB. The file is reported as obsolete and not needed by the flashback database. It also lists guidelines to ensure optimal performance of Flashback Database. It cannot be used to repair media failures, or to recover from accidental deletion of data files. The Automatic Workload Repository (AWR) automates database statistics gathering by collecting, processing, and maintaining performance statistics for database problem detection and self-tuning. For example, suppose that you are performing an application upgrade on a database host over a weekend. You cannot use Flashback Database alone to retrieve a dropped data file. If you cannot use FLASHBACK DATABASE because the flashback database window is not long enough, then you can use database point-in-time recovery (DBPITR) in most cases to achieve a similar result. To achieve good performance for large production databases with Flashback Database enabled, Oracle recommends the following: Use a fast file system for your fast recovery area, preferably without operating system file caching. In this case, the first time a data file block is modified after the time of the guaranteed restore point, the database stores an image of the block before the modification in the flashback logs. You can only recover the dropped data file by using RMAN to fully restore and recover the data file. Ensure that the database is open or mounted. The FLASHBACK DATABASE command can use these images to return the data files to their previous state. For large databases, set the initialization parameter LOG_BUFFER to at least 8 MB. Your recoverability goals partially determine whether to enable logging for flashback database, or use guaranteed restore points, or both. Guaranteed restore points never age out of the control file. The flashback retention target is a target, not a guarantee that Flashback Database is available. When you use Flashback Database to rewind a database to a past target time, the command determines which blocks changed after the target time and restores them from the flashback logs. Normal restore points are lightweight. Storage snapshots are often used to protect a database before risky operations such as large-scale database updates or application patches or upgrades. If you use flashback features or point-in-time recovery, then you can use the name of the restore point instead of a time or SCN. In practice, redo logs are typically needed much longer than the flashback retention target to support point-in-time recovery. Assume that you create a guaranteed restore point when logging for Flashback Database is disabled. Rather than creating a snapshot or duplicate database to test the operation, you can create a guaranteed restore point on a primary or physical standby database. If flashback logging is enabled, then a guaranteed restore point enforces the retention of flashback logs required for Flashback Database to any SCN after the earliest guaranteed restore point. You can then perform the risky operation with the certainty that the required flashback logs are retained. Oracle Data Guard Concepts and Administration, Oracle Database Advanced Application Developer's Guide, Oracle Database 2 Day + Performance Tuning Guide, Chapter 18, "Performing Flashback and Database Point-in-Time Recovery", "Initialization Parameters for the Fast Recovery Area", "Performing Database Point-in-Time Recovery", "Responding to a Full Fast Recovery Area", "Managing Space for Flashback Logs in the Fast Recovery Area", "Configuring the Environment for Optimal Flashback Database Performance". To increase the likelihood that enough flashback logs are retained to meet the flashback database window, you can increase the space in your fast recovery area (see "Initialization Parameters for the Fast Recovery Area"). Assume that your primary goal is the ability to return your database to the time at which the guaranteed restore point was created. For example, if flashback buf free by RVWR is the top wait event, then you know that Oracle Database cannot write flashback logs very quickly. Queries do not change data and thus do not contribute to logging activity for Flashback Database. These features provide a more efficient alternative to point-in-time recovery and does not require a backup of the database to be restored first. Also, perform a full or incremental backup of the affected data files immediately after any NOLOGGING operation to ensure recoverability to points in time after the operation. Follow these are the steps to enable Flashback Database. The columns FLASHBACK_DATA and REDO_DATA correspond to sequential writes, whereas DB_DATA column corresponds to random reads and writes. This advantage is less likely for applications with high volume inserts or large batch inserts. Except as noted, the information about where and how to use normal restore points applies to guaranteed restore points as well. To use guaranteed restore points, the database must satisfy the following additional prerequisite: the COMPATIBLE initialization parameter must be set to 10.2.0 or greater. (Oracle Database does not cause the standby instance to fail because it does not want to cause the primary database to fail in maximum protection mode.) Flashback logs are not deleted in response to space pressure if they are required to satisfy the guarantee. Thus, retention of flashback logs and other files required to satisfy the guaranteed restore point, in addition to files required to satisfy the backup retention policy, can cause the fast recovery area to fill completely. To enable Flashback Database, you configure a fast recovery area and set a flashback retention target. The control file stores the name of the restore point and the SCN. The FLASHBACK_DATA and REDO_DATA columns describe bytes of flashback data and redo data written respectively during the time interval, while the DB_DATA column describes bytes of data blocks read and written. The implications in performance and in space usage for these features, separately and when used together, should also factor into your decision. Operating system file caching is typically not effective for these files, and may actually add CPU overhead for reading from and writing to these files. If RVWR encounters an I/O error, then the following behavior is expected: If there are any guaranteed restore points defined, then the instance fails when RVWR encounters I/O errors. See Oracle Data Guard Concepts and Administration for details. For example, if you perform a direct-path INSERT operation in NOLOGGING mode, and that operation runs from 9:00 to 9:15 on April 3, 2005, and you later use Flashback Database to return to the target time 09:07 on that date, the objects and datafiles updated by the direct-path INSERT may be left with block corruption after the Flashback Database operation completes. This section describes the various commands and monitoring capabilities you use with normal and guaranteed restore points. The following rules govern creating, retaining, overwriting and deleting of flashback logs in the fast recovery area: If the fast recovery area has enough space, then a flashback log is created whenever necessary to satisfy the flashback retention target. You can reduce overhead by disabling flashback logging for specific tablespaces as in the following example: You can re-enable flashback logging for a tablespace later with this command: If you disable Flashback Database for a tablespace, then you must take its datafiles offline before running FLASHBACK DATABASE. Each row in the view shows the statistics accumulated (typically over the course of an hour). You must have a fast recovery area enabled, because flashback logs can only be stored in the fast recovery area. Restore points provide capabilities related to Flashback Database and other media recovery operations. Before performing any operation that you may have to reverse, you can create a normal restore point. You cannot back up flashback logs to locations outside the fast recovery area. "Rewinding a Database with Flashback Database" to learn about Flashback Database, "Performing Database Point-in-Time Recovery" to learn about DBPITR. If the database is mounted, then it must have been shut down cleanly (unless it is a physical standby database). For large production databases, multiple disk spindles may be needed to support the required disk throughput for the database to write the flashback logs effectively. The following example shows sample output: To see a list of all currently defined restore points (normal and guaranteed), use the V$RESTORE_POINT control file view with the following query: Name of each restore point (guaranteed and normal), Time and database incarnation number when the restore points were created, Type of restore point (normal or guaranteed), Amount of space in the fast recovery area being used to support information needed for Flashback Database operations for that restore point. You cannot use Flashback Database to undo a shrink data file operation. This may eventually cause the logical standby or the managed recovery of the physical standby to suspend. Changed blocks are written from memory to the flashback logs at relatively infrequent, regular intervals, to limit processing and I/O overhead. Flashback Database and restore points are not only effective in traditional database recovery situations but can also be useful during database upgrades, application deployments and testing scenarios when test databases must be quickly created and re-created. This chapter contains the following topics: Understanding Flashback Database, Restore Points and Guaranteed Restore Points, Logging for Flashback Database and Guaranteed Restore Points, Prerequisites for Flashback Database and Guaranteed Restore Points, Using Normal and Guaranteed Restore Points. From that time onwards, at regular intervals, the database copies images of each altered block in every data file into the flashback logs. For workloads that repeatedly modify the same data, disk space usage can be less than normal flashback logging. They remain until they are explicitly dropped. Flashback Database is much faster than point-in-time recovery because it does not require restoring datafiles from backup and requires applying fewer changes from the archived redo logs. When you enable Flashback Database while the database is open, there is a very small chance the command may not be able to obtain the memory it needs. If the storage system used to hold the fast recovery area does not have nonvolatile RAM, then try to configure the file system on striped storage volumes. The number of write operations issued for writing data blocks, The number of read operations issued for reading data blocks, The number of write operations issued for writing to the redo log, The number of write operations issued for writing to flashback logs, Total size in bytes of flashback database data written from this instance, Oracle Database Reference for more details on columns in the V$SYSSTAT view, Oracle Database Performance Tuning Guide to learn about AWR, Oracle Database 2 Day + Performance Tuning Guide for more information about AWR reports. To resolve the issue, you can issue either a SHUTDOWN ABORT or an ALTER DATABASE FLASHBACK OFF command. For normal restore points, STORAGE_SIZE is zero. Enable the Flashback Database feature for the whole database: Optionally, disable flashback logging for specific tablespaces. In practice, guaranteed restore points provide a useful alternative to storage snapshots. Applications with low volume inserts may benefit from this disk space saving. If the command fails because of that reason, retry the command after a while or retry after a shutdown and restart of the instance. The V$FLASHBACK_DATABASE_STAT view shows the bytes of flashback data logged by the database. If a flashback log is old enough that it is no longer needed to satisfy the flashback retention target, then a flashback log is reused. Thus, you should monitor space used in the fast recovery area. All existing transactions and queries proceed unaffected. Any restore point more recent than the value of CONTROL_FILE_RECORD_KEEP_TIME is retained, regardless of how many restore points are defined. These differences affect space usage for logs and database performance. This section describes the basic commands for Flashback Database. In particular, a guaranteed restore point created at an system change number (SCN) ensures that you can use Flashback Database to rewind the database to this SCN. A guaranteed restore point ensures that you can use Flashback Database to rewind a database to its state at the restore point SCN, even if the generation of flashback logs is disabled. Because Flashback Database works by undoing changes to the data files that exist at the moment when you run the command, it has the following limitations: Flashback Database can only undo changes to a data file made by Oracle Database.

Optionally, set the DB_FLASHBACK_RETENTION_TARGET to the length of the desired flashback window in minutes: By default DB_FLASHBACK_RETENTION_TARGET is set to 1 day (1440 minutes). The most recent 2048 restore points are always kept in the control file, regardless of their age. You can use Flashback Database to reverse most unwanted changes to a database if the data files are intact. By default, flashback logs are generated for all permanent tablespaces. You can use the LIST command to list either a specific restore point or all restore points known to the RMAN repository. When you have a write-intensive workload, the Flashback Database logging overhead is high since it must log all those database changes. If you flash back a database to a time when a dropped data file existed in the database, only the data file entry is added to the control file. The range of SCNs for which there is currently enough flashback log data to support the FLASHBACK DATABASE command is called the flashback database window. Ensure the database instance is open or mounted. If possible, avoid using Flashback Database with a target time or SCN that coincides with a NOLOGGING operation. Redo logs on disk or tape must be available for the entire time period spanned by the flashback logs. This retention target specifies how far back you can rewind a database with Flashback Database. If the fast recovery area is not large enough to hold the flashback logs and files such as archived redo logs and other backups needed for the retention policy, then the database may delete flashback logs from the earliest SCNs forward to make room for other files. In general, you can use a guaranteed restore point as an alias for an SCN with any command that works with a normal restore point. Configure the following database settings before enabling Flashback Database: Your database must be running in ARCHIVELOG mode, because archived logs are used in the Flashback Database operation. Thus, if flashback logging is enabled, you can rewind the database to any SCN in the continuum rather than to a single SCN only. You can use either command to quickly recover the database from logical data corruptions or user errors. The flashback database window cannot extend further back than the earliest SCN in the available flashback logs. On a database instances that is either in mount or open state, issue the following command: Maintaining flashback logs imposes comparatively limited overhead on an database instance. Guaranteed restore points are the only way to ensure that you can use Flashback Database to return to a specific point in time or guarantee the size of the flashback window. You can use either command to quickly recover the database from logical data corruption or user errors. If the upgrade fails, then reverse the changes with the FLASHBACK DATABASE command.

This chapter explains Flashback Database, restore points. If you expect to use Flashback Database to return to a point in time during an operation such as a direct-path INSERT, consider performing the operation in LOGGING mode. "Managing Space for Flashback Logs in the Fast Recovery Area" explains how to monitor fast recovery area disk space usage. Consult "Responding to a Full Fast Recovery Area" if your fast recovery area becomes full. Creating a normal restore point assigns a restore point name to an SCN or specific point in time. If the database must create a flashback log and the fast recovery area is full or there is no disk space, then the oldest flashback log is reused instead. There are several data analysis methods for monitoring the Flashback Database workload on your system. It enables you to return a database to its state at a time in the recent past. To ensure successful operation of Flashback Database and guaranteed restore points, you must first set several key database options. When using Flashback Database with a target time at which a NOLOGGING operation was in progress, block corruption is likely in the database objects and datafiles affected by the NOLOGGING operation. Flashback Database is accessible through the RMAN command FLASHBACK DATABASE or the SQL statement FLASHBACK DATABASE. Creating a normal restore point eliminates manually recording an SCN in advance or determine the correct SCN after the fact by using features such as Flashback Query. You can use restore points and Flashback Database independently or together. When you enable Flashback Database on a physical standby database, you can flash back a standby database. Thus, a restore point functions as a bookmark or alias for this SCN. If no guaranteed restore points are defined, then the instance remains unaffected when RVWR encounters I/O errors. Consequently, the flashback database window can be shorter than the flashback retention target, depending on the size of the fast recovery area, other backups that must be retained, and how much flashback logging data is needed. To take advantage of this feature, you must set up your database in advance to create flashback logs. This technique enables each write to the flashback logs to be spread across multiple spindles, improving performance. In this case, any flashback logs that would require the use of that redo log file for the use of FLASHBACK DATABASE are also deleted. Scripting on this page enhances content navigation, but does not change the content in any way. If you enable Flashback Database and define one or more guaranteed restore points, then the database performs normal flashback logging. No file in the fast recovery area is eligible for deletion if it is required to satisfy a guaranteed restore point. The following example shows how to create a normal restore point in SQL*Plus: This example shows how to create a guaranteed restore point: Oracle Database SQL Language Reference for reference information about the SQL CREATE RESTORE POINT statement, "Listing Restore Points" to learn how to list restore point, "Dropping Restore Points" to learn how to delete restore points. This behavior is expected for both single-instance and Oracle RAC databases.

The database then uses redo logs to reapply changes that were made after these blocks were written to the flashback logs. The file is backed up to tape. In this case, it is usually more efficient to turn off flashback logging and use only guaranteed restore points. For example, you can compare AWR reports from before and after the Flashback Database was turned on. In this case, the recovery area retains the flashback logs required to flash back to any arbitrary time between the present and the earliest currently defined guaranteed restore point. When flashback is enabled or when there are guaranteed restore points, the background process RVWR writes flashback data to flashback database logs in the fast recovery area. If the fast recovery area is full, then an archived redo log that is reclaimable according to the fast recovery area rules may be automatically deleted by the fast recovery area to make space for other files. On a physical or logical standby, RVWR appears to have stopped responding, retrying the I/O periodically. A principal difference is that guaranteed restore points never age out of the control file and must be explicitly dropped. If the database control file is restored from backup or re-created, all accumulated flashback log information is discarded. Oracle Flashback Database and restore points are related data protection features that enable you to rewind data back in time to correct any problems caused by logical data corruption or user errors within a designated time window. Normal restore points eventually age out of the control file if not manually deleted, so they require no ongoing maintenance. Configure enough disk spindles for the file system that holds the fast recovery area. Oracle Database Reference for information about V$RESTORE_POINT, "Rewinding a Database with Flashback Database". As with Flashback Database, even the effects of NOLOGGING operations like direct load inserts can be reversed with guaranteed restore points. Normal restore points that do not meet either of these conditions may age out of the control file. To create normal or guaranteed restore points, use the CREATE RESTORE POINT SQL statement, providing a name for the restore point and specifying whether it is to be a guaranteed restore point or a normal one (the default). "Rewinding a Database with Flashback Database" explains how to use the FLASHBACK DATABASE command to reverse database changes. This chapter discusses configuring, monitoring, and maintaining these features as part of an overall data protection strategy. Thus, the flashback logs preserve the contents of every changed data block at the time that the guaranteed restore point was created.

If the recovery area has enough disk space to store the needed logs, then you can use a guaranteed restore point to rewind a whole database to a known good state days or weeks ago. Other Oracle RAC instances can be in any mode. Flashback Database of standby databases has some applications in the Data Guard environment. Depending upon the pattern of activity on your database, it can also cause significant space pressure in the fast recovery area. Flashback logging causes some performance overhead. When you are satisfied that you do not need an existing restore point, or when you want to create a restore point with the name of an existing restore point, you can drop the restore point, using the DROP RESTORE POINT SQL*Plus statement. The effects are similar to database point-in-time recovery (DBPITR). Therefore, you might want to tune the file system and storage used by the fast recovery area, possibly using a technique described in "Configuring the Environment for Optimal Flashback Database Performance". When you create a guaranteed restore point, with or without enabling full flashback database logging, you must monitor the space available in your fast recovery area.

The following commands support this use of restore points: The RECOVER DATABASE and FLASHBACK DATABASE commands in RMAN.

Files that the database creates in the fast recovery area, including flashback logs, are typically large. The performance overhead of logging for a guaranteed restore point without flashback database logging enabled can also be lower. For example: The same statement is used to drop both normal and guaranteed restore points. You can only use Flashback Database if flashback logs are available. Note the following cases: On a primary database, Oracle Database automatically disables Flashback Database while the database is open. The overhead of logging for Flashback Database depends on the mixture of reads and writes in the database workload. Flashback Database uses its own logging mechanism, creating flashback logs and storing them in the fast recovery area. You can return a database to its state in a previous incarnation, and undo the effects of an ALTER DATABASE OPEN RESETLOGS statement. This method of logging has the following important consequences: FLASHBACK DATABASE can re-create the data file contents at the time of a guaranteed restore point by using the block images.