oracle恢復刪除的數據

分爲兩種方法:scn和時間戳兩種方法恢復。html

1、經過scn恢復刪除且已提交的數據數據庫

  一、得到當前數據庫的scn號ide

    select current_scn from v$database; (切換到sys用戶或system用戶查詢) spa

    查詢到的scn號爲:1499223orm

  二、查詢當前scn號以前的scnhtm

    select * from 表名 as of scn 1499220; (肯定刪除的數據是否存在,若是存在,則恢復數據;若是不是,則繼續縮小scn號)blog

  三、恢復刪除且已提交的數據get

    flashback table 表名 to scn 1499220;flash

2、經過時間恢復刪除且已提交的數據it

  一、查詢當前系統時間

    select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;

  二、查詢刪除數據的時間點的數據

    select * from 表名 as of timestamp to_timestamp('2013-05-29 15:29:00','yyyy-mm-dd hh24:mi:ss');  (若是不是,則繼續縮小範圍)

  三、恢復刪除且已提交的數據

    flashback table 表名 to timestamp to_timestamp('2013-05-29 15:29:00','yyyy-mm-dd hh24:mi:ss');

    注意:若是在執行上面的語句,出現錯誤。能夠嘗試執行 alter table 表名 enable row movement; //容許更改時間戳


j_0048.gif


轉載連接:http://www.cnblogs.com/kangxuebin/archive/2013/05/29/3106183.html

相關文章
相關標籤/搜索