2012-11-26 2 views
3

DB2에서 거대한 삽입 쿼리를 시도했습니다. INSERT INTO MY_TABLE_COPY (SELECT * FROM MY_TABLE);DB2 로그 파일 제한, SQLCODE : -964

그 전에, 나는 다음과 설정 :

UPDATE DATABASE CONFIGURATION FOR MY_DB USING LOGFILSIZ 70000; 
UPDATE DATABASE CONFIGURATION FOR MY_DB USING LOGPRIMARY 50; 
UPDATE DATABASE CONFIGURATION FOR MY_DB USING LOGSECOND 2; 
db2stop force; 
db2start; 

을하고이 오류가있어 :

DB21034E The command was processed as an SQL statement because it was not a 
valid Command Line Processor command. During SQL processing it returned: 
SQL0964C The transaction log for the database is full. SQLSTATE=57011 

SQL0964C The transaction log for the database is full. 

Explanation: 

All space in the transaction log is being used. 

If a circular log with secondary log files is being used, an 
attempt has been made to allocate and use them. When the file 
system has no more space, secondary logs cannot be used. 

If an archive log is used, then the file system has not provided 
space to contain a new log file. 

The statement cannot be processed. 

User Response: 

Execute a COMMIT or ROLLBACK on receipt of this message (SQLCODE) 
or retry the operation. 

If the database is being updated by concurrent applications, 
retry the operation. Log space may be freed up when another 
application finishes a transaction. 

Issue more frequent commit operations. If your transactions are 
not committed, log space may be freed up when the transactions 
are committed. When designing an application, consider when to 
commit the update transactions to prevent a log full condition. 

If deadlocks are occurring, check for them more frequently. 
This can be done by decreasing the database configuration 
parameter DLCHKTIME. This will cause deadlocks to be detected 
and resolved sooner (by ROLLBACK) which will then free log 
space. 

If the condition occurs often, increase the database 
configuration parameter to allow a larger log file. A larger log 
file requires more space but reduces the need for applications to 
retry the operation. 

If installing the sample database, drop it and install the 
sample database again. 

sqlcode : -964 

sqlstate : 57011 

어떤 제안?

+1

왜 언로드 DB/2 유틸리티 프로그램을 사용하지 않는/당신의 테이블을로드? 유틸리티는 간단한 INSERT 문과 동일한 방식으로 로그를 사용하지 않습니다. UNLOAD/LOAD는 이런 종류의 일에 훨씬 효율적입니다. INSERT/SELECT 작업 도중 COMMITS를 실행할 수 없다는 것을 기억하십시오.이 작업은 모두 단일 작업 단위로 수행되어야하며 큰 테이블의 경우 로그를 과도하게 처리 할 수 ​​있습니다. – NealB

답변

2

LOGFILSIZ, LOGPRIMARY 및 LOGSECOND에 최대 값을 사용했습니다. LOGFILSIZ의 최대 값은 Windows, Linux 등에서 다를 수 있습니다. 그러나 매우 큰 숫자를 시도해 볼 수 있으며 DB는 최대 값을 알려줍니다. 내 경우에는 262144였습니다.

또한 LOGPRIMARY + LOGSECOND < = 256입니다. 각 128 개를 시도했는데 내 거대한 쿼리에서 작동합니다.

관련 문제