zoukankan      html  css  js  c++  java
  • Oracle Flashback Technologies

    根据指定的SCN,使用rman闪回数据库

    #查看可以闪回到多久前

    SQL> select * from v$flashback_database_log;


    #查看当前的SCN

    复制代码
    SQL> select current_scn from v$database;
    
    CURRENT_SCN
    -----------
        1462273
    
    SQL> 
    复制代码

    #关闭数据库

    复制代码
    $ rman target /
    
    Recovery Manager: Release 11.2.0.4.0 - Production on Tue Jun 23 06:34:28 2015
    
    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
    
    connected to target database: DBTEST (DBID=1275290034)
    
    RMAN> shutdown immediate
    
    using target database control file instead of recovery catalog
    database closed
    database dismounted
    Oracle instance shut down
    复制代码

    #mount数据库

    复制代码
    RMAN> startup mount
    
    connected to target database (not started)
    Oracle instance started
    database mounted
    
    Total System Global Area    2471931904 bytes
    
    Fixed Size                     2255752 bytes
    Variable Size                637535352 bytes
    Database Buffers            1811939328 bytes
    Redo Buffers                  20201472 bytes
    复制代码

    根据SCN闪回数据库

    复制代码
    RMAN> flashback database to scn 1461950;
    
    Starting flashback at 23-JUN-2015 06:35:57
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=189 device type=DISK
    
    
    starting media recovery
    media recovery complete, elapsed time: 00:00:03
    
    Finished flashback at 23-JUN-2015 06:36:01
    复制代码

    #以resetlogs打开数据库。闪回数据库是基于时间点的恢复,是不完全恢复,要是resetlogs方式打开

    RMAN> alter database open resetlogs;
    
    database opened
    
    RMAN> 

    此外还可以用以下方式闪回数据库:

    #根据时间闪回数据库

    RMAN> flashback database to time "to_date('2015-06-23 06:25:00','yyyy-mm-dd hh24:mi:ss')";


    #根据restore point闪回数据库

    RMAN> flashback database to restore point rp;

    #闪回到上一次resetlogs操作之前

    RMAN> flashback database to before resetlogs;

    以上操作命令,也可以在sql*plus下完成。

  • 相关阅读:
    读TIJ -6 类再生
    STM32 外设配置关键步骤-驱动出了问题,最好还是瞧瞧--待续
    oracle 10g 11g rac 虚拟环境切换
    UFLDL教程之(三)PCA and Whitening exercise
    VIM配置文件
    Codeforces 586D Phillip and Trains(DP)
    51Nod 1272最大距离 (树状数组维护前缀最小值)
    Codeforces 482B Interesting Array(线段树区间更新)
    Codechef Chef and Triangles(离散化+区间并集)
    POJ1655 Balancing Act(树的重心)
  • 原文地址:https://www.cnblogs.com/wangchaoyuana/p/7532009.html
Copyright © 2011-2022 走看看