之前执行db2advis 的时候报了错:
The db2advis tool needs the explain tables and the advise tables to exist. Please create them
using the EXPLAIN.DDL script in the misc subdirectory of the sqllib directory. 解决方式:http://www-01.ibm.com/support/docview.wss?uid=swg21607022
1) Drop the explain and advise tables:
db2 connect to <dbname>;
db2 drop table EXPLAIN_INSTANCE;
db2 drop table EXPLAIN_STATEMENT;
db2 drop table EXPLAIN_ARGUMENT;
db2 drop table EXPLAIN_OBJECT;
db2 drop table EXPLAIN_OPERATOR;
db2 drop table EXPLAIN_PREDICATE;
db2 drop table EXPLAIN_STREAM;
db2 drop table EXPLAIN_DIAGNOSTIC;
db2 drop table EXPLAIN_DIAGNOSTIC_DATA;
db2 drop table ADVISE_INSTANCE;
db2 drop table ADVISE_INDEX;
db2 drop table ADVISE_WORKLOAD;
db2 drop table ADVISE_MQT;
db2 drop table ADVISE_PARTITION;
db2 drop table ADVISE_TABLE;
db2 drop table EXPLAIN_ACTUALS;
Note: On DB2 v10.1 the table OBJECT_METRICS was also included as part of the set of tables created by the EXPLAIN.DDL script and should be dropped as below.
db2 drop table OBJECT_METRICS;
2) Recreate them using the EXPLAIN.DDL script located in the directory $HOME/sqllib/misc: db2 -tvf EXPLAIN.DDL
3) Bind the db2advis packages below: db2advcatalog.bnd
db2advindex.bnd
db2advio.bnd
db2advis.bnd
db2advmdc.bnd
db2advmisc.bnd
db2advmqt.bnd
db2advsimulation.bnd
db2advworkload.bnd
These bind files are located under the Instance owner's home directory $HOME/sqllib/bnd.
To bind the files you can run the following command:
db2 bind <filename.bnd>
4) Rerun the db2advis
最后执行:db2advis -d dbname -i 1.sql -n schema -1 schema