SAP 报SNAP_NO_NEW_ENTY错误【DB2 LOGSECOND参数】
1、在AI的指导下,备份并删除sapprd.snap
db2=>create table sapqas.snap_bak_20250101 as(select * from sapqas.snap)with data;DB21034E Thecommandwas processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0964C The transaction logforthe database is full.SQLSTATE=57011db2=>delete from sapprd.snap DB21034E Thecommandwas processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0964C The transaction logforthe database is full.SQLSTATE=57011db2=>db2=>truncate table sapprd.snap immediate DB21034E Thecommandwas processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0964C The transaction logforthe database is full.SQLSTATE=57011db2=>rollback DB20000I The SQLcommandcompleted successfully. db2=>truncate table sapprd.snap immediate DB21034E Thecommandwas processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0964C The transaction logforthe database is full.SQLSTATE=57011db2=>ALTER TABLE sapprd.snap ACTIVATE NOT LOGGED INITIALLY WITH EMPTY TABLE DB21034E Thecommandwas processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0964C The transaction logforthe database is full.SQLSTATE=57011db2=>selectcount(*)from sapprd.snap1-----------103241record(s)selected.AI回答:太好了!只有 10324 行,数据量非常小!
日志满根本不是因为这张表大,而是数据库日志卡住了,我马上用最轻量、绝对不占日志的方法帮你解决!
先把SAP停用,
erpprdci:prdadm53>stopsap Checking db Database Database is running ------------------------------------------- stopping the SAP instance DVEBMGS01 Shutdown-Log is written to /home/prdadm/stopsap_DVEBMGS01.log ------------------------------------------- /usr/sap/PRD/DVEBMGS01/exe/sapcontrol-protNI_HTTP-nr01-functionStop Instance onhosterpprdci stopped Waitingforcleanup of resources......................erpprdci:prdadm54>startsap再停处理DB2
erpprddb:db2prd54>db2 force applications all DB20000I The FORCE APPLICATIONcommandcompleted successfully. DB21024I Thiscommandis asynchronous and may not be effective immediately. erpprddb:db2prd56>db2 get db cfgforprd|greplog Number of primary log files(LOGPRIMARY)=60Number of secondary log files(LOGSECOND)=0查官方文档
Ibm官方说明: Too many objects have been loaded into the library server and
the transaction to delete rows in the library server transaction
tracking table is overfilling the DB2® UDB transaction logs.Workaround:
- Stop the migrator process.
- Stop all the DB2 UDB applications. The DB2 UDB command to stop all the applications is: db2 force applications all
- Change the number of secondary log files in the DB2 UDB database configuration to a greater number such as 100 (default is 20).
- To see the database configuration settings, enter the following command in a DB2 UDB command window: db2 get db cfg
- To update the number of secondary log files to 100, enter the following: db2 command db2 update dbm cfg using LOGSECOND=100
- Start the migrator process. The error message should now not be appearing in the library server log, and the transaction to delete
rows in the library server transaction tracking table should be
successful.
Number of secondary log files (LOGSECOND) = 0
这个默认是20个。按官方文档先改成100,处理后,再恢复。
erpprddb:db2prd65>db2 update db cfgforprd using logsecond100DB20000I The UPDATE DATABASE CONFIGURATIONcommandcompleted successfully. erpprddb:db2prd66>db2 delete from sapprd.snap DB20000I The SQLcommandcompleted successfully. erpprddb:db2prd67>db2 update db cfgforprd using logsecond30DB20000I The UPDATE DATABASE CONFIGURATIONcommandcompleted successfully. erpprddb:db2prd68>db2 commit DB20000I The SQLcommandcompleted successfully.恢复SAP端
erpprdci:prdadm54>startsap Checking db Database Database is running ------------------------------------------- Starting Startup Agent sapstartsrv OK Instance Service onhosterpprdci started ------------------------------------------- starting SAP Instance DVEBMGS01 Startup-Log is written to /home/prdadm/startsap_DVEBMGS01.log ------------------------------------------- /usr/sap/PRD/DVEBMGS01/exe/sapcontrol-protNI_HTTP-nr01-functionStart Instance onhosterpprdci started erpprdci:prdadm55你刚才做的最正确的步骤(教科书级别)
临时把日志调大 logsecond 100 → 让删除能跑
执行 delete from sapprd.snap → 成功删除
把日志改回安全值 logsecond 50 → 不影响系统
验证 count = 0 → 确认清空
