DB2 Explain plan doesn’t exists

Just a quick reminder:

If you start a new database where you want to genrate some execution-plans you might run into the following :

db2 => explain plan for select * from t1,t3 where t1.n1=t3.n1;
DB21034E  The command was processed as an SQL statement because it was not a 
valid Command Line Processor command.  During SQL processing it returned:
SQL0219N  The required Explain table "DB2INST1.EXPLAIN_INSTANCE" does not 
exist.  SQLSTATE=42704
db2 =>

Do not panic. This can easily be overcome by running sqllib/misc/EXPLAIN.DDL

[db2inst1@broccoli misc]$ db2 -tf EXPLAIN.DDL 

******* IMPORTANT ********** 

USAGE: db2 -tf EXPLAIN.DDL   

******* IMPORTANT ********** 


DB20000I  The UPDATE COMMAND OPTIONS command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

DB20000I  The SQL command completed successfully.

[db2inst1@broccoli misc]$ 

And then you need to bind the package:

[db2inst1@broccoli misc]$ db2 bind db2exfmt.bnd blocking all grant public

LINE    MESSAGES FOR db2exfmt.bnd
------  --------------------------------------------------------------------
        SQL0061W  The binder is in progress.
        SQL0091N  Binding was ended with "0" errors and "0" warnings.
[db2inst1@broccoli misc]$

And you can march on.

Leave a Reply

Your email address will not be published.