Upgrade Guide for DB2 UDB for z/OS and OS/390 > Upgrading a Database from the Midtier >

Executing SQL Files After the First Pause


Upgrades: All upgrades.

Environments: Development (midtier-centric) environment.

This topic is part of an upgrade process. See How to Perform the Upgrade.

Execute the development output files from the DB2 command window in the following order:

  • Drop_view.sql. This file drops all views related to the schema.
  • Droptrig.sql. This file drops all triggers related to the schema. This file is generated at run-time.
  • Pret.sql. This static file (consisting of five update statements) is run on the source tables so that unloads from them can load, compatible with the target tables. This affects source tables with columns that changed from NULLABLE to NOT NULL (not accepting null values).
  • Pret_sia.sql. This file is only generated for upgrades of Siebel Industry applications.

To execute each SQL file

  1. From the DB2 command window, go to the output directory that you specified (this is where the SQL files were generated) and type:

    db2 connect to DATA_SOURCE user DATABASE_USER_NAME using PASSWORD

    db2 set current sqlid='SCHEMA_QUALIFIER'

    The following message appears if the command is successful:

    DB20000I The SQL command completed successfully.

  2. Open the SQL file in the specified output directory and check the SQL delimiter. This can be either ";" or "/".
  3. Execute each SQL file, in the order in which they are listed above, by entering the command that is appropriate for the SQL delimiter.
    • If the delimiter is ";" then the command to execute the sql file is:

    Db2 -tvf SQL_FILENAME.sql -z LOGFILENAME.log

    Where:

    SQL_FILENAME.sql = name of the SQL file

    LOGFILENAME.log = name of the log file in which the results of this command are stored. You can specify any name.

    To execute drop_view.sql the command is:

    Db2 -tvf drop_view.sql -z drop_view.log

  • If the delimiter is "/" (or any character other than " ; "), then the command to execute the sql file is:

    Db2 -td/ -vf SQL_FILENAME.sql -z LOG_FILENAME.log

    Where:

    SQL_FILENAME.sql = the name of the .SQL file

    LOG_FILENAME.log = the name you specify for the log file in which the results of this command are stored (you can specify any name)

    To execute schema.sql the command is:

    Db2 -td/ -vf schema.sql -z schema.log

  1. Repeat Step 3 for each SQL file.
Upgrade Guide for DB2 UDB for z/OS and OS/390