Oracle Flashback Database

  1. Ensure that the prerequisites described in Prerequisites of Flashback Database are met.

    To use the FLASHBACK DATABASE command to return your database contents to points in time within the flashback window, your database must have been previously configured for flashback logging as described in "Overview of Flashback Database_ Restore Points and Guaranteed Restore Points". To return the database to a guaranteed restore point, you must have previously defined a guaranteed restore point as described in "Using Normal and Guaranteed Restore Points".
    
    Flashback Database works by undoing changes to the data files that exist at the moment that you run the command. Note the following important prerequisites:
    
    No current data files are lost or damaged. You can only use FLASHBACK DATABASE to rewind changes to a data file made by an Oracle database, not to repair media failures.
    
    You are not trying to recover from accidental deletion of data files, undo a shrink data file operation, or undo a change to the database name.
    
    You are not trying to use FLASHBACK DATABASE to return to a point in time before the restore or re-creation of a control file. If the database control file is restored from backup or re-created, then all accumulated flashback log information is discarded.
    
    You are not trying to use FLASHBACK DATABASE to undo a compatibility change.

    Prerequisites

  2. Connect SQL*Plus to the target database and determine the desired SCN, restore point, or point in time for the FLASHBACK DATABASE command.

    Obtain the earliest SCN in the flashback database window as follows:

    SELECT OLDEST_FLASHBACK_SCN, OLDEST_FLASHBACK_TIME
    FROM V$FLASHBACK_DATABASE_LOG;

    The most recent SCN that can be reached with Flashback Database is the current SCN of the database. The following query returns the current SCN:

    SELECT CURRENT_SCN
    FROM V$DATABASE;

    You can query available guaranteed restore points as follows (sample output included):

    SELECT NAME, SCN, TIME, DATABASE_INCARNATION#,
    GUARANTEE_FLASHBACK_DATABASE
    FROM V$RESTORE_POINT
    WHERE GUARANTEE_FLASHBACK_DATABASE='YES'; NAME SCN TIME DATABASE_INCARNATION# GUA
    --------------- ---------- --------------------- --------------------- ---
    BEFORE_CHANGES 5753126 04-MAR-12 12.39.45 AM 2 YES
  3. Shut down the database consistently, ensure that it is not opened by any instance, and then mount it:
    SHUTDOWN IMMEDIATE;
    STARTUP MOUNT;
  4. Repeat the query in Step 2 of this procedure.

    Some flashback logging data is generated when the database is shut down. If flashback logs were deleted due to space pressure in the fast recovery area, then your target SCN may not be reachable.

  5. Start RMAN and connect to the target database.
  6. Run the SHOW command to see which channels are preconfigured.

    During the flashback operation, RMAN may need to restore archived redo logs from backup. Enter the following command to see whether channels are configured (sample output is included):

    SHOW ALL;
    
    RMAN configuration parameters for database with db_unique_name PROD1 are:
    .
    .
    .
    CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
    CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
    CONFIGURE DEVICE TYPE SBT_TAPE PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
    CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS "SBT_LIBRARY=/usr/local/oracle/backup/lib/libobk.so";

    If the necessary devices and channels are configured, then no action is necessary. Otherwise, use the CONFIGURE command to configure automatic channels, or include ALLOCATE CHANNELcommands within a RUN block.

  7. Run the RMAN FLASHBACK DATABASE command.

    You can specify the target time by using a form of the command shown in the following examples:

    FLASHBACK DATABASE TO SCN 46963;
    
    FLASHBACK DATABASE
    TO RESTORE POINT BEFORE_CHANGES; FLASHBACK DATABASE TO TIME
    "TO_DATE('09/20/12','MM/DD/YY')";

    When the FLASHBACK DATABASE command completes, the database is left mounted and recovered to the specified target time.

  8. Open the database read-only in SQL*Plus and run some queries to verify the database contents.

    Open the database read-only as follows:

    ALTER DATABASE OPEN READ ONLY;
    

    If you are satisfied with the state of the database, then end the procedure with Step 9. If you are not satisfied with the state of the database, skip to Step 10.

  9. If you are satisfied with the results, then perform either of the following mutually exclusive actions:
    • Make the database available for updates by opening the database with the RESETLOGS option. If the database is currently open read-only, then execute the following commands in SQL*Plus:

      SHUTDOWN IMMEDIATE
      STARTUP MOUNT
      ALTER DATABASE OPEN RESETLOGS;
    • Use Oracle Data Pump Export to make a logical backup of the objects whose state was corrupted. Afterward, use RMAN to recover the database to the present time:

      RECOVER DATABASE;
      

      This step undoes the effect of the Flashback Database by reapplying all changes in the redo logs to the database, returning it to the most recent SCN.

      After reopening the database read/write, you can import the exported objects with the Data Pump Import utility. See Oracle Database Utilities to learn how to use Data Pump.

  10. If you find that you used the wrong restore point, time, or SCN for the flashback, then mount the database and perform one of the following mutually exclusive options:
    • If your chosen target time was not far enough in the past, then use another FLASHBACK DATABASE command to rewind the database further back in time:

      FLASHBACK DATABASE TO SCN 42963;  #earlier than current SCN
      
    • If you chose a target SCN that is too far in the past, then use RECOVER DATABASE UNTIL to wind the database forward in time to the desired SCN:

      RECOVER DATABASE UNTIL SCN 56963; #later than current SCN
      
    • If you want to completely undo the effect of the FLASHBACK DATABASE command, then you can perform complete recovery of the database by using the RECOVER DATABASE command without an UNTIL clause or SET UNTIL command:

      RECOVER DATABASE;
      

      The RECOVER DATABASE command reapplies all changes to the database, returning it to the most recent SCN.

