fast_start_parallel_rollback和並行rollback
資料庫abort-restart或事務被異常終止時,SMON需要回滾未提交的事務,如果事務過大會導致SMON消耗過多CPU甚至crash;
fast_start_parallel_rollback用於控制SMON恢復操作的並行度
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
監控指令碼
1
instance重啟前可查詢V$TRANSACTION.USED_UBLK估算rollback時間,重啟後可執行如下查詢
set linesize 100
alter session set NLS_DATE_FORMAT='DD-MON-YYYY HH24:MI:SS';
select usn, state, undoblockstotal "Total", undoblocksdone "Done", undoblockstotal-undoblocksdone "ToDo",
decode(cputime,0,'unknown',sysdate+(((undoblockstotal-undoblocksdone) / (undoblocksdone / cputime)) / 86400)) "Estimated time to complete"
from v$fast_start_transactions;
某些情況下此檢視不起作用,此時可查詢內部表
select ktuxeusn, to_char(sysdate,'DD-MON-YYYY HH24:MI:SS') "Time", ktuxesiz, ktuxesta
from x$ktuxe
where ktuxecfl = 'DEAD';
2
檢視dead transaction的大小
select ktuxeusn USN, ktuxeslt Slot, ktuxesqn Seq, ktuxesta State, ktuxesiz Undo
from x$ktuxe
where ktuxesta <> 'INACTIVE'
and ktuxecfl like '%DEAD%'
order by ktuxesiz asc;
===========
ktuxeusn – Undo Segment Number
ktuxeslt – Slot number
ktuxesqn – Sequence
ktuxesta – State
ktuxesiz – Undo Blocks Remaining
ktuxecfl – Flag
===========
USN SLOT SEQ STATE UNDO
------- ---------- ------- ---------- ----------
9 9 335 ACTIVE 10337
3
檢視包含dead transaction的undo segment
select useg.segment_name, useg.segment_id, useg.tablespace_name, useg.status
from dba_rollback_segs useg
where useg.segment_id in (select unique ktuxeusn
from x$ktuxe
where ktuxesta <> 'INACTIVE'
and ktuxecfl like '%DEAD%');
SEGMENT_NAME SEGMENT_ID TABLESPACE_NAME STATUS
-------------------- ----------------- --------------------------- ------------
_SYSSMU9$ 9 UNDOTBS1 ONLINE
4
估算dead transaction剩餘處理時間
select usn, state, undoblockstotal "Total", undoblocksdone "Done", undoblockstotal-undoblocksdone "ToDo",
decode(cputime,0,'unknown',sysdate+(((undoblockstotal-undoblocksdone) / (undoblocksdone / cputime)) / 86400)) "Estimated time to complete"
from v$fast_start_transactions;
USN STATE Total Done ToDo Estimated time to Complete
-------- ---------------- -------- -------- -------- ---------------------------------
5 RECOVERING 16207 14693 1514 11-may-2012 08:05:40
4 RECOVERED 7453 7453 0 11-may-2012 08:05:16
9 RECOVERED 10337 10337 0 11-may-2012 08:05:16
5
檢視涉及到的session
select decode(px.qcinst_id,NULL,username,' - '||lower(substr(s.program,length(s.program)-4,4) ) ) "Username",
decode(px.qcinst_id,NULL, 'QC', '(Slave)') "QC/Slave" ,
to_char( px.server_set) "Slave Set",
to_char(s.sid) "SID",
decode(px.qcinst_id, NULL ,to_char(s.sid) ,px.qcsid) "QC SID",
px.req_degree "Requested DOP",
px.degree "Actual DOP"
from gv$px_session px, gv$session s
where px.sid=s.sid (+)
and px.serial#=s.serial#
order by 5 , 1 desc ;
ORA User QC/Slav Slave Set SID QC SID Requested DOP Actual DOP
---------- ----------- ---------- ------ -------- ------------------- -----------------
QC 159 159
- p007 (Slave) 1 137 159 8 8
- p006 (Slave) 1 138 159 8 8
- p005 (Slave) 1 135 159 8 8
- p004 (Slave) 1 132 159 8 8
- p003 (Slave) 1 136 159 8 8
- p002 (Slave) 1 130 159 8 8
- p001 (Slave) 1 133 159 8 8
- p000 (Slave) 1 145 159 8 8
禁用並行恢復
並行恢復有時不見得更快,PQ之間的互動開銷可能抵過並行帶來的便利
select * from v$fast_start_servers;
如果只有一條記錄state=recovering其餘全為idle,則可禁止並行恢復,此操作可線上進行,但oracle不推薦在沒有官方support下使用10513事件
1
暫停SMON的事務清除
SQL> oradebug setorapid 'SMON's Oracle PID';
SQL> oradebug event 10513 trace name context forever, level 2
2
kill所有相關子程式
select SPID from V$PROCESS where PID in (select PID from V$FAST_START_SERVERS);
kill -9 n
3
重設fast_start_parallel_rollback引數
alter system set fast_start_parallel_rollback=false;
4
恢復SMON
SQL> oradebug setorapid 'SMON's Oracle PID';
SQL> oradebug event 10513 trace name context off;
How to Disable Parallel Transaction Recovery When Parallel Txn Recovery is Active [ID 238507.1]
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15480802/viewspace-763084/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 引數FAST_START_PARALLEL_ROLLBACKASTParallel
- 引數FAST_START_PARALLEL_ROLLBACK(ZT)ASTParallel
- 關於fast_start_parallel_rollback引數ASTParallel
- fast_start_parallel_rollback引數的一點測試ASTParallel
- fast_start_parallel_rollback與v$fast_start_servers和v$fast_start_transactionsASTParallelServer
- 等待事件wait for a undo record 與 fast_start_parallel_rollback引數事件AIASTParallel
- 引數fast_start_parallel_rollback調整oracle回滾的速度ASTParallelOracle
- 資料庫異常緩慢的解決 - FAST_START_PARALLEL_ROLLBACK資料庫ASTParallel
- 資料庫異常緩慢的解決 - FAST_START_PARALLEL_ROLLBACK[轉帖]資料庫ASTParallel
- Oracle 回滾(ROLLBACK)和撤銷(UNDO)Oracle
- 直接載入和並行-02並行
- 表和索引並行查詢索引並行
- 架構之:併發和並行架構並行
- 非同步和並行的區別非同步並行
- 深入理解併發和並行並行
- [Oracle Script] Rollback Segment UsageOracle
- rollback相關知識
- ♻️同步和非同步;並行和併發;阻塞和非阻塞非同步並行
- 併發程式設計-8.並行資料結構和並行Linq程式設計並行資料結構
- Oracle並行操作——並行DML操作Oracle並行
- 理解和使用SQL Server中的並行SQLServer並行
- oracle的鎖和並行機制薦Oracle並行
- 直接載入和並行記載-01並行
- 並行和非並行在不通場景中的效能差異並行
- 並行並行
- 關於COMMIT和ROLLBACK語句的使用注意事項MIT
- 並行執行並行
- 5天玩轉C#並行和多執行緒程式設計 —— 第二天 並行集合和PLinqC#並行執行緒程式設計
- C#並行,多執行緒程式設計並行集合和PLINQ的例項講解並行執行緒程式設計
- Oracle並行操作——從序列到並行Oracle並行
- parallel rollback引數總結Parallel
- SMON故障造成的parallel rollbackParallel
- Java多執行緒--併發和並行的區別Java執行緒並行
- Storm系列(四)並行度和流分組ORM並行
- Oracle並行操作——並行查詢(Parallel Query)Oracle並行Parallel
- LLM並行訓練5-MoE並行並行
- 鎖:innodb_lock_wait_timeout和 innodb_rollback_on_timeout?AI
- 並行概念並行