DB2数据库的事务日志已满。SQLSTATE=57011

Posted 奔跑的金鱼

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DB2数据库的事务日志已满。SQLSTATE=57011相关的知识,希望对你有一定的参考价值。

问题描述

image

在使用数据库的时候报错如上图,我们先使用db2 get db cfg for sample查看相关配置参数,其中sample为数据库名称

C:\\Users\\Thinkpad>db2 get db cfg for sample

       数据库 sample 的数据库配置

数据库配置发行版级别                                    = 0x1400
数据库发行版级别                                        = 0x1400

数据库地域                                              = CN
数据库代码页                                            = 1208
数据库代码集                                            = UTF-8
数据库国家/地区代码                                     = 86
数据库整理顺序                                          = IDENTITY
备用整理顺序                              (ALT_COLLATE) =
数字兼容性                                              = OFF
Varchar2 兼容性                                         = OFF
日期兼容性                                              = OFF
数据库页大小                                            = 8192

语句集中器                                  (STMT_CONC) = OFF

对此数据库的发现支持                      (DISCOVER_DB) = ENABLE

限制访问                                                = NO
缺省查询优化类                           (DFT_QUERYOPT) = 5
并行度                                     (DFT_DEGREE) = 1
在算术异常时继续                      (DFT_SQLMATHWARN) = NO
缺省刷新有效期                        (DFT_REFRESH_AGE) = 0
缺省维护的选项(DFT_MTTB_TYPES)的表类型                = SYSTEM
保留的高频值的数目                     (NUM_FREQVALUES) = 10
保留的分位点数目                        (NUM_QUANTILES) = 20

十进制浮点舍入方式                    (DECFLT_ROUNDING) = ROUND_HALF_EVEN

十进制运算方式                         (DEC_ARITHMETIC) =

备份暂挂                                                = NO

已将所有已落实的事务写入磁盘                            = NO
前滚暂挂                                                = NO
复原暂挂                                                = NO

升级暂挂                                         = NO

启用的多页文件分配                                      = YES

恢复状态的日志保留                                      = NO
日志记录状态的用户出口                                  = NO

自调整内存                            (SELF_TUNING_MEM) = OFF
数据库共享内存大小 (4KB)              (DATABASE_MEMORY) = AUTOMATIC(76032)
数据库内存阈值                          (DB_MEM_THRESH) = 100
锁定列表的最大存储量 (4KB)                    (LOCKLIST) = 4096
每个应用程序的锁定百分比列表                 (MAXLOCKS) = 22
程序包高速缓存大小 (4KB)                   (PCKCACHESZ) = (MAXAPPLS*8)
共享排序的排序堆域值 (4KB)             (SHEAPTHRES_SHR) = 5000
排序列表堆 (4KB)                             (SORTHEAP) = 256

数据库堆 (4KB)                                 (DBHEAP) = AUTOMATIC(600)
目录高速缓存大小 (4KB)                (CATALOGCACHE_SZ) = (MAXAPPLS*5)
日志缓冲区大小 (4KB)                          (LOGBUFSZ) = 256
实用程序堆大小 (4KB)                     (UTIL_HEAP_SZ) = AUTOMATIC(5000)
SQL 语句堆 (4KB)                             (STMTHEAP) = AUTOMATIC(8192)
缺省应用程序堆 (4KB)                       (APPLHEAPSZ) = AUTOMATIC(256)
应用程序内存大小 (4KB)                 (APPL_MEMORY) = AUTOMATIC(40000)
统计信息堆大小 (4KB)                     (STAT_HEAP_SZ) = AUTOMATIC(4384)

检查死锁的时间间隔(毫秒)                  (DLCHKTIME) = 10000
锁定超时(秒)                             (LOCKTIMEOUT) = -1

更改的页阈值                           (CHNGPGS_THRESH) = 60
异步页清除程序的数目                   (NUM_IOCLEANERS) = AUTOMATIC(2)
I/O 服务器的数目                        (NUM_iosERVERS) = AUTOMATIC(12)
顺序检测标志                                (SEQDETECT) = YES
缺省预取大小(页)                    (DFT_PREFETCH_SZ) = AUTOMATIC

跟踪修改的页数                               (TRACKMOD) = NO

容器的缺省数目                                          = 1
缺省表空间扩展数据块大小(页)            (DFT_EXTENT_SZ) = 32

最大活动应用程序数                           (MAXAPPLS) = AUTOMATIC(40)
活动应用程序的平均数目                      (AVG_APPLS) = AUTOMATIC(1)
每个应用程序的最大打开数据库文件数           (MAXFILOP) = 65535

