【bdump】bdump目录下产生大量cdmp_2014xxx和死锁信息
一、环境: AIX 6100-07+10.2.0.4.3 RAC 二、问题描述: bdump目录下产生大量cdmp_2014xxx目录,目录的数量到达上万个直至将bdump目录所在的根目录撑满,进而数据库异常。每个cdmp_2014xxx目录大概在4M左右。 alert.log日志记录如下: Fri Mar 21 17:38:25 2
一、环境: AIX 6100-07+10.2.0.4.3 RAC二、问题描述: bdump目录下产生大量cdmp_2014xxx目录,目录的数量到达上万个直至将bdump目录所在的根目录撑满,进而数据库异常。每个cdmp_2014xxx目录大概在4M左右。
alert.log日志记录如下:
Fri Mar 21 17:38:25 2014 Thread 1 advanced to log sequence 17162 (LGWR switch) Current log# 2 seq# 17162 mem# 0: /dev/rredo1_2a_256m Current log# 2 seq# 17162 mem# 1: /dev/rredo1_2b_256m Fri Mar 21 17:41:00 2014 Trace dumping is performing id=[cdmp_20140321173953] Fri Mar 21 17:41:18 2014 Trace dumping is performing id=[cdmp_20140321174010] Fri Mar 21 17:41:34 2014 Trace dumping is performing id=[cdmp_20140321174027] Fri Mar 21 17:41:52 2014 Trace dumping is performing id=[cdmp_20140321174044] Fri Mar 21 17:42:08 2014 Trace dumping is performing id=[cdmp_20140321174101] Fri Mar 21 17:43:00 2014 Trace dumping is performing id=[cdmp_20140321174153] Fri Mar 21 17:43:17 2014 Trace dumping is performing id=[cdmp_20140321174209] Fri Mar 21 17:43:33 2014 Trace dumping is performing id=[cdmp_20140321174226] Fri Mar 21 17:43:49 2014 Trace dumping is performing id=[cdmp_20140321174243] Fri Mar 21 17:44:06 2014 Trace dumping is performing id=[cdmp_20140321174258] Fri Mar 21 17:44:26 2014 Thread 1 advanced to log sequence 17163 (LGWR switch) Current log# 3 seq# 17163 mem# 0: /dev/rredo1_3a_256m Current log# 3 seq# 17163 mem# 1: /dev/rredo1_3b_256m Fri Mar 21 17:45:00 2014 Trace dumping is performing id=[cdmp_20140321174353] Fri Mar 21 17:45:17 2014 Trace dumping is performing id=[cdmp_20140321174410] Fri Mar 21 17:45:35 2014 Trace dumping is performing id=[cdmp_20140321174427] Fri Mar 21 17:45:52 2014 Trace dumping is performing id=[cdmp_20140321174444]
三、问题解决 1. 参数设置 1)在bdump目录下产生大量日志时,首先应考虑是否开启了event。可以查看参数event show parameter event 2)如果开启了event,可以利用如下脚本查询event level set serveroutput on
declare
event_level number;
begin
for i in 10000..10999 loop
dbms_system.read_ev(i,event_level);
if (event_level > 0) then
dbms_output.put_line('Event '||to_char(i)||' set at level '||
to_char(event_level));
end if;
end loop;
end;
/ 在我的环境中,并没有开启任何event。所以排除这个原因。
2. BUG造成 The issue matching to the following bug which is closed base bug 5470095. This is resolved in 10.2.0.4. Looks like your version is also 10.2.0.4.
++Bug 5388252 : TRACE DUMPING IS PERFORMING ID=[CDMP_ ... MESSAGES IN ALERT LOG 该BUG已经在10.2.0.4中被修复,我的数据库版本为10.2.0.4.3所以排除这个原因。
3. 外键上没有索引在二、中描述了alert.log中存在大量Global Enqueue Service Deadlock detected.,这也是可能产生cdmp的一个原因。而频繁的出现死锁,很可能的一个原因就是因为大量外键上没有创建索引,导致主表更新时外键更新的表需要被锁。可以通过如下脚本查询没有索引的外键信息。 外键上索引和锁的关系:http://blog.csdn.net/ballontt/article/details/22157759
1)创建存放相关信息的表 CREATE TABLE foreign_key_exceptions (owner VARCHAR2(30), constraint_name VARCHAR2(30), status VARCHAR2(8), table_name VARCHAR2(30), foreign_key VARCHAR2(2000));
2)执行如下脚本 set heading off select 'Write output to table FOREIGN_KEY_EXCEPTIONS created in this schema Y/N:' from dual; select upper(nvl('&&WRITE_TO_TABLE_Y_N','N')) from dual; select 'Schema Name:',upper('&&SCHEMA') from dual; set echo off SET SERVEROUTPUT ON FORMAT WRAPPED declare WRITE_TO_TABLE_Y_N VARCHAR2(100); from_schema VARCHAR2(30); to_schema VARCHAR2(30); pl_cons_column VARCHAR2(30); pl_foreign_key VARCHAR2(2000); pl_ind_column VARCHAR2(30); pl_ind_name VARCHAR2(30); pl_ind_owner VARCHAR2(30); pl_index VARCHAR2(2000); f_owner VARCHAR2(30); f_table_name VARCHAR2(30); /* Cursor c1 simply selects each Foreign Key constraint from the DBA View DBA_CONSTRAINTS. No need at this stage to limit the query to 'ENABLED' constraints, we'll simply report the status in the log file. For each constraint, we'll construct the column list, using cursor c2, which combine to form the foreign key constraint returned in cursor c1 */ CURSOR c1 IS SELECT constraint_name,owner,table_name,status,r_owner,r_constraint_name FROM dba_constraints WHERE constraint_type='R' AND owner between upper(from_schema) and upper(to_schema) ORDER BY owner; CURSOR c2(cons_name VARCHAR2,cons_owner VARCHAR2) IS SELECT column_name FROM dba_cons_columns WHERE constraint_name=cons_name AND owner=cons_owner ORDER BY dba_cons_columns.position; /* For each returned constraint, we need to fins a matching index, firstly we fetch each index name with c3, and then construct the index columns with cursor c4 in their correct order until we find a match with the foreign key constraint */ CURSOR c3(ind_table varchar2,tab_owner varchar2) IS SELECT index_name, owner FROM dba_indexes WHERE table_name=ind_table AND table_owner=tab_owner; CURSOR c4(ind_name varchar2,ind_owner varchar2) IS SELECT column_name FROM dba_ind_columns WHERE INDEX_NAME=ind_name AND INDEX_OWNER=ind_owner ORDER BY dba_ind_columns.column_position; CURSOR c5(for_owner varchar2,for_constraint varchar2) IS SELECT owner,table_name FROM dba_constraints WHERE OWNER=for_owner AND CONSTRAINT_NAME=for_constraint; BEGIN WRITE_TO_TABLE_Y_N:='&&WRITE_TO_TABLE_Y_N'; from_schema:= '&&SCHEMA'; IF from_schema = 'ALL' THEN begin from_schema := 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'; to_schema := 'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ'; end; ELSE to_schema := from_schema; END IF; DBMS_OUTPUT.PUT_LINE(' Missing Indexes for Foreign Keys'); DBMS_OUTPUT.PUT_LINE(' --------------------------------'); FOR c1_rec in c1 LOOP /* looping for each foreign key constraint */ pl_cons_column := NULL; pl_foreign_key := NULL; pl_ind_column := NULL; pl_ind_name := NULL; pl_ind_owner := NULL; pl_index := NULL; f_owner:=NULL; F_table_name:=NULL; OPEN c5(c1_rec.r_owner,c1_rec.r_constraint_name); FETCH c5 INTO f_owner,f_table_name; CLOSE c5; OPEN c2(c1_rec.constraint_name,c1_rec.owner); FETCH c2 INTO pl_cons_column; pl_foreign_key := pl_cons_column; -- the first col in the foreign key > LOOP /* constructing the foreign key columns, delimiting each column with a ',' */ FETCH c2 into pl_cons_column; EXIT WHEN c2%NOTFOUND; pl_foreign_key := pl_foreign_key||','||pl_cons_column; END LOOP constraint_names; /* we now have a table and foreign key definition for which we need an index */ CLOSE c2; OPEN c3(c1_rec.table_name,c1_rec.owner); > LOOP /* for each index found for this table */ FETCH c3 INTO pl_ind_name,pl_ind_owner; EXIT WHEN c3%NOTFOUND; OPEN c4(pl_ind_name,pl_ind_owner); FETCH c4 INTO pl_ind_column; pl_index := pl_ind_column; -- the first column in the index IF pl_index=pl_foreign_key THEN -- check this doesn't already match CLOSE c4; -- the foreign key EXIT index_name; END IF; IF pl_index = SUBSTR(pl_foreign_key,1,LENGTH(pl_index)) THEN /* we only need construct the whole index while it's leading edge still matches the constrained foreign key columns */ > LOOP /* construct the whole index in the same way as the foreign key */ FETCH c4 INTO pl_ind_column; EXIT WHEN c4%NOTFOUND; pl_index:= pl_index||','||pl_ind_column; /* we do not need to continue with the index name loop if we already have a match on the foreign key */ IF pl_index=pl_foreign_key THEN CLOSE c4; EXIT index_name; END IF; /* if the leading edge differs - go back around the loop to see if there is a subsequent index that matches */ IF pl_index != SUBSTR(pl_foreign_key,1,LENGTH(pl_index)) THEN EXIT index_columns; END IF; END LOOP index_columns; END IF; CLOSE c4; END LOOP index_name; CLOSE c3; IF pl_index != pl_foreign_key OR pl_index IS NULL THEN /* Alternative means of output having first set serveroutput using: SET SERVEROUTPUT ON SIZE n where n is between 2000 and 1000000 to set the output limit. DBMS_OUTPUT.PUT_LINE(c1_rec.owner||'.'||c1_rec.constraint_name); */ IF WRITE_TO_TABLE_Y_N ='Y' or WRITE_TO_TABLE_Y_N ='y' THEN EXECUTE IMMEDIATE 'INSERT INTO foreign_key_exceptions VALUES (c1_rec.owner,c1_rec.constraint_name,c1_rec.status, c1_rec.table_name,pl_foreign_key)'; END IF; dbms_output.put_line('Constraint '||c1_rec.constraint_name||'('||c1_rec.status||') : Changing data in table '||f_owner||'.'||f_table_name||' will lock table '||c1_rec.owner||'.'||c1_rec.table_name); dbms_output.put_line('Create index for table '||c1_rec.owner||'.'||c1_rec.table_name||' on columns '||pl_foreign_key); dbms_output.put_line('************************'); COMMIT; END IF; END LOOP; END; / undefine WRITE_TO_TABLE_Y_N undefine SCHEMA 在执行脚本时,需要交互地输入1)中新建的表名,以及你想查看哪个schema下的信息如果输入ALL表示查看所有用户信息。根据得到的信息,在相应的外键上创建索引,只需要在application's schema下的对象上创建索引,系统默认用户(sys,syste,sysman)下的对象不需要创建索引。

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

