[Oracle]閃回FlashBack功能的使用

來源:互聯網
上載者:User

Flashback技術是從Oracle10g開始應用的一項技術,利用它可以查看資料庫過去某個時候的資料,或者把資料庫恢複到某個時刻的狀態,還可以恢複被誤刪除的表。下面用它恢複被刪除的表的應用。

首先,使用下面語句啟用資源回收筒的功能:
alter system set recyclebin=on

其次,建表並加入一條資料:
create table test_tb(id number);insert into test_tb(id) values('1');
接下來,用以下語句刪除這張表:
drop table test_tb;
此後,就可以使用以下語句查看被刪除的對象:
show recyclebin;
執行後,顯示以下內容:
ORIGINAL NAME    RECYCLEBIN NAME                OBJECT TYPE  DROP TIME
---------------- ------------------------------ ------------ -------------------
TEST_TB          BIN$qFK1/UoacDzgQwqZ9pVwPA==$0 TABLE        2011-07-18:06:06:38
採用以下語句即可恢複被刪除的表:
flashback table "BIN$qFK1/UoacDzgQwqZ9pVwPA==$0" to before drop;
在用以下語句看看恢複後的效果:
select * from test_tb;
輸出如下:
        ID
----------
         1
這說明被刪除的表已經恢複。

相關文章

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.