zoukankan      html  css  js  c++  java
  • flashback database(drop tablespace)

    1、首先记录时间

    select to_char(systimestamp,'yyyy-mm-dd HH24:MI:SS') from dual;--2014-04-25 13:55:48

       查看表
    select * from test1

    删除表空间
    drop tablespace test1 including contents and datafiles

    2、开始flashback database

    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options

    SQL> shutdown immediate;
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    SQL> startup mount;
    ORACLE instance started.

    Total System Global Area 935329792 bytes
    Fixed Size 1222696 bytes
    Variable Size 272631768 bytes
    Database Buffers 654311424 bytes
    Redo Buffers 7163904 bytes
    Database mounted.
    SQL> flashback database to timestamp to_timestamp('2014-04-25 13:55:48','yyyy-mm-dd HH24:MI:SS');
    flashback database to timestamp to_timestamp('2014-04-25 13:55:48','yyyy-mm-dd HH24:MI:SS')
    *
    ERROR at line 1:
    ORA-38795: warning: FLASHBACK succeeded but OPEN RESETLOGS would get error
    below
    ORA-01245: offline file 7 will be lost if RESETLOGS is done
    ORA-01111: name for data file 7 is unknown - rename to correct file
    ORA-01110: data file 7: '/u01/app/oracle/product/10.2/db_1/dbs/UNNAMED00007'

    恢复的时候报错


    SQL> alter database create datafile 7 as '/u01/app/oracle/test11.dbf';      #创建数据文件

    Database altered.

    SQL> recover datafile 7;                                            #按道理是要recover一次
    ORA-00283: recovery session canceled due to errors
    ORA-38798: Cannot perform partial database recovery
    ORA-38797: Full database recovery required after a database has been flashed
    back

    再次flashback databae直接成功了
    SQL> flashback database to timestamp to_timestamp('2014-04-25 13:55:48','yyyy-mm-dd HH24:MI:SS');

    Flashback complete.

    SQL> alter database open resetlogs;

    Database altered.

    其实正常表空间删除后,flashback database正常情况下不行,必须要利用日志来恢复表空间。

    如果有问题欢迎大家补充指正。

  • 相关阅读:
    网络流24题之圆桌问题
    BZOJ 4276: [ONTAK2015]Bajtman i Okrągły Robin
    网络流24题航空路线问题
    BZOJ1038 瞭望塔
    BZOJ4029 HEOI2015定价
    BZOJ1226 SDOI2009学校食堂
    网络流24题之魔术球问题
    网络流24题之最小路径覆盖问题
    【BZOJ1098】[POI2007]办公楼biu
    BZOJ3065 带插入区间K小值
  • 原文地址:https://www.cnblogs.com/leafcb/p/3688831.html
Copyright © 2011-2022 走看看