DB2 Server for VSE & VM: Control Center Operations Guide for VM


Chapter 30. Table Reorganization Tool


Overview

The Table Reorganization and Redefinition tool of Control Center provides a means to reorganize, migrate, backup, and redefine tables within databases. This function provides you with improved control and flexibility to manage database objects for better performance and adaptability to changing needs.

The Table Reorganization and Redefinition tool can be executed in command mode (see Appendix G, Command Mode Interface) and is more commonly referred to by its command name, SQLTABLE.

SQLTABLE differs from the System Administration tools of Control Center because it executes as a database application, rather than as a function within the database virtual machine. SQLTABLE therefore normally executes on the user's virtual machine and only requires that you have needed authority within the target database, rather than Control Center authority.

The database authorities necessary to use SQLTABLE differ depending on which SQLTABLE function is executed. Users with INSERT and DELETE authority to a table can perform the DATAUNLOAD and DATALOAD functions on that table. The DDL capture required for the full table reorganization or redefinition function of SQLTABLE (see Figure 191, Selection Options 2, 3, or 4) will need DBA authority within the target database.

Before You Begin

The following comments apply to a full table reorganization and not to several of the other options available. Refer to the DB2 Server for VSE & VM Database Administration manual for a thorough understanding of the database TABLE reorganization process.

SQLTABLE should be used during non-peak hours to prevent locking contention with other users of the database. Due to the intensive updating of the database system catalogs, use of this tool is prone to lock contention during heavy multiple user sessions. To avoid catalog contention, do not run more than one SQLTABLE job against different tables simultaneously within a single database.

Installations that want to schedule reorganizations and maintenance jobs should implement a separate Control Center support machine to provide the scheduling capability without impacting the responsibilities of the primary Control Center service machine. SQLTABLE jobs should not be scheduled to execute on the managing Control Center service machine, since all automated operations functions with all databases will be disabled while the maintenance functions execute. Although SQLTABLE can be executed in batch mode with any scheduling product, a separate Control Center support machine will allow these jobs to be scheduled easily from the Control Center panel interface.

Who Can Use the Table Tool

Use of this tool requires Control Center database Administration-level or greater authorization.

How the SQLTABLE Tool Works

Processing Options

The following is a summary of the various SQLTABLE processing options:

Processing Flow

When SQLTABLE is invoked, the following steps will be performed:

  1. The target database is linked using DBINIT CONTROL file information.
  2. Communication is establish with the database (SQLINIT).
  3. User authority is verified.
  4. Availability of the specified new table, DBSPACE, and database is verified.
  5. An EXEC is created for recovery purposes.
  6. All system catalog information pertaining to the specified table is gathered and corresponding SQL statements are created within the SQLDBSU file:
    1. Table create statements
    2. Table dataload statements
    3. Table comments
    4. Column comments
    5. Referential integrity constraints
    6. Unique column definitions
    7. Index create statements
    8. Table column grants
    9. Table grants
    10. View creates/grants/comments/labels
    11. Access Module unload/reload statements
  7. If required, a temporary disk is defined and formatted.
  8. Table data is DATAUNLOADed to the specified disk or tape.
  9. If the PAUSE option was specified, execution ends at this point; otherwise, processing continues.
  10. The SQLDBSU command file is executed under SQLDBSU.
  11. The temporary disk, if used, is detached.
  12. Any invalidated access modules are reprepped.

Files Created

Each file created by SQLTABLE will have a filename that is created from the specified target table name. If the table name has any special characters (non-alphanumeric), they will be removed. If the table name is longer than eight characters, then it will be truncated to eight. The basic files created are:

"tablename EXEC"
Used to complete an interrupted process.

"tablename SQTABLE"
The unloaded data.

"tablename LOADDBSU"
Table create and/or dataload DBSU file.

"tablename DDLDBSU"
DDL DBSU file. Indexes, views or grants.

The LOADDBSU file is processed first to drop the old table or delete data (as required), create the new table, and perform the dataload. The subsequent DDLDBSU file is then processed separately, since several of the SQLTABLE options can result in duplicate view and index names, causing the DBSU process to fail. Manual intervention by you will then be required to either modify the failing statements in the DBSU file before rerunning it, or to issue comparable statements within ISQL or another database interface.

All grants are issued in the same chronological order in which they were originally issued, in order to retain hierarchical dependencies.

In order to grant authority to an object, SQLTABLE must first connect as the user who originally issued the grant. Therefore, SQLTABLE must gather database connect passwords for all grantors. If a grantor does not have a connect password, SQLTABLE will give the user a temporary one and will later remove it.

