Thread 1 cannot allocate new log(添加logfile文件)

现象:
查看alert日志,报如下信息:
Thread 1 advanced to log sequence 55505 (LGWR switch)
Current log# 1 seq# 55505 mem# 0: /u02/oradata/RKMES/redo11.dbf
Current log# 1 seq# 55505 mem# 1: /u03/oradata/RKMES/redo12.dbf
Wed Dec 1 15:22:32 2010
Thread 1 cannot allocate new log, sequence 55506
Checkpoint not complete
Current log# 1 seq# 55505 mem# 0: /u02/oradata/RKMES/redo11.dbf
Current log# 1 seq# 55505 mem# 1: /u03/oradata/RKMES/redo12.dbf

所以log日志处于active状态:
SQL> Select * From v$log;

    GROUP#    THREAD# SEQUENCE#      BYTES    MEMBERS ARCHIVED STATUS           FIRST_CHANGE# FIRST_TIME
---------- ---------- ---------- ---------- ---------- -------- ---------------- ------------- -----------
         1          1      55515 104857600          2 YES      ACTIVE         5359590265891 2010-12-1 1
         2          1      55509 104857600          2 YES      ACTIVE         5359590235181 2010-12-1 1
         3          1      55510 104857600          2 YES      ACTIVE         5359590235950 2010-12-1 1
         4          1      55511 104857600          2 YES      ACTIVE         5359590239936 2010-12-1 1
         5          1      55512 104857600          2 YES      ACTIVE         5359590254143 2010-12-1 1
         6          1      55516 104857600          2 NO       CURRENT        5359590270035 2010-12-1 1
         7          1      55507 104857600          2 YES      ACTIVE         5359590233426 2010-12-1 1
         8          1      55513 104857600          2 YES      ACTIVE         5359590258200 2010-12-1 1
         9          1      55514 104857600          2 YES      ACTIVE         5359590261923 2010-12-1 1
        10          1      55508 104857600          2 YES      ACTIVE         5359590234273 2010-12-1 1

原因:
当在大量更新事务操作时,在自动进行alter system switch logfile时,在线重做数据无法即时写入到磁盘datafile,导致新的日志无法去循环使用redo log 文件

解决:
1、增加LOGFILE的个数或增大LOGFILE大小(先增加比较大的logfile文件,再删除原先小的logfile文件)
方法1(手动指定文件名):
--添加日志组单个logfile文件的方法
Alter Database Logfile 'E:\ORACLE\ORADATA\INFRADB\REDO11.LOG' size 200m;

--添加日志组的多个logfile文件的方法


Alter Database Add Logfile Group 6 ('E:\ORACLE\ORADATA\INFRADB\REDO06.LOG','E:\ORACLE\ORADATA\INFRADB\REDO06_2.LOG') size 200m,
                            Group 7 ('E:\ORACLE\ORADATA\INFRADB\REDO07.LOG','E:\ORACLE\ORADATA\INFRADB\REDO07_2.LOG') size 200m;
                            
方法1(自动指定文件名):
--首先做设置DB_CREATE_ONLINE_LOG_DEST_1参数
alter system set DB_CREATE_ONLINE_LOG_DEST_1 = 'E:\ORACLE\ORADATA1\INFRADB\';
alter system set DB_CREATE_ONLINE_LOG_DEST_2 = 'E:\ORACLE\ORADATA2\INFRADB\';

--再执行下面的使用自动日志组
ALTER DATABASE ADD Logfile ;

--查看
SQL> Select * From v$logfile;

    GROUP# STATUS TYPE    MEMBER                                                                      
---------- ------- ------- ------------------------------------------------------------------------
         1         ONLINE E:\ORACLE\ORADATA\INFRADB\REDO01.LOG                                    
         2         ONLINE E:\ORACLE\ORADATA\INFRADB\REDO02.LOG                                    
         3         ONLINE E:\ORACLE\ORADATA\INFRADB\REDO03.LOG                                    
         4         ONLINE E:\ORACLE\ORADATA\INFRADB\REDO04.LOG                                     
         5         ONLINE E:\ORACLE\ORADATA\INFRADB\REDO06.LOG                                     
         6         ONLINE E:\ORACLE\ORADATA1\INFRADB\INFRADB\ONLINELOG\O1_MF_6_6HD17H0X_.LOG        
         6         ONLINE E:\ORACLE\ORADATA2\INFRADB\INFRADB\ONLINELOG\O1_MF_6_6HD17H0X_.LOG 
         
6 rows selected

--删除logfile文件,这样只是逻辑上删除,还需要去系统目录下把物理文件手动删除
ALTER DATABASE DROP LOGFILE GROUP 6;

2、增加设置DB_WRITER_PROCESSES参数值
alter system set DB_WRITER_PROCESSES = 3 scope=spfile;
--需要重启数据库生效

你可能感兴趣的:(Thread 1 cannot allocate new log(添加logfile文件))