Preparation 
  Connect to the desired database
    db2 connect to <dbname>
  Create the db2perf_quiet_drop utility stored procedure
    db2 -td@ -f db2perf_utils.db2
  Create the db2perf_plandiff stored procedures
    db2 -td@ -f db2perf_plandiff.db2
  Ensure the explain tables exist and are populated 
Use
  Connect to the desired database 
    db2 connect to <dbname>
  Call the stored procedure to compare all plans with matching SQL & matching patterns of requester, 
	schema, source name & section
    db2 call db2perf_plandiff( <requester>, <schema>, <source_name>, <section>)    # shortcut from v1.0
  or
    db2 call db2perf_plandiff( <exp_schema1>, <exp_schema2>, <requester>, <schema>, <source_name>, <section>, <all_or_diff>

  <exp_schema1> and <exp_schema2> default to the current schema (meaning that plandiff will search & compare
  plans from one set of tables.)   <all_or_diff> tells plandiff whether to report just plans which have changed,
  or all plans that were compared.   The v1.0 syntax defaults to all plans, and the newer syntax defaults to just
  plans that have changed.

  To compare explains from different databases, the explain tables must be exported and then re-imported
  into a single database for db2perf_plandiff to access.   For example, prior to a database migration,
  export the explain files which contain explain data for important SQL statements.

    db2perf_export_explain.ksh <dbname> <path to export to> [ <schema name of explain tables> ]

  This produces several .IXF files in the target path.

  These files are then re-imported into a DB2 database, either after migration, or perhaps into a different
  database altogether.  This process can be repeated to bring together explain data from different databases
  or environments.
     db2perf_import_explain.ksh <dbname> <path to import from> [ <new schema name of explain tables> ]

  Suppose explain tables have been brought together from before and after a migration from DB2 9.1 to DB2 9.5.
  These tables have been created in the schemas V91_EXP and V95_EXP.  To compare these, we would use

    db2perf_export_explain.ksh v91db /tmp/v91db_explains
    db2perf_import_explain.ksh v95db /tmp/v91db_explains v91
    db2 connect to v95db user v95adm using 
    db2 "call db2perf_plandiff( 'V91','V95ADM','%','%','%',0 ) "


For more information, see db2perf.pdf