The database does not remove grant information from the system catalogs when a user is removed from the SYSTEM.SYSUSERAUTH table. Therefore, the possibility exists that SQLTABLE needs to connect as a nonexistent user in order to reestablish a grant. If this situation occurs, SQLTABLE will temporarily grant connect authority and will later revoke it.

Features

The SQLTABLE tool has these features:

SQLTABLE Panels

The SQLTABLE tool panel shown in Figure 191 is reached from the Control Center Main Menu by choosing the Database Utilities (U) option and then choosing the SQLTABLE (T) option.

Figure 191. SQLTABLE Data Entry Panel

+--------------------------------------------------------------------------------+
|  *********************     SQLTABLE TABLE UTILITY     *******************      |
|  SELECTION   ==> 3   ( 1=DATA only <DELETE *>, 2=DDL only,                     |
|                  -     3=DATA and DDL <DROP TABLE>, 4=REDEFINE columns)        |
|  DATABASE (DBNAME) ==> SQLDBA                      ( example:  SQLDBA )        |
|                        --------                                                |
|  OWNER.TABLE_NAME  ==>                             ( example: MY.USER_TABLE )  |
|                        ---------------------------                             |
|  NEW DATABASE      ==>                             ( defaults to same )        |
|                        --------                                                |
|  NEW OWNER.TABLE   ==>                             ( COPY table and/or )       |
|                        ---------------------------                             |
|  NEW OWNER.DBSPACE ==>                             ( MOVE table and/or )       |
|                        ---------------------------                             |
|  DATALOAD PCTFREE  ==>            ALTER PCTFREE ==>     ( after dataload )     |
|                        ---                          ---                        |
|  COMMITCOUNT ==> 1000  (1-50000)    REPREP PKGS ==> YES     ALLSTATS ==> NO    |
|                  -----                              ---                  ---   |
|  PAUSE       ==> NO    (YES / NO)      TAPE     ==> NO  (YES / NO)             |
|                  ---                                ---                        |
|  FILEMODE    ==>       (R/W disk)                                              |
|                  ---                                                           |
|PF:  1 HELP   3 QUIT   4 EXIT   5 Main Menu   6 SCHEDULE  10 PROCESS NOW        |
|                                                                                |
+--------------------------------------------------------------------------------+

The SELECTION parameter specifies which of several functions should be performed.

Option
Description

Data only <DELETE *> (1)
Option 1 specifies that only the data within the table should be manipulated. The table definition, indexes, views, grants, and related Data Definition Language (DDL) statements will not be affected. This option therefore, only requires that you have select and/or insert authority for the target table. Other parameters within this panel will indicate what you desire to do with the table data. The PAUSE option can be used to merely perform a DATAUNLOAD to create an external copy of the data within a CMS file. Without the PAUSE option, SQLTABLE will perform a DATAUNLOAD, delete all data from the table, then will DATALOAD the data back into the table (essentially performing a table reorganization). The NEW OWNER.TABLE parameter can be used to instruct SQLTABLE to DATAUNLOAD the data from the old table and DATALOAD the data into a new table (which must exactly match the column definitions of the old table). This option will delete data from the NEW TABLE, but the old table data will remain intact.

DDL only (2)
Option 2 will capture all Data Definition Language (DDL) statements related to the specified table, but will not perform a DATAUNLOAD. When used with the PAUSE option, this provides a way to capture the DDL for backup or informational purposes. When the NEW OWNER.TABLE parameter is used, SQLTABLE will copy the table definition, creating an empty duplicate table under a different owner or new table name. For complete capture of all DDL, this option requires you to have DBA authority within the database.

DATA and DDL <DROP TABLE> (3)
Option 3 will capture both DDL and the data itself for a specified table. This option can be used to perform a table-level reorganization with a DROP TABLE being performed between the DATAUNLOAD and DATALOAD. This reorganization process is more complete than the DATA only reorganization performed by Option 1 because all indexes will be rebuilt for better efficiency. (However, the TABLE REORGANIZATION is not as complete or efficient as the DBSPACE REORGANIZATION performed by the DBSPACE Reorganization tools, which should be used as the primary reorganization process.)

