Migrating statistics
To migrate statistics, follow these steps:
- Extract the statistics from the source Db2 subsystem. This process creates a script containing the access path statistics to update on the target Db2 catalog.
- (Optional) Update extracted statistics.
- Transfer statistics into the target Db2 subsystem (SSID).
Because of the method used to extract the statistics, Catalog Manager does not verify whether the objects exist in the target environment. If the objects do not exist, the Transfer job receives the following message: The following row not found for update.
Before you begin
Make sure that the user administering the Extract or the Transfer jobs has the appropriate authorities to access the Db2 catalog.
To migrate statistics
- Access the Db2 subsystem that contains the statistics that you want to migrate.
- Create a list of databases, table spaces, or tables. For more information, see Generating lists in Catalog Manager.
- In the Cmd column of the list, enter HSTATS beside the object that you want to use as a model. Then, press Enter.
The SQL Progress Indicator panel is displayed. The indicator shows the execution of SQL that makes a list of dependents for the object specified.
When SQL creation is complete, the Confirm SQL panel is displayed as follows:
AUBDYN Confirm SQL 1 to 37 of 570
Command ===> Scroll ===> PAGE
Current SQLID. . . . . . . . MVSSXS2
Edit Options . . . . . . . . N Y/N Modify SQL processing options
Edit SQL . . . . . . . . . . N Y/N Edit SQL before executing
Save in SQL table. . . . . . N A/Y/R/N A/Y-Append, R-Replace
Name of saved data. . . . . 20220222_094815
Save in PDS. . . . . . . . . N Y/N Save in PDS
PDS(member) . . . . . . . . MVSSXS2.ACT.HSTAT(ACTS0219)
Execute SQL. . . . . . . . . N Remote Db2 . NONE Enter ? for list
------------------------------------- SQL -----------------------------------
UPDATE SYSIBM.SYSTABLESPACE SET
STATSTIME = '2022-08-17-06.36.32.206999' ,
SPACEF = 288 ,
AVGROWLEN = 165 ,
NACTIVEF = 72
WHERE DBNAME = 'ACTQX19'
AND NAME = 'ACTS0219' ;
------
COMMIT ;
------
UPDATE SYSIBM.SYSTABLES SET
STATSTIME = '2022-08-17-06.36.32.206999' ,
AVGROWLEN = 165 ,
CARDF = 1 ,
NPAGES = 1 ,
NPAGESF = 1 ,
PCTPAGES = 12 ,
PCTROWCOMP = 0
WHERE CREATOR = 'ACT'
AND NAME = 'ACTT01_D19S02' ;
------
UPDATE SYSIBM.SYSCOLUMNS SET
STATSTIME = '2022-08-17-06.36.32.206999' ,
HIGH2KEY = X'8001046A' ,
LOW2KEY = X'8001046A' ,
STATS_FORMAT = ' ' ,
COLCARDF = 1
WHERE TBCREATOR = 'ACT'
AND TBNAME = 'ACTT01_D19S02'
AND NAME = 'COLUMN_1' ;
------
DELETE FROM SYSIBM.SYSCOLDIST
WHERE TBOWNER = 'ACT'
AND TBNAME = 'ACTT01_D19S02'
AND NAME = 'COLUMN_1' ;
------
INSERT INTO SYSIBM.SYSCOLDIST ( FREQUENCY, STATSTIME, IBMREQD,- In the Edit SQL field, type Y to invoke an ISPF edit session to edit the SQL and then press Enter.
Update the object names as needed and then press End.
The Confirm SQL panel is displayed.
- To migrate statistics to another object on the same Db2 subsystem, perform the following steps:
- In the Edit SQL field, type Y to invoke an ISPF edit session to edit the SQL and then press Enter.
Update the object names as needed and then press End.
The Confirm SQL panel is displayed.
- In the Ex ecute SQL field, type Y to execute the SQL displayed on the Confirm SQL panel and then press Enter .
The SQL Progress Indicator panel is displayed. The panel automatically refreshes to display the status of the SQL that is being executed. - Press End.
To migrate statistics to a different Db2 subsystem, perform one of the following procedures:
If you are usingor later, perform the following steps:
- In the Edit SQL field, type Y to invoke an ISPF edit session to edit the SQL and then press Enter.
Update the object names as needed and then press End.
The Confirm SQL panel is displayed.
- In the Remote Db2 field, perform one of the following steps:
- Enter a Db2 subsystem ID.
- To select a Db2 subsystem from a list, type ? and then press Enter.
- In the Ex ecute SQL field, type Y to execute the SQL displayed on the Confirm SQL panel and then press Enter .
The SQL Progress Indicator panel is displayed. The panel automatically refreshes to display the status of the SQL that is being executed. - Press End.