日志文件大小 (4KB)                          (LOGFILSIZ) = 1000
主日志文件的数目                           (LOGPRIMARY) = 3
辅助日志文件的数目                          (LOGSECOND) = 10

已更改的至日志文件的路径                   (NEWLOGPATH) =
日志文件路径                                            = C:\\DB2\\NODE0000\\SQL00001\\LOGSTREAM0000\\
溢出日志路径                          (OVERFLOWLOGPATH) =
镜像日志路径                            (MIRRORLOGPATH) =
首个活动日志文件                                        =
磁盘上已满的块日志                    (BLK_LOG_DSK_FUL) = NO
非记录块操作                          (BLOCKNONLOGGED) = NO
事务使用的最大主日志空间的百分比        (MAX_LOG)= 0
1 个活动 UOW 的活动日志文件的数目        (NUM_LOG_SPAN) = 0

软检查点前回收的日志文件的百分比              (SOFTMAX) = 0
LBP 中最旧页面的目标       (PAGE_AGE_TRGT_MCR) = 240

HADR 数据库角色                                          = STANDARD
HADR 本地主机名                        (HADR_LOCAL_HOST) =
HADR 本地服务名称                       (HADR_LOCAL_SVC) =
HADR 远程主机名                       (HADR_REMOTE_HOST) =
HADR 远程服务名称                      (HADR_REMOTE_SVC) =
远程服务器的 HADR 实例名              (HADR_REMOTE_INST) =
HADR 超时值                               (HADR_TIMEOUT) = 120
HADR 目标列表                        (HADR_TARGET_LIST) =
HADR 日志写同步方式                      (HADR_SYNCMODE) = NEARSYNC
HADR 假脱机日志数据限制 (4KB)        (HADR_SPOOL_LIMIT) = AUTOMATIC(0)
HADR 日志重放延迟(秒)     (HADR_REPLAY_DELAY) = 0
HADR 对等窗口持续时间(秒)           (HADR_PEER_WINDOW) = 0

第一个日志归档方法                        (LOGARCHMETH1) = OFF
logarchmeth1 的归档压缩   (LOGARCHCOMPR1) = OFF
logarchmeth1 的选项                        (LOGARCHOPT1) =
第二个日志归档方法                        (LOGARCHMETH2) = OFF
logarchmeth2 的归档压缩   (LOGARCHCOMPR2) = OFF
logarchmeth2 的选项                        (LOGARCHOPT2) =
故障转移日志归档路径                     (FAILARCHPATH) =
错误时重试日志归档次数                   (NUMARCHRETRY) = 5
日志归档重试延迟(秒)                 (ARCHRETRYDELAY) = 20
供应商选项                                  (VENDOROPT) =

启用的自动重新启动                        (AUTORESTART) = ON
索引重新创建时间和重做索引构建               (INDEXREC) = SYSTEM (RESTART)
在索引构建期间记录页                    (LOGINDEXBUILD) = OFF
loadrec 会话的缺省数目                (DFT_LOADREC_SES) = 1
要保留的数据库备份的数目               (NUM_DB_BACKUPS) = 12
恢复历史记录保留时间(天数)          (REC_HIS_RETENTN) = 366
自动删除恢复对象                     (AUTO_DEL_REC_OBJ) = OFF

TSM 管理类                              (TSM_MGMTCLASS) =
TSM 节点名                               (TSM_NODENAME) =
TSM 所有者                                  (TSM_OWNER) =
TSM 密码                                 (TSM_PASSWORD) =

自动维护                                   (AUTO_MAINT) = ON
   自动数据库备份                       (AUTO_DB_BACKUP) = OFF
   自动表维护                           (AUTO_TBL_MAINT) = ON
     自动 runstats                       (AUTO_RUNSTATS) = ON
       实时统计信息                    (AUTO_STMT_STATS) = ON
       统计视图                   (AUTO_STATS_VIEWS) = OFF
       自动采样                (AUTO_SAMPLING) = ON
     自动重组                               (AUTO_REORG) = OFF

自动重新验证                               (AUTO_REVAL) = DEFERRED

当前已落实                                   (CUR_COMMIT) = ON
带有 DECIMAL 输入的 CHAR 输出         (DEC_TO_CHAR_FMT) = NEW
启用 XML 字符操作                      (ENABLE_XMLCHAR) = YES
监视器收集设置
请求度量值                            (MON_REQ_METRICS) = BASE
活动度量值                            (MON_ACT_METRICS) = BASE
对象度量值                            (MON_OBJ_METRICS) = EXTENDED
例程数据                                 (MON_RTN_DATA) = NONE
   例程可执行文件列表                 (MON_RTN_EXECLIST) = OFF