Oracle Flashback Database的更多相关文章

  1. ORACLE FLASHBACK DATABASE 知识整理

    1.知识储备 1)    只有SYSDBA有权执行,闪回前一定要记录当前SCN 2)    需要停机,并要求处于ARCHIVELOG模式中 3)    闪回日志不能被复用和归档,是自动管理的.RVWR ...

  2. oracle flashback

    一.Flashback闪回技术概述:当Oracle数据库发生逻辑错误时,必须使用flashback技术,实现快速和方便的恢复数据.对于人为错误,要确定受到错误事务影响的对象或者记录是非常困难的.使用f ...

  3. 跨数据文件删除flashback database

    Oracle flashback database的使用有一些限制,其中最主要的是flashback database不支持跨数据文件删除闪回和不支持跨数据文件shrink闪回.对于已经删除的数据文件 ...

  4. Oracle 闪回特性(FLASHBACK DATABASE)

    --===================================== -- Oracle 闪回特性(FLASHBACK DATABASE) --======================= ...

  5. Oracle 闪回归档(Flashback Database)

    cmd --管理员身份打开 sqlplus / as sysdba --管理数据库 shu immediate; --独占方式开始 startup mount --修改日期模式 alter datab ...

  6. Oracle Flashback 闪回

    Oracle 的闪回技术是一种数据恢复技术,仅能对用户逻辑错误进行恢复, 闪回针对的是提交commit的事务,没有提交的事务,使用rollback 1.闪回版本查询 Flashback Version ...

  7. Oracle Flashback Technologies - 估算不同时间段闪回日志的产生量

    Oracle Flashback Technologies - 估算不同时间段闪回日志的产生量 v$flashback_database_stat监控闪回数据的i/o开销的统计信息,根据之前的系统负载 ...

  8. Oracle Flashback Technologies - 闪回数据库

    Oracle Flashback Technologies - 闪回数据库 根据指定的SCN,使用rman闪回数据库 #查看可以闪回到多久前 SQL> select * from v$flash ...

  9. Oracle Flashback Technologies (总)

    Oracle Flashback Technologies Oracle 9i中增加了闪回查询技术,闪回查询为数据库提供了一种简单.强大.完全无干扰从人为错误中恢复的机制.通过闪回查询,用户可以查看过 ...

随机推荐

  1. 【JZOJ 3918】蛋糕

    题面: 正文: 根据数据\(4\leq R,C\leq 75\)我们大概可以先枚举切横的刀再二分答案. 更具体的: 假设我们已经枚举到这样横切: 再假设我们已经二分到最小的巧克力是\(7\) 康康第一 ...

  2. HNUSTOJ-1009 格雷码

    1009: 格雷码 时间限制: 1 Sec  内存限制: 128 MB提交: 90  解决: 78[提交][状态][讨论版] 题目描述 对于给定的正整数n,格雷码为满足如下条件的一个编码序列:(1) ...

  3. RocksDB Rate Limiter源码解析

    这次的项目我们重点关注RocksDB中的一个环节:Rate Limiter.其实Rate Limiter的思想在很多其他系统中也很常用. 在RocksDB中,后台会实时运行compaction和flu ...

  4. C#修改电脑桌面图

    win32helper public class Win32Helper { [DllImport("user32.dll", EntryPoint = "SystemP ...

  5. eclipse项目添加到本地仓库

    右键项目→Team→Add to Index 提交后,项目变化如下: *表示已经提交到暂存区,可以进行提交操作 右键项目→Team→Commit 可以填写提交信息: 点击信息下面的commit按钮 项 ...

  6. Django发送邮件功能

    以126邮箱为例 1 首先进126邮箱设置,开启: POP3/SMTP服务 IMAP/SMTP服务 成功开启后会获得一个授权码.   2. setting.py配置: # 配置发送邮箱 # 需要登录网 ...

  7. Python format格式化时使用‘’{‘’或者‘’}‘’

    用format格式化时,如果其中要用到‘’{‘’或者‘’}‘’,需要进行转义,否则报错 {{  ,}}使用同样的符号实现转义,而不是‘/’

  8. activity manager

    首先 activity manager 作为一个独立的服务存在,所有系统中的所有 app 的 activity 都通过这个 service 来管理 同时 activity manager 维护着多个 ...

  9. mybatis返回自增主键问题踩坑

    1 <insert id="insert" keyProperty="id" useGeneratedKeys="true"
 par ...

  10. nginx的配置和基本参数说明

    16 117 118 119 120 121 122 123 #运行用户 user nobody; #启动进程,通常设置成和cpu的数量相等 worker_processes  1;   #全局错误日 ...