execute執行后
成都創新互聯公司是一家專業從事網站設計、做網站、網頁設計的品牌網絡公司。如今是成都地區具影響力的網站設計公司,作為專業的成都網站建設公司,成都創新互聯公司依托強大的技術實力、以及多年的網站運營經驗,為您提供專業的成都網站建設、營銷型網站建設及網站設計開發服務!
可以回滾
commit提交后
不可以回滾
其實oracle提交數據是分兩步操作的,第一步execute執行,第二步commit提交。對應的pl\sql也是要先點execute執行,執行后再點commit提交。
但是
commit提交后
可以用閃回查詢恢復原來的數據
因為oracle會將近期的數據保存到快照中
如:
select
*
from
table_1
as
of
timestamp
to_timestamp('20080606
20:00:00','yyyymmdd
hh24:mi:ss');
這里'20080606
20:00:00'就是你想恢復數據到哪個時間狀態
table_1是數據庫的表名
這樣查詢到的數據就是執行更新操作之前的數據
execute執行后
可以回滾
commit提交后
不可以回滾
其實Oracle提交數據是分兩步操作的,第一步execute執行,第二步commit提交。對應的PL\SQL也是要先點execute執行,執行后再點commit提交。
但是
commit提交后
可以用閃回查詢恢復原來的數據
因為oracle會將近期的數據保存到快照中
如:
SELECT
*
FROM
TABLE_1
AS
OF
TIMESTAMP
TO_TIMESTAMP('20080606
20:00:00','YYYYMMDD
HH24:MI:SS');
這里'20080606
20:00:00'就是你想恢復數據到哪個時間狀態
TABLE_1是數據庫的表名
這樣查詢到的數據就是執行更新操作之前的數據
1、首先在執行Update時,Oracle就地更新,如出現原block空間不足的情況,通過link的方式鏈接至新block上。
2、其次PG的Update,不是原地更新,而是保留原有數據,通過新增新的tuple保存新增數據,原有數據通過Vacuum機制清理。
3、最后Vacuum機制需要滿足MVCC的要求,在某些情況下,不會清理垃圾數據,在事務繁忙的時候導致會導致數據表空間不斷增長。
execute執行后 可以回滾
commit提交后 不可以回滾
其實Oracle提交數據是分兩步操作的,第一步execute執行,第二步commit提交。對應的PL\SQL也是要先點execute執行,執行后再點commit提交。
但是 commit提交后 可以用閃回查詢恢復原來的數據 因為oracle會將近期的數據保存到快照中 如:
SELECT * FROM TABLE_1 AS OF TIMESTAMP TO_TIMESTAMP('20080606 20:00:00','YYYYMMDD HH24:MI:SS');
這里'20080606 20:00:00'就是你想恢復數據到哪個時間狀態 TABLE_1是數據庫的表名 這樣查詢到的數據就是執行更新操作之前的數據
回滾段中保存的回滾數據有 個作用 一致讀和回滾 回滾段是由連續block組成的區間extent組成 回滾段有順序的循環的使用這些區間 當當前區間寫滿的時候 oracle移向下一個區間 如一個回滾段有 個區間A B C D;當區間C被寫滿的時候 oracle將寫區間D 而當D寫滿的時候 oracle將嘗試重新寫區間A 這樣循環的有順序的使用區間
事務必須將回滾信息寫到回滾段中 事務的當前新產生的回滾信息寫在該回滾段的位置叫做回滾段的head 而在該回滾段上最早發生的尚未提交的事務最早產生的回滾信息所在位置叫做回滾段的tail 當前區間寫滿的時候 oracle移動head到下一個區間
i時每個事務只能使用一個回滾段 Oracle會根據回滾段workload 平均將事務分配給各個回滾段 在回滾段使用上的一些規則
一個事務只能使用一個回滾段
多個事務可以共用一個區間 但Active的事務不能共用一個block
回滾段的current extent寫滿的時候 回滾段的Head不能夠移動到回滾段tail所在的區間
區間總是被有順序的循環的時候 當head移動的時候 不會跳躍區間 只能移動到下一個區間
如果head不能夠使用下一個區間(如tail在下一個區間) 將會分配一個新的區間extent 并將新區間extent插入到這個循環使用的extent圈中 這叫做回滾段的擴展
ORA snapshot too old主要是在一致讀和延遲塊清除delay block cleanout的時候產生
[參考]一致讀的步驟
Read the Data Block
Read the Row Header
Check the Lock Byte to determine whether theres an ITL entry
Read the ITL entry to determine the Transaction ID (Xid)
Read the Transaction Table using the Transaction ID If the transaction has been mitted and has a System Commit Number less than the querys System Change Number update the status of the block (block cleanout) and start over at step
第 步細分
IF 在Transaction Table 中根據Transaction ID 找到transaction
IF transaction 已經mit
IF query scnmit scn
則接受該塊 進行clean out 返回
ELSEIF query scn
則進行一致性讀 從第 步向后執行
ELSEIF transaction 沒有mit
也進行一致性讀 從第 步向后執行
ELSEIF 在Transaction Table 中沒有找到transaction(undo header中的transaction slot被覆蓋了 也說明事務已經提交 因為只有提交后所在的transaction slot才能被覆蓋 這樣query scn則去比較control scn 在該回滾段上control scn以前的transaction都已經被提交 也就是事務表中所能找到的最小的mit scn了)
IF query scn
則無法知道query scn和mit scn得大小關系 出現ORA 錯誤
IF query scncontrol scn
則query scn肯定mit scn
則接受該塊 進行clean out 并將block 中ITL標記上 U 表示 upper bound mit 并返回
Read the last undo block (Uba)
Compare the block transaction ID with the transaction table transaction ID If the Transaction ID in the undo block doesnt equal the Transaction ID from the Transaction Table then issue ORA Snapshot Too Old 表示回滾段中回滾信息被覆蓋 無法為一致讀提供必需的before image
If the Transaction IDs are identical make a copy of the data block in memory Starting with the head undo entry apply the changes to the copied data block
If the tail undo entry (the actual first undo entry in the chain or the last in the chain going backwards!) indicates another data block address read the indicated undo block into memory and repeat steps and until the undo entries dont contain a value for the data block address
When theres no previous data block address the transaction has been pletely undone
If the undo entry contains:
a a pointer to a previous transaction undo block address read the Transaction ID in the previous transaction undo block header and read the appropriate Transaction Table entry Return to step
b an ITL record restore the ITL record to the data block Return to step
出現 的時候 首先判斷是哪個原因導致 可以設置event 如果因為transaction slot被覆蓋導致 則增加回滾段數目 如果因為回滾信息被覆蓋 則增加回滾大大小 錯誤比較復雜 通常需要考慮很多問題
event = trace name processstate forever level
lishixinzhi/Article/program/Oracle/201311/17091
網站題目:oracle怎么回滾數據 oracle回滾是什么意思
網站地址:http://m.kartarina.com/article42/hgjihc.html
成都網站建設公司_創新互聯,為您提供網站改版、網站收錄、網站制作、品牌網站設計、網站設計、關鍵詞優化
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