工作单元事件数                           (MON_UOW_DATA) = NONE
   带软件包列表的 UOW 事件             (MON_UOW_PKGLIST) = OFF
   带可执行文件列表的 UOW 事件        (MON_UOW_EXECLIST) = OFF
锁定超时事件数                        (MON_LOCKTIMEOUT) = NONE
死锁事件数                               (MON_DEADLOCK) = WITHOUT_HIST
锁定等待事件数                           (MON_LOCKWAIT) = NONE
锁定等待事件阈值                        (MON_LW_THRESH) = 5000000
软件包列表条目数目                     (MON_PKGLIST_SZ) = 32
锁定事件通知级别                      (MON_LCK_MSG_LVL) = 1

SMTP 服务器                               (SMTP_SERVER) =
SQL 条件编译标志                          (SQL_CCFLAGS) =
部分实际值设置                         SECTION_ACTUALS) = NONE
连接过程                                 (CONNECT_PROC) =
调整临时 SYSTEM_TIME 时间段        (SYSTIME_PERIOD_ADJ) = NO
日志 DDL 语句                           (LOG_DDL_STMTS) = NO
日志应用程序信息                        (LOG_APPL_INFO) = NO
新模式的缺省数据捕获                  (DFT_SCHEMAS_DCC) = NO
对 EXTBL_LOCATION 的严格 I/O             (EXTBL_STRICT_IO) = NO
外部表的允许路径                       (EXTBL_LOCATION) = C:
缺省表组织                              (DFT_TABLE_ORG) = ROW
缺省字符串单元                           (STRING_UNITS) = SYSTEM
本地字符串映射                          (NCHAR_MAPPING) = CHAR_CU32
数据库处于写入暂挂状态                                  = NO
扩展行大小支持                        (EXTENDED_ROW_SZ) = ENABLE
Backup 的加密库                 (ENCRLIB) =
Backup 的加密选项                (ENCROPTS) =

WLM 收集时间间隔(分钟)              (WLM_COLLECT_INT) = 0
每个 CPU 核心的目标代理程序负载    (WLM_AGENT_LOAD_TRGT) = AUTOMATIC(12)
已启用 WLM 许可控制      (WLM_ADMISSION_CTRL) = NO
已分配的 CPU 资源份额       (WLM_CPU_SHARES) = 1000
CPU 共享行为(硬/软)     (WLM_CPU_SHARE_MODE) = HARD
最大允许 CPU 使用率 (%)   (WLM_CPU_LIMIT) = 0
已加密数据库                                      = NO
过程化语言堆栈跟踪        (PL_STACK_TRACE) = NONE
HADR SSL 证书标签             (HADR_SSL_LABEL) =

 

解决方法

C:\\Users\\Thinkpad>db2 update db cfg for sample using LOGFILSIZ 8096
DB20000I  UPDATE DATABASE CONFIGURATION 命令成功完成。

C:\\Users\\Thinkpad>db2 update db cfg for sample using LOGPRIMARY 20                                                                                      
DB20000I  UPDATE DATABASE CONFIGURATION 命令成功完成。

C:\\Users\\Thinkpad>db2 update db cfg for sample using LOGSECOND 15
DB20000I  UPDATE DATABASE CONFIGURATION 命令成功完成。

 

设置完毕后,重启数据库参数即可生效;

特别说明:

①调整的顺序,为减少对应用的影响,建议先从logsecond参数着手,因为logsecond是按需分配,当不需要的时候DB2会考虑回收,不会造成空间浪费,而且
logsecond参数修改会立即生效,不需要断开连接,不会对业务造成中断影响logprimary+logsecond参数的值不超过255,如果增加了logsecond仍然不能
解决问题,可以考虑修改logpriimary和logfilsiz大小,但是这两个参数设置后需要重启数据库才生效

②总事务日志容量大小=(LOGPRIMARY+LOGSECOND)*LOGFILSIZ*4k

 

以上是关于DB2数据库的事务日志已满。SQLSTATE=57011的主要内容,如果未能解决你的问题,请参考以下文章

db2怎么删除数据库的事务日志

DB2中的正确更新语句,以避免事务日志已满

数据库 'DJABC' 的日志已满.请备份该数据库的事务日志以释放一些日志空间.

DB2 SQL 错误(SQLCODE:-964,SQLSTATE:57011)处理方法

SQL Server事务日志被填满的原因是啥

MSSQL SQLSTATE=42000 数据库的日志文件已满