最近單位的ORACLE資料庫運行不穩定,通過查詢oracle的alert日誌,發現如下報錯內容:
Thread 1 cannot allocate new log, sequence 108922
Checkpoint not complete
Current log# 1 seq# 108921 mem# 0: +DATADG/apts/onlinelog/group_1.262.788509509
Current log# 1 seq# 108921 mem# 1: +ARCHDG/apts/onlinelog/group_1.257.788509511
Thread 1 advanced to log sequence 108922 (LGWR switch)
Current log# 2 seq# 108922 mem# 0: +DATADG/apts/onlinelog/group_2.261.788509511
Current log# 2 seq# 108922 mem# 1: +ARCHDG/apts/onlinelog/group_2.258.788509511
Sat Apr 27 10:25:38 2013
Thread 1 cannot allocate new log, sequence 108923
Checkpoint not complete
Current log# 2 seq# 108922 mem# 0: +DATADG/apts/onlinelog/group_2.261.788509511
Current log# 2 seq# 108922 mem# 1: +ARCHDG/apts/onlinelog/group_2.258.788509511
Thread 1 advanced to log sequence 108923 (LGWR switch)
Current log# 1 seq# 108923 mem# 0: +DATADG/apts/onlinelog/group_1.262.788509509
Current log# 1 seq# 108923 mem# 1: +ARCHDG/apts/onlinelog/group_1.257.788509511
初步判定是ORACLE聯機重做日誌太小,白天生產庫太忙,日誌切換頻繁造成,由於安裝ORACLE時,REDO是按預設設定安裝預設設定是每執行個體2組聯機日誌,每組兩個成員,每個記錄檔50M),未對聯機重做日誌進行修改,後期由於業務量大幅增加,原有的設定以無法滿足現有需要,需對聯機記錄檔進行擴容。
思路如下:
1、聯機重做日誌的三種狀態
1)、ACTIVE:活動狀態
2)、INACTIVE:未被使用狀態
3)、CURRENT:目前狀態使用狀態)
2、計劃對每執行個體2組聯機日誌擴充為每執行個體4組聯機日誌
3、計劃對每個記錄檔由50M擴充為200M
注意事項:
1、刪除聯機日誌時,必須保證每個執行個體有兩個記錄檔
2、增加聯機日誌時,指令碼中要比單一實例增加thread參數來標識某個執行個體
3、主要使用的動態效能檢視有v$log和v$logfile
4、聯機日誌在刪除時必須是INACTIVE狀態
5、需在夜晚業務量下降時實施
實施步驟如下:
1、用tail -f alert*.ora命令進一步證實了上述判斷,發現聯機重做日誌切換時間為3分鐘左右,日誌再次切換時,記錄檔狀態為ACTIVE,並非是INACTIVE未使用狀態)
2、查詢日誌組狀態
select * from v$log order by thread#,group#;
查詢日誌各成員資訊
select * from v$logfile;
3、必要檔案備份
1)、備份初始化參數檔案
create pfile='/home/oracle/bak_pfile_20130427_add_redolog.ora' from spfile;
(2)、備份控制檔案
alter database backup controlfile to /home/oracle/bak_controlfile_20130427_add_redolog.ora';
4、增加聯機記錄檔
alter database add logfile thread 1 group 5('+DATADG/apts/onlinelog/group5_1','+ARCHDG/apts/onlinelog/group5_2') size 200M;
alter database add logfile thread 2 group 6('+DATADG/apts/onlinelog/group6_1','+ARCHDG/apts/onlinelog/group6_2') size 200M;
alter database add logfile thread 1 group 7('+DATADG/apts/onlinelog/group7_1','+ARCHDG/apts/onlinelog/group7_2') size 200M;
alter database add logfile thread 2 group 8('+DATADG/apts/onlinelog/group8_1','+ARCHDG/apts/onlinelog/group8_2') size 200M;
5、查看增加的檔案資訊
select * from v$log order by thread#,group#;
查詢日誌各成員資訊
select * from v$logfile;
6、將聯機記錄檔切換到新增加的檔案上使用,使1、2、3、4組聯機記錄檔狀態變為INACTIVE
alter system switch logfile;
alter system checkpoint;
7、刪除1、2、3、4組聯機記錄檔
alter database drop logfile group 1;
alter database drop logfile group 2;
alter database drop logfile group 3;
alter database drop logfile group 4;
這裡發現一個問題,如果聯機記錄檔時自己建立的,有可能在使用刪除命令後,在磁碟陣列中的檔案並沒有被刪除,從而導致空間浪費及重建同名組是報錯,
650) this.width=650;" border="0" src="http://www.bkjia.com/uploads/allimg/131228/2252394504-0.jpg" alt="" />
這時需要用ORACLE內建的ASM維護命令asmcmd進入到磁碟陣列中去刪除響應的檔案即可,
650) this.width=650;" border="0" src="http://www.bkjia.com/uploads/allimg/131228/225239A56-1.jpg" alt="" />
8、重建聯機日誌1,2,3,4組並分配200M的空間
alter database add logfile thread 1 group 1('+DATADG/apts/onlinelog/group1_1','+ARCHDG/apts/onlinelog/group1_2') size 200M;
alter database add logfile thread 2 group 2('+DATADG/apts/onlinelog/group2_1','+ARCHDG/apts/onlinelog/group2_2') size 200M;
alter database add logfile thread 1 group 3('+DATADG/apts/onlinelog/group3_1','+ARCHDG/apts/onlinelog/group3_2') size 200M;
alter database add logfile thread 2 group 4('+DATADG/apts/onlinelog/group4_1','+ARCHDG/apts/onlinelog/group4_2') size 200M;
650) this.width=650;" border="0" src="http://www.bkjia.com/uploads/allimg/131228/22523951H-2.jpg" alt="" />
9、使用命令切換記錄檔,看是否正常
alter system switch logfile;
select * from v$log order by thread#,group#;
select * from v$logfile;
alter system checkpoint;
650) this.width=650;" border="0" src="http://www.bkjia.com/uploads/allimg/131228/2252395492-3.jpg" alt="" />
650) this.width=650;" border="0" src="http://www.bkjia.com/uploads/allimg/131228/22523aG4-4.jpg" alt="" />
650) this.width=650;" border="0" src="http://www.bkjia.com/uploads/allimg/131228/2252391337-5.jpg" alt="" />
操作完畢。
本文出自 “沒落的星辰” 部落格,請務必保留此出處http://260878993.blog.51cto.com/4153537/1188778