REDEFINE columns (4)
Option 4 is used to redefine table columns and will require DBA authority within the database. Essentially, this function performs the DDL and data capture of Option 3, but provides you with an intermediate panel which allows the column characteristics to be changed before the table is recreated. Since the DATAUNLOAD and DATALOAD commands of the Database Services Utility (DBSU) are used for this function, column datatype changes are restricted to those that are supported within this underlying facility. The REDEFINE columns option cannot be scheduled since it requires interactive user inputs to define the desired changes. Please note, the unload option for REDEFINE MUST be disk (either temp or permanent).

The DATABASE and OWNER.TABLE_NAME parameters are required for all SQLTABLE options to indicate the target table for the selected function. The database specified must match either the database parameter or the nickname parameter of an entry in the DBINIT CONTROL file. The OWNER.TABLE_NAME parameter must identify a valid table within the target database.

All additional parameters on the SQLTABLE panel are optionally used to specify additional characteristics of the SQLTABLE function to be performed.

Parameter
Description

NEW DATABASE
Use this option to specify that the table data and/or definition should be copied to a different database. This option allows a table to be migrated from one database to another, such as from development to production. Due to differences within the two databases, such as userids within the SYSTEM.SYSUSERAUTH table, certain DDL statements cannot execute successfully unless the DBA first assures that the two environments are compatible. When the NEW DATABASE parameter is used, the table within the old database will remain unaltered.

NEW OWNER.TABLE
Use this option to specify a new owner or a new table name for the DDL or data from the old table. This option will essentially cause the source table to be copied, with the source table remaining unchanged. Note that table view names and index names will not be changed, causing failure of these create statements if the original table owner is the same as the new table owner.

NEW OWNER.DBSPACE
Use this option to specify a new DBSPACE for the table. If the NEW OWNER.TABLE option is used, a copy will be performed. If a new table and owner is not specified, the table will be moved from the current DBSPACE to the new DBSPACE.

DATALOAD PCTFREE
Use this option to indicate a percent of each DBSPACE page to be reserved for later insertion when the data is loaded into the table. The default will be to use the current characteristic of the target DBSPACE.

ALTER PCTFREE
Use this parameter to indicate a PCTFREE value to be used after the data has been reloaded into the table. This value should be lower than the PCTFREE parameter value to allow future inserts to use reserved space on existing DBSPACE pages, allowing cluster properties to be maintained.

COMMITCOUNT
Use this parameter to specify how frequently inserts should be committed during the DATALOAD process. This parameter can have a significant effect on performance, locking, and log file usage during the dataload.

REPREP PKGS
The SQLTABLE tool repreps (rebinds) all access modules (packages) during a table reorganization. If this is not wanted, specify NO in this field. The default value is YES.

ALLSTATS
By default, SQLTABLE will use the UPDATE STATISTICS command for the table. If YES is specified for the ALLSTATS parameter, SQLTABLE will use the UPDATE ALL STATISTICS command.

PAUSE
Allows you to interrupt the SQLTABLE function between the DATAUNLOAD and DATALOAD steps. By specifying YES, SQLTABLE will capture data and DDL, but will not perform the DELETE or DROP TABLE function, or the DATALOAD. An exec will be created which will complete the function if executed. The name of this exec will be the first eight alphanumeric characters of the TABLE name. If a temp disk is used when the exec is run, it will not be detached, and the files created during reorganization will remain on disk.

TAPE
Allows you to unload the table data to TAPE rather than DASD. By specifying YES, SQLTABLE will expect the user to have performed the appropriate FILEDEF, LABELDEF, and TAPE MOUNT commands to prepare for the SQLDBSU DATAUNLOAD processing. Remember, TAPE cannot be used for unloading with the REDEFINE option. Please refer to the SQLTABLE Special Considerations section for details on TAPE usage.

FILEMODE
Allows you to specify a linked minidisk that should be used for the captured table data and DDL. This minidisk must be linked in R/W mode prior to running SQLTABLE. If this option is not specified, SQLTABLE will define a temporary disk large enough to hold all unloaded data and will use your 191 A-disk for the created EXEC and DBSU files. Backups of all the DBSU, SYSIN and SYSPRINT files will be made prior to execution. The datafile will be replaced.

REFRESH ROWCOUNT
Specifies that SQLTABLE will perform an UPDATE STATISTICS on the table reorganization so that catalog entries needed to calculate the required temp disk size will be accurate. The UPDATE STATISTICS will not be performed if the FILEMODE, TAPE, or DDL ONLY option has been selected. The default is YES.

After entering all desired SQLTABLE parameters, PF10 can be used to perform the table reorganization immediately.
Usage Consideration:When used in this manner, the tool will run on your virtual machine, thus tying up your ID for the duration of the reorganization job.

