oracle提交後如何回滾

2021-07-10 05:55:42 字數 805 閱讀 4332

execute執行後 可以回滾

commit提交後 閃回恢復原來的資料

其實oracle提交資料是分兩步操作的,第一步execute執行,第二步commit提交。對應的pl\sql也是要先點execute執行,執行後再點commit提交。

但是 commit提交後 可以用閃回查詢恢復原來的資料 因為oracle會將近期的資料儲存到快照中 如:

select * from tab as of timestamp to_timestamp('20130506 20:00:00','yyyymmdd hh24:mi:ss');

這裡'20130506 20:00:00'就是你想恢復資料到哪個時間狀態 tab是資料庫的表名 這樣查詢到的資料就是執行更新操作之前的資料 

create table tab_bak as select * from tab as of timestamp to_timestamp('20130506 20:00:00','yyyymmdd hh24:mi:ss');

這樣就把這個時間段的資料放到了 tab_bak表中了。

再把表重新命名 即可:alter table tab_bak rename to tab;

查詢表的所屬使用者

select owner from dba_tables where table_name=upper('表名');

建立乙個和另乙個表結構相同的空表

create table  newtable as select * from oldtable where 1=0;

如果不加where條件,建立的新錶和舊表字段和資料都一樣啦,相當於複製過來了。

Git錯誤提交後該如何回滾操作?

git專案的儲存主要分為四部分 工作區 暫存區 本地倉庫 遠端倉庫 整個過程如下 乾貨來咯!現有如下提交記錄 git log commit 119f493775ac878c24c37bebda316aa73a355003 head master author bccoco date tue sep ...

oracle提交之後怎麼回滾 已解決

查詢該時間段 這個表的狀態 這個時間前的表資料,不含操作錯的資料,例如 這個時間之前新增了乙個資料,並修改曹成所有的資料都改變 select from 表名 as oftimestamp to timestamp 2020 07 20 11 07 00 yyyy mm dd hh24 mi ss 開...

oracle資料回滾

當我們修改了表的資料並且提交了事務後,想回滾資料怎麼辦?先根據sql執行歷史確定資料回滾時間點 select sql text,last load time from v sql where sql text like update order by last load time desc 再將資料...