如何處理C++開發中的死鎖問題死鎖是多執行緒程式設計中常見的問題之一,尤其是在使用C++進行開發時更容易遇到。當多個執行緒互相等待對方持有的資源時,就可能發生死鎖問題。如果不及時處理,死鎖不僅會導致程式卡死,還會影響系統的效能和穩定性。因此,學習如何處理C++開發中的死鎖問題是非常重要的。一、理解死鎖的原因要解決死鎖問題,首先要了解死鎖產生的原因。死鎖通常發生在以

多執行緒死鎖預防機制包括:1.鎖順序;2.測試並設定。偵測機制包括:1.超時;2.死鎖偵測器。文章舉例共享銀行帳戶,透過鎖定順序避免死鎖,為轉帳函數先請求轉出帳戶再請求轉入帳戶的鎖。

Go中死鎖與飢餓:預防與解決死鎖:協程相互等待而無法進行的操作,使用runtime.SetBlockProfileRate函數偵測。預防死鎖:使用細粒度加鎖、逾時、無鎖定資料結構,防止死鎖。飢餓:協程持續無法取得資源,使用公平鎖防止飢餓。公平鎖實踐:創建公平鎖並等待協程嘗試獲取鎖的時間最長的優先獲取鎖。

死鎖是一種並發程式設計中的常見錯誤,發生在多個執行緒等待彼此持有的鎖時。可以透過使用調試器檢測死鎖,分析線程活動並識別涉及的線程和鎖,從而解決死鎖。解決死鎖的方法包括避免循環依賴、使用死鎖偵測器和使用逾時。在實踐中,透過確保執行緒以相同的順序取得鎖或使用遞歸鎖或條件變數可以避免死鎖。

