3

DB2で巨大な挿入クエリを試しました。INSERT INTO MY_TABLE_COPY(SELECT * FROM MY_TABLE);

その前に、私は以下を設定しました:

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 

助言がありますか?

4

2 に答える 2

3

LOGFILSIZ、LOGPRIMARY、およびLOGSECONDの最大値を使用しました。LOGFILSIZの最大値は、Windows、Linuxなどで異なる場合があります。ただし、非常に大きな数値を試すことができ、DBは最大値を通知します。私の場合は262144でした。

また、LOGPRIMARY + LOGSECOND <=256。それぞれに128を試しましたが、これは私の巨大なクエリで機能します。

于 2012-11-26T18:21:21.833 に答える
0

DB CFGパラメーターを使用して試行錯誤を実行する代わりに、これらのINSERTステートメントをコミット間隔を指定してストアード・プロシージャーに入れることができます。

詳細については、次の投稿を参照してください。これが役立つ場合があります。

https://prasadspande.wordpress.com/2014/06/06/plsql-ways-updatingdeleting-the-bulk-data-from-the-table/

ありがとう

于 2015-05-31T01:02:41.977 に答える