Oracle 閃回 flashback,oracleflashback

來源:互聯網
上載者:User

Oracle 閃回 flashback,oracleflashback
閃回:修複邏輯錯誤,從當前的點往回退
1.閃回有專門的閃回日誌,存放在FIA中,但是只有閃回資料庫會用到

2.如果做全資料庫的閃回,相當於一次不完全恢複



基於時間點的閃回
SQL> flashback table t_wh_prodlib to timestamp to_timestamp('2015-03-03 12:10:07', 'yyyy-mm-dd hh24:mi:ss');
將資料庫閃回到20150303 12:10:07

如果基於時間點的閃回報錯
ERROR at line 1:
ORA-08180: no snapshot found based on specified time

則使用基於時間段的閃回
SQL> flashback table t_wh_prodlib to timestamp systimestamp - interval '27' minute;
將資料庫閃回到27分鐘之前

上面兩個無論哪個報錯ERROR at line 1:

ORA-08189: cannot flashback the table because row movement is not enabled


則輸入以下指令
SQL> alter table t_wh_prodlib enable row movement;

然後在執行上面的閃回語句


====================

其他:
1、閃回刪除  delete
在10g之後,除了超級使用者刪除的時候先放到資源回收筒recyle-bin,同時還將名字改成bin$開頭
刪除一張表格之後再去查詢表格,就會看到以BIN$開頭的檔案
> show recyclebin;查看資源回收筒裡面的內容
> flashback table dodo before drop;閃回那張表

<1如果資源回收筒裡面有兩個相同的時候,會優先閃回後刪除的
<2如果閃回之前已經有一個同名的,則需要進行重新命名
<3如果刪除的時候不想進入資源回收筒,則可以加入參數truge

> purge user_recyclebin;       刪除資源回收筒裡使用者


2、閃回查詢  query
閃回查詢是從undo裡面扣出來的
> select * from t as of timestap to_char('2015-03-03 12:10:07','yyyy-mm-dd hh24:mi:ss');


3、閃回表    table
是從undo裡面扣出來的,這個SYS使用者無法使用
需要開啟行移動,閃回表到之間某個時間點需要
>  alter table t enable row movement;
>  flashback table t to timestap to_char('2015-03-03 12:10:07','yyyy-mm-dd hh24:mi:ss');


4、閃回資料庫  DB
注意:需要開啟這個功能,然後必須是在歸檔模式,還需要用到閃回日誌
如果是第一次設定地區閃回設定,必須先設定大小,再設定時間,必須是在mount狀態下去做
> show parameter recovery      查看大小位置
> show parameter target           查看閃回時間

> select FLASHBACK_ON FROM v$database
這個時候在flash下面的SID下面有個   建議FRA裡面就只留下這個
!!閃回的時候需要在mount下去操作
> flashback database  to timestap to_char('2015-03-03 12:10:07','yyyy-mm-dd hh24:mi:ss');


相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.