麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁(yè) > 數(shù)據(jù)庫(kù) > Oracle > 正文

最簡(jiǎn)單的Oracle數(shù)據(jù)恢復(fù) select as of使用方法

2024-08-29 13:58:42
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
這篇文章主要介紹了最簡(jiǎn)單的Oracle數(shù)據(jù)恢復(fù) select as of使用方法,需要的朋友可以參考下
 

You perform a Flashback Query by using a SELECT statementwith an AS OF clause.You use a flashback query to restrieve data as it existed at some time in the past.The query explicitly references a past time by menasof timestamp or SCN.It returns committed data that was current at that point intime.
通過(guò)執(zhí)行一個(gè)帶as of 子句的select語(yǔ)句進(jìn)行閃回查詢,可以閃回檢索過(guò)去某個(gè)時(shí)間存在的數(shù)據(jù),一個(gè)閃回查詢被用來(lái)重現(xiàn)過(guò)去存在過(guò)的數(shù)據(jù),這個(gè)查詢明確的引用了過(guò)去的一個(gè)時(shí)間段或SCN號(hào),閃回查詢返回的數(shù)據(jù)都是過(guò)去某時(shí)刻已經(jīng)提交的數(shù)據(jù)。

Potential uses of Flashback Query include:
可能使用到閃回查詢的地方:
⊙Recovering lost data or undoing incorrect,committed changes.For example,if you mistakenly delete or update rows,and then commit them,you can immediately undo the mistake.
恢復(fù)丟失的數(shù)據(jù)或撤銷已經(jīng)提交的錯(cuò)誤。例如如果你不小心刪除或更新了行,并且做了提交操作,你可以立刻撤銷這個(gè)錯(cuò)誤。
⊙Comparing current data with the corresponding data at some time in the past.For example,you might run a daily report that shows the change in data from yesterday.You can compare the individual rows of table data or find intersections or unions of sets of rows.
比較當(dāng)前數(shù)據(jù)和歷史數(shù)據(jù)的一致性。例如,你可能需要生成一份前一天數(shù)據(jù)更新的日?qǐng)?bào)告,你可以分別比較表的每一行或找到行的交集和并集。
⊙Checking the state of transactional data at a particular time.For example,you could verify the account balance of a certain day.
在某個(gè)特殊時(shí)間檢查事務(wù)型數(shù)據(jù)的狀態(tài)。例如,你可以在某一天驗(yàn)證賬戶收支。
⊙Simplifying the application design,by removing the need to store some kinds of temporal data.By using a Flashback Query, you can retrieve past data directly from the database.
移除某些因需求儲(chǔ)存的暫時(shí)數(shù)據(jù)以簡(jiǎn)化應(yīng)用設(shè)計(jì)。通過(guò)閃回查詢你可以從數(shù)據(jù)庫(kù)中直接獲取到過(guò)去的數(shù)據(jù)。
⊙Applying the packaged applications such as report generation tools to past data.
使用包裝應(yīng)用(例如報(bào)表生成工具)的歷史數(shù)據(jù)
⊙Providing self-service error correction for anapplication,thereby enabling users to undo and correct their errors.
為應(yīng)用提供自服務(wù)錯(cuò)誤更正,因此可以讓用戶撤銷或更正他們的錯(cuò)誤。
 
示例:
 
SQL> conn /as sysdba;
已連接。
SQL> set pagesize 200
SQL> select * from scott.dept;
 
    DEPTNO DNAME                        LOC
---------- ---------------------------- -------------------------
        10 ACCOUNTING                   NEW YORK
        20 RESEARCH                     DALLAS
        30 SALES                         CHICAGO
        40 OPERATIONS                   BOSTON
現(xiàn)在,我們來(lái)增加一條數(shù)據(jù),并提交:
 
SQL> insert into scott.dept values(50,'錯(cuò)誤數(shù)據(jù)','CHINA');
已創(chuàng)建 1 行。
 
SQL> select * from scott.dept;


    DEPTNO DNAME                        LOC
---------- ---------------------------- -------------------------
        10 ACCOUNTING               NEW YORK
        20 RESEARCH                 DALLAS
        30 SALES                         CHICAGO
        40 OPERATIONS               BOSTON
        50 錯(cuò)誤數(shù)據(jù)                     CHINA
 
SQL> commit;(2011-12-9 10:51:00)


提交完成。
正常情況下,由于已經(jīng)做了commit操作,所以rollback已經(jīng)無(wú)效了,要想得到2011-12-9 10:51:00之前的數(shù)據(jù),怎么辦?
使用timestamp時(shí)間點(diǎn)閃回:
SQL> select * from scott.dept as of timestamp to_timestamp('2011-12-09 10:00:00','yyyy-mm-dd hh24:mi:ss');
 
    DEPTNO DNAME                        LOC
---------- ---------------------------- -------------------------
        10  ACCOUNTING                   NEW YORK
        20  RESEARCH                      DALLAS
        30  SALES                         CHICAGO
        40  OPERATIONS                   BOSTON
閃回查詢,主要依靠表空間的undo數(shù)據(jù),如果想要追溯更久的數(shù)據(jù),就需要設(shè)置較大的undo_tablespaces大小和undo_retention。
 
如果想直接更新當(dāng)前的表到歷史的某個(gè)時(shí)間狀態(tài),可以直接使用flashback關(guān)鍵字:
 
 
SQL> alter table scott.dept enable row movement;


表已更改。
 
SQL> flashback table scott.dept to timestamp to_timestamp('2011-12-09 10:00:00','yyyy-mm-dd hh24:mi:ss');


閃回完成。
 
【注意】:
閃回不是萬(wàn)能的,當(dāng)一個(gè)表的數(shù)據(jù)較大或時(shí)間過(guò)長(zhǎng)時(shí),如果沒(méi)有設(shè)置較大的閃回空間和時(shí)間,閃回操作將會(huì)失敗,可能會(huì)出現(xiàn)以下錯(cuò)誤:

最簡(jiǎn)單的Oracle數(shù)據(jù)恢復(fù) select as of使用方法

最簡(jiǎn)單的Oracle數(shù)據(jù)恢復(fù) select as of使用方法



注:相關(guān)教程知識(shí)閱讀請(qǐng)移步到oracle教程頻道。
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 法国性xxx精品hd | 久久国产免费 | 久久综合一区 | 日日草夜夜操 | 369看片你懂的小视频在线观看 | 国产精品美女久久久免费 | 国产 一区 精品 | jizzjizzjizz少妇| 欧美77 | 国产精品亚洲yourport | 懂色粉嫩av久婷啪 | 精品国产一区二区三区四 | 欧美黄色试片 | 午夜久久久久 | 欧美日韩国产成人在线观看 | 欧美三级欧美成人高清www | 日本精品久久久一区二区三区 | 精品国产一区二区三区在线观看 | 亚洲成人免费影视 | 欧美性色生活片免费播放 | 久久久久久久.comav | 久久成人午夜视频 | 日本不卡中文字幕 | 国产毛片在线看 | 日韩精品网站在线观看 | 欧美xxxx精品另类 | 奶子吧naiziba.cc免费午夜片在线观看 | 中文字幕涩涩久久乱小说 | 精品一区二区三区在线视频 | 亚洲最新无码中文字幕久久 | 欧美成人精品一区二区 | 日本a在线观看 | 色中色激情影院 | chinesehd天美原创xxxx | 视频在线色 | 精品久久久91 | 欧美无限资源 | 亚洲福利视频52 | 成人羞羞网站入口 | 成av在线| 伊人二本二区 |