https://blog.csdn.net/hijk139/article/details/21543127
回滾的速度快慢通過(guò)參數(shù)fast_start_parallel_rollback來(lái)實(shí)現(xiàn),此參數(shù)可以動(dòng)態(tài)調(diào)整
參數(shù)fast_start_parallel_rollback決定了回滾啟動(dòng)的并行次數(shù),在繁忙的系統(tǒng)或者IO性能較差的系統(tǒng),如果出現(xiàn)大量回滾操作,會(huì)顯著影響系統(tǒng)系統(tǒng),可以通過(guò)調(diào)整此參數(shù)來(lái)降低影響。官方文檔的定義如下:
FAST_START_PARALLEL_ROLLBACK specifies the degree of parallelism used when recovering terminated transactions. Terminated transactions are transactions that are active before a system failure. If a system fails when there are uncommitted parallel DML or DDL transactions, then you can speed up transaction recovery during startup by using this parameter.
Values:
FALSE : Parallel rollback is disabled
LOW : Limits the maximum degree of parallelism to 2 * CPU_COUNT
HIGH : Limits the maximum degree of parallelism to 4 * CPU_COUNT
If you change the value of this parameter, then transaction recovery will be stopped and restarted with the new implied degree of parallelism.
回滾過(guò)程中,回滾的進(jìn)度可以通過(guò)視圖V$FAST_START_TRANSACTIONS來(lái)確定
SQL> select usn, state, undoblocksdone, undoblockstotal, CPUTIME, pid,xid, rcvservers from v$fast_start_transactions;
USN STATE UNDOBLOCKSDONE UNDOBLOCKSTOTAL CPUTIME PID XID RCVSERVERS
---------- ---------------- -------------- --------------- ---------- ---------- ---------------- ----------
454 RECOVERED 110143 110143 210 01C600210027E0D9 1
468 RECOVERED 430 430 17 01D40000001F3A36 128
USN:事務(wù)對(duì)應(yīng)的undo段
STATE:事務(wù)的狀態(tài),可選的值為(BE RECOVERED, RECOVERED, or RECOVERING)
UNDOBLOCKSDONE:事物中已經(jīng)完成的undo塊
UNDOBLOCKSTOTAL:總的需要recovery的undo數(shù)據(jù)塊
CPUTIME:已經(jīng)回滾的時(shí)間,單位是秒
RCVSERVERS:回滾的并行進(jìn)程數(shù)
--補(bǔ)充,查詢回滾時(shí)間更好的腳本
SQL> select undoblockstotal "Total",
undoblocksdone "Done",
undoblockstotal - undoblocksdone "ToDo",
decode(cputime,
0,
'unknown',
to_char(sysdate + (((undoblockstotal - undoblocksdone) /
(undoblocksdone / cputime)) / 86400),
'yyyy-mm-dd hh34:mi:ss')) "Estimated time to complete",to_char(sysdate, 'yyyy-mm-dd hh34:mi:ss')
from v$fast_start_transactions;
Total MB Done ToDo Estimated time to complete TO_CHAR(SYSDATE,'YYYY-MM-DDHH24:MI:SS'
---------- ---------- ---------- -------------------------------------- --------------------------------------
36,767 36767 0 2014-03-19 16:59:19 2014-03-19 16:59:19
7,209 7209 0 2014-03-19 16:59:19 2014-03-19 16:59:19
3,428 3428 0 2014-03-19 16:59:19 2014-03-19 16:59:19
34,346 1604 32742 2014-03-19 17:25:31 2014-03-19 16:59:19
下面是一次大量wait for a undo record等待事件的處理過(guò)程
1,某用戶使用plsql執(zhí)行某 insert操作異常,導(dǎo)致表空間不斷增長(zhǎng),于是手工kill該回滾停掉,kill后大量wait for a undo record,大約100多個(gè)
2,查詢v$fast_start_transactions視圖,由于fast_start_parallel_rollback參數(shù)設(shè)置為HIGH,且cpu為32個(gè),因此并行進(jìn)程為
32×4=128個(gè)SQL> select usn, state, undoblocksdone, undoblockstotal, CPUTIME, pid,xid, rcvservers from v$fast_start_transactions;
USN STATE UNDOBLOCKSDONE UNDOBLOCKSTOTAL CPUTIME PID XID RCVSERVERS
---------- ---------------- -------------- --------------- ---------- ---------- ---------------- ----------
454 RECOVERING 26922 464160 103 3744 01C600210027E0D9 128 468 RECOVERED 430 430 17 01D40000001F3A36 128
SQL> SHOW parameter ROLLBACK
NAME TYPE VALUE
------------------------------------ -------------------------------- ------------------------------
fast_start_parallel_rollback string HIGH
SQL> show parameter cpu
NAME TYPE VALUE
------------------------------------ -------------------------------- ------------------------------
cpu_count integer 32
3,
由于估計(jì)還有103/(26922/464160)=30分鐘才能執(zhí)行完,為了降低對(duì)系統(tǒng)性能的影響,對(duì)相關(guān)表進(jìn)行了truncate(業(yè)務(wù)表中的數(shù)據(jù)不再需要)
SQL> truncate table user1.JT_t1_20140318;
4,truncate時(shí),短時(shí)間內(nèi)出現(xiàn)了row cache lock異常等待,大約幾十秒之后,恢復(fù)正常,truncat操作能結(jié)束undo回滾操作嗎?
5,其實(shí)為了減少undo的影響,可以通過(guò)設(shè)置fast_start_parallel_rollback,可以在線修改,立即生效
alter system set fast_start_parallel_rollback= FALSE;
分享名稱:參數(shù)fast_start_parallel_rollback調(diào)整oracle回滾的速度
URL地址:http://muchs.cn/article30/piohpo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站改版、品牌網(wǎng)站制作、網(wǎng)站營(yíng)銷、手機(jī)網(wǎng)站建設(shè)、外貿(mào)網(wǎng)站建設(shè)、網(wǎng)站維護(hù)
廣告
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源:
創(chuàng)新互聯(lián)