Optionally, PF6 can be used to schedule the reorganization activity using the Job Scheduling tool. Refer to Chapter 10, Job Scheduling Tool.

More on the REDEFINE Columns Option

The Definition Change function of the database allows columns to be added, deleted, column order within a table to be changed, column names to be changed, and column datatypes and sizes to be changed. Tape cannot be specified using the SQLTABLE REDEFINE tool.

SQLTABLE uses the DATAUNLOAD/DATALOAD function of the Database Services Utility (DBSU) to transfer data between the previous table definition and the new table definition. Any datatype changes for column definitions are therefore restricted to those that are compatible as described in the DB2 Server for VSE & VM Database Services Utility manual under DATALOAD/DATAUNLOAD Data Conversion Summary. The DATALOAD for the new table definition will fail if any of the Data Conversion restrictions are violated.

When the REDEFINE columns option is selected, SQLTABLE will provide the existing table column definitions to you for modification. An example of the display panel format is:

Figure 192. SQLTABLE REDEFINE Columns Panel

+--------------------------------------------------------------------------------+
|****************      SQLTABLE TABLE DEFINITION CHANGE       ***************    |
|                        Source Table: OWNER.TABLE                               |
| Colno   Column Name         Datatype                         Nulls(Y/N)        |
|   1    CCODE                CHAR(    3)                         Y              |
|   2    CUSTNO               CHAR(    6)                         N              |
|   3    CUSTOMER             CHAR(   32)                         Y              |
|   4    NAME                 CHAR(   34)                         Y              |
|   5    ADDRESS              CHAR(   65)                         Y              |
|   7    CITY                 CHAR(   30)                         Y              |
|   8    COUNTRY              CHAR(   25)                         Y              |
|   9    NEW_TEST             CHAR(    5)                         N              |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|      Make desired changes on ALL pages, press PF10 when ready to PROCESS       |
|                                                                                |
|                              Page 1 of 1                                       |
| PF:  1 Help   2 Reset values   3 QUIT                                          |
|      4 ADD new column         10 PROCESS Table Redefine                        |
|                                                                                |
|                                                                                |
|                                                                                |
+--------------------------------------------------------------------------------+

Column Heading
Description

COLNO
COLNO indicates the column position of each column within the original table. These column numbers can be renumbered to modify the relative position of each column in the new table definition. The column number can also be changed to 0 (zero) to indicate that the column should be deleted from the new table definition. (A deleted column will be unloaded from the source table but will not be included in the table definition of the output table, and the unloaded data will not be reloaded.)

Column Name
The Column Name data field can be modified to change the column name of the new table definition. SQLTABLE will update the CREATE INDEX, CREATE VIEW, and GRANT information associated with the original table to reflect the new column names specified.

Datatype
The Datatype data field indicates the datatype of the original table. These datatypes can be changed to any other datatype valid within the database, as long as the restrictions of the DATAUNLOAD/DATALOAD function of DBSU are not violated. These restrictions are discussed in the DB2 Server for VSE & VM Database Services Utility manual under DATALOAD and DATAUNLOAD Data Conversion. It is your responsibility to understand which datatypes are compatible and which ones will cause DATALOAD failures or truncation errors.

Nulls (Y/N)
The Nulls (Y/N) data field indicates whether the column in the original table allowed NULLS or was defined as NOT NULL. This column characteristic can be changed, but you should be aware that the DATALOAD will fail if you attempt to load NULL data from the source table into a column that has been redefined as NOT NULL.

REDEFINE - Adding Columns (includes non-nullable fields)

Use selection Option 4 from the SQLTABLE Utility menu to redefine a table's columns. See Figure 192 which displays the current table definitions. New columns can be added by pressing PF4.

The panel which follows, Figure 193, will then allow the user to define the new column(s).

Figure 193. SQLTABLE Column Addition Panel

+--------------------------------------------------------------------------------+
|*****************      SQLTABLE TABLE COLUMN ADDITION       ****************    |
|                        Source Table: OWNER.TABLE                               |
| Colno   Column Name         Datatype               Nulls(Y/N) Default Value    |
|   99   SAMPLE_COLUMN        CHAR(101)                      N  UNDEFINED        |
| -----  ------------------   ----------------------------   -  ---------------  |
|   10   NEW_FIELD            CHAR(10)                       N  xxxxxx           |
|   11                                                                           |
|   13                                                                           |
|   14                                                                           |
|   15                                                                           |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|      Add columns and press PF10 when ready to PROCESS column adds              |
|                                                                                |
| PF:  1 Help     3 QUIT (additions)    10 PROCESS Additions                     |
|                                                                                |
|                                                                                |
+--------------------------------------------------------------------------------+

