最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

oracle 9i使用閃回查詢恢復(fù)數(shù)據(jù)庫(kù)誤刪問(wèn)題

 更新時(shí)間:2015年10月21日 10:04:44   投稿:mrr  
本篇文章給大家介紹在oracle 9i中使用閃回查詢恢復(fù)數(shù)據(jù)庫(kù)誤刪問(wèn)題,涉及到數(shù)據(jù)庫(kù)增刪改查的基本操作,對(duì)oracle數(shù)據(jù)庫(kù)閃回查詢感興趣的朋友可以一起學(xué)習(xí)下本篇文章

如果用戶誤刪/更新了數(shù)據(jù)后,作為用戶并沒(méi)有什么直接的方法來(lái)進(jìn)行恢復(fù),他們必須求助DBA來(lái)對(duì)數(shù)據(jù)庫(kù)進(jìn)行恢復(fù),到了Oracle9i,這一個(gè)難堪局面有所改善。Oracle 9i中提供了一項(xiàng)新的技術(shù)手段--閃回查詢,用戶使用閃回查詢可以及時(shí)取得誤操作前的數(shù)據(jù),并可以針對(duì)錯(cuò)誤進(jìn)行相應(yīng)的恢復(fù)措施,而這一切都無(wú)需DBA干預(yù)。

因?yàn)橐粫r(shí)手賤,生產(chǎn)上的數(shù)據(jù)被我給delete掉了。

用的是delete語(yǔ)句,然后很迅速的還給commit了

下面這兩個(gè)語(yǔ)句:

ALTER TABLE tablename ENABLE row movement ;
flashback table tablename to timestamp to_timestamp('2012-09-13 13:00:00','yyyy-mm-dd hh24:mi:ss');

------------------------------------------------------

記得大概是兩點(diǎn)半左右運(yùn)行的delete---commit;

具體執(zhí)行流程我們可從以下幾個(gè)示例圖中體會(huì);

1.原表記錄

 $ sqlplus eygle/eygle
SQL*Plus: Release 10.1.0.2.0 - Production on Wed Mar 30 08:52:04 2005
Copyright (c) 1982, 2004, Oracle.  All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL>select count(*) from t1;
  COUNT(*)
----------
    9318

2.誤刪除所有記錄

并且提交更改。

SQL>delete from t1;
9318 rows deleted.
SQL>commit;
Commit complete.
SQL>select count(*) from t1;
  COUNT(*)
----------
     0

3.獲得當(dāng)前SCN

如果能夠確切知道刪除之前SCN最好,如果不知道,可以進(jìn)行閃回查詢嘗試.

SQL>select dbms_flashback.get_system_change_number from dual;
GET_SYSTEM_CHANGE_NUMBER
------------------------
         10671006
SQL>select count(*) from t1 as of scn 10671000;
  COUNT(*)
----------
     0
SQL>select count(*) from t1 as of scn 10670000;
  COUNT(*)
----------
    9318

我們看到在SCN=10670000時(shí),數(shù)據(jù)都在。

4.恢復(fù)數(shù)據(jù).

SQL>insert into t1 select * from t1 as of scn 10670000;
9318 rows created.
SQL>commit;
Commit complete.
SQL>select count(*) from t1;
  COUNT(*)
----------
    9318

其它網(wǎng)友用的教程

進(jìn)行數(shù)據(jù)庫(kù)操作,delete后面一定要加where”。今天無(wú)意中在網(wǎng)上看到了關(guān)于oracle誤刪除數(shù)據(jù)恢復(fù)的一條信息,發(fā)現(xiàn)的確很好使,下面就我的測(cè)試向大家匯報(bào)下。

. select * from t_viradsl t     //查詢t_viradsl中所有的數(shù)據(jù),可以看到三條數(shù)據(jù)
 . delete t_viradsl           //刪除t_viradsl中所有的數(shù)據(jù),三條數(shù)據(jù)消失
 . select * from t_viradsl t     //無(wú)數(shù)據(jù)。
 . insert into t_viradsl select * from t_viradsl as of timestamp to_Date('-- ::', 'yyyy-mm-dd hh:mi:ss')       //已將誤刪除數(shù)據(jù)插入表中
 . select * from t_viradsl t     //又會(huì)看到三條數(shù)據(jù)。

我們來(lái)分析下第四步,注意這句:

select * from t_viradsl2 as of timestamp to_Date('2011-01-19 15:28:00', 'yyyy-mm-dd hh24:mi:ss')

什么意思呢, 找到t_viradsl2

在2011-01-19 15:28:00這個(gè)時(shí)間點(diǎn)的所有數(shù)據(jù),既然

找到了,你想怎么操作都可以了。

相關(guān)文章

最新評(píng)論

墨江| 宝应县| 垫江县| 新安县| 平利县| 高要市| 金门县| 罗平县| 平邑县| 全州县| 青阳县| 荥经县| 芜湖县| 修水县| 石河子市| 河西区| 乐安县| 伽师县| 平陆县| 岳阳县| 车致| 浦城县| 海城市| 林周县| 罗田县| 固始县| 曲靖市| 淳安县| 鄂州市| 永宁县| 广西| 邛崃市| 海门市| 大石桥市| 石屏县| 壤塘县| 阜康市| 杭锦旗| 海兴县| 锡林郭勒盟| 沅陵县|