解決Go語言開發中的死鎖問題的方法Go語言是一種開源的靜態類型編譯型語言,被廣泛應用於並發程式設計。然而,由於Go語言的並發模型的特性,開發者在編寫並發程式時常常會遇到死鎖問題。本文將介紹一些解決Go語言開發中死鎖問題的方法。首先,我們需要了解何為死鎖。死鎖是指多個並發任務因互相等待對方釋放資源而無法繼續執行的情況。在Go語言中,死鎖問題通常是由於對資源的競爭或

在C++中,使用互斥函數可以解決多執行緒並發程式設計中的死鎖問題。具體步驟如下:建立一個互斥量;當執行緒需要存取共享變數時,獲得互斥;修改共享變數;釋放互斥。這樣可以確保任何時刻只有一個執行緒存取共享變量,有效防止死鎖。

如何解決Go語言中的死鎖問題? Go語言具有並發程式設計的特性,可以透過使用goroutine和channel來實現並發操作。然而,在並發程式設計中,死鎖是一個常見的問題。當goroutine之間相互依賴彼此的資源,並且在存取這些資源時產生了循環依賴關係,就可能導致死鎖的發生。本文將介紹如何解決Go語言中的死鎖問題,並提供具體的程式碼範例。首先,讓我們來了解一下什麼是

死鎖死鎖是指多個執行緒相互等待資源,從而形成一個循環,最終導致所有執行緒都阻塞。在python中,死鎖通常發生在對多個鎖或互斥量以錯誤順序進行鎖定時。範例:importthreading#兩個執行緒共用兩個鎖定lock1=threading.Lock()lock2=threading.Lock()defthread1_func():lock1.acquire()lock2.acquire()#做一些操作lock2.release()lock1. release()defthread2_func():loc