The rows shown that begin with 10, 11, 12, allow inputs from the user to define new columns for the existing table. The first row, with a COLNO value of 10, indicates that the table currently contains 9 columns, so the first column added will be column number 10. The COLNO value can be changed on this screen to add a new column elsewhere in the table, but the provided COLNO value must not be duplicated on a prior panel (you will need to change COLNO values of existing columns before coming to this screen).

To add a new column, enter the column name and datatype in the entry fields under the appropriate heading, and specify Y or N to indicate whether the new column should allow NULLS (Y) or be defined as NOT NULL (N). If Y is specified, there are 2 choices available regarding defaults: 1) If no default value is entered on the panel, the new column will be added to the table and any rows of data which currently exist in the table will set the new column value to NULL; 2) If a default value is specified on the panel, the new column will be initialized to that value for any currently existing rows in the unloaded file. If N is specified, you MUST specify a default value for numeric data in the rightmost entry field of this panel. For CHAR type data, if no default value is specified, a default of blanks will be assumed. The new column will be added to the table as NOT NULL and any existing rows of data will have the default value entered for the new column.

After any new columns are defined, press PF10 to save your definitions and toggle back to the previous "CHANGE TABLE" panel. You can continue switching between the CHANGE TABLE panel and the ADD COLUMNS panel until you press PF10 or PF3 on the CHANGE TABLE panel to PROCESS the table redefinition or CANCEL the redefinition. Note, however, if you press PF3 from the ADD COLUMN panel, all previously entered new columns will disappear if you go back into this function with PF4 from the main table definition column. PF3 from the Table Column Addition panel resets this panel to blanks.

Special Restrictions

Note that SQLTABLE will always attempt a DATAUNLOAD and DATALOAD of the table(s) specified in the REDEFINE function. The DATALOAD will fail if the data stored in the source table does not match the data format specified by a redefined datatype in the object table. If you want a new table without the data from the source table, SQLTABLE should first be run using Option 2 (DDL only) to create a copy of the original table without data. The REDEFINE function (Option 4) can then be used against the new table without concern about dataload errors.

The REDEFINE function will also attempt to reconstruct all DDL associated with the table, including index and view definitions and all grants. If the owner of the new table is the same as the owner of the source table, but the table name is different, the INDEX and VIEW create statements will fail due to duplication (non-uniqueness) within the database. The PAUSE option can be used to capture the INDEX and VIEW create statements within the DBSU format and allow the index and view names to be manually modified before completing the execution of the SQLTABLE function.

Special Considerations

SQLTABLE and LONG VARCHAR Fields

You cannot use SQLTABLE to unload/reload (reorg) the QMF table Q.OBJECT_DATA. The run will be stopped after a warning message is issued. The reason for this is that the database DBSU suppresses blanks at the end of VARCHAR and LONGVARCHAR fields when doing a DATALOAD (which is what SQLTABLE uses). This action renders QMF FORMS and some PROCS and QUERIES unusable resulting in loss of QMF objects. In order to prevent this situation, SQLTABLE will display a warning message and stop the processing. You can still use the SQLREORG tool to UNLOAD/RELOAD the DBSPACE in which this table resides (PUBLIC.DSQTSCT3).

Referential Integrity Considerations

Unloading to Tape

When using the TAPE option, you must issue the appropriate FILEDEF, LABELDEF, and TAPE MOUNT commands prior to invoking SQLTABLE. The DDNAME for the unloaded data must be DBSFILE. SQLTABLE executes the DATAUNLOAD utility. DATAUNLOAD supports all record format (RECFM) values with the exception of undefined (U). For instance, an example of a FILEDEF and LABELDEF command are given below:



FILEDEF DBSFILE TAP1 SL (RECFM VBS BLKSIZE 28672
LABELDEF DBSFILE VOLID SCRATCH

If the unloaded data will fit on a single tape, then SQLTABLE can be executed without the PAUSE option, and the tape will automatically be rewound between the DATAUNLOAD and DATALOAD steps.

If the unloaded data will span multiple tapes, then the proper LABELDEF command must be issued to handle the multiple volume tape and the PAUSE option must be specified so that the appropriate sequence of DETACH and MOUNT commands can be issued between the DATAUNLOAD and DATALOAD processing steps. After the PAUSE, the last tape must be detached and the first tape must again be mounted before the DATALOAD process can begin.

Failure Restart

SQLTABLE will display status information at your terminal to indicate what step is being performed. If SQLTABLE fails at any time prior to the "Reloading..." message, the table has not been changed and SQLTABLE should be restarted from the beginning. If the failure occurs during the "Unloading..." step and you are using a temporary disk, you can detach the temporary disk by issuing the CMS RELEASE command with the DET option.

If SQLTABLE fails at any time after the "Reloading..." message has been displayed, the table must be recovered using the created REXX exec and related files. This exec will begin the dataload process by using the DBSU files and the unloaded data file. If the data was unloaded to TAPE, then the proper FILEDEF, LABELDEF, and tape MOUNT commands must be used before the created exec can be invoked.
Note:

If SQLTABLE unloads data to a temporary disk and SQLTABLE fails, you should be aware that the temporary disk (and unloaded data) will be purged if you log off. Therefore, the created exec must be run successfully before logging off.

As a special precaution to prevent loss of data, SQLTABLE sends the unloaded data file to your reader if a temporary disk is used. If the temporary disk is lost, the reader copy can be received onto a new disk and the created exec can then be executed. Under this scenario, you should verify that all file mode references in the created exec correctly point to the new location of the data file.

Pause Option

The same cautions discussed in "Failure Restart" also apply to the use of the SQLTABLE PAUSE option. Each time that SQLTABLE is run, a new exec and related files will be created. Any previous copy of these files will be renamed by reversing the filename and filetype and reversing all letters in each. This implies that if a second SQLTABLE is executed prior to completion of the first SQLTABLE, the first one can be used again if the files are renamed back again.

The PAUSE option can be very useful to an experienced user of SQLTABLE and very dangerous to an inexperienced user. If you have a good working knowledge of the Database Services Utility (SQLDBSU) and of SQLTABLE, the PAUSE option will allow you a great deal of flexibility and control in the SQLTABLE functions. The SQLDBSU file can be examined and modified prior to running the created exec in order to change or remove certain characteristics of the table. Once again, care should be exercised to prevent loss or contamination within the database.

Unloaded Data File

SQLTABLE will unload the database data within a table to an OS format file on a CMS minidisk or tape using the DBS Utility DATAUNLOAD command. This unloaded format file can be modified using XEDIT or other file editors to modify the data prior to the reload. Caution should be exercised to ensure that this data file is not modified in such a way that will cause the DATALOAD to fail. The default XEDIT setting of NULLS ON will cause automatic truncation of lines within the unloaded file, which will result in the file being corrupted.

Failure Analysis

SQLTABLE uses a DBS Utility command file to execute the DATAUNLOAD portion of the reorganization. Detailed output from the DATAUNLOAD portion is captured in a file on your 191 A-disk with a file type of UNLIST. This file can be examined to determine the reason for failure.

During the "Reloading..." portion of SQLTABLE processing, the SQLDBSU command file is executed using the DBS Utility. Detailed output of this processing is captured within a file on the target disk with a filetype of LOADLIST or DDLLIST and a filename equal to the first eight alphanumeric characters of the table name. If a failure occurs during this step of processing, this file can be examined to determine the cause of failure.

One fundamental difference between SQLREORG, the DBSPACE Reorganization tool, and SQLTABLE is that SQLREORG uses the UNLOAD/RELOAD commands of DBSU, while SQLTABLE uses DATAUNLOAD/DATALOAD. This provides several advantages to the SQLTABLE user. The RELOAD command performs the entire data load function as a single Logical Unit of Work (LUW). If the table or DBSPACE is very large, the entire LUW can be too large to be recorded within the database log file, forcing an archive in the middle of the RELOAD. The archive cannot take place until a checkpoint is taken, which requires a breakpoint without any active LUWs. The RELOAD LUW must therefore be rolled back by the database before the archive can complete. By using the DATALOAD command with the COMMITCOUNT option, SQLTABLE can successfully perform a table-level reorganization with an archive during the process.

Another SQLTABLE advantage is the use of a simple CMS file format by DATAUNLOAD that allows modification prior to the DATALOAD. The disadvantages of SQLTABLE mostly relate to the pure reorganization function. UNLOAD/RELOAD requires less external disk space than DATAUNLOAD/DATALOAD and will also execute faster. The DBSPACE level processing of SQLREORG also provides a considerably more efficient reorganization than the table-level processing of SQLTABLE, allowing empty pages to be returned to the database for use elsewhere and providing much better clustering properties to be maintained.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]