Data Movement Utilities Guide and Reference

Using Export to Move DB2 Data Links Manager Data

Since table data resides in the database, and the files referred to by DATALINK columns reside on Data Links servers, the export utility must move both the database data, and the data files on the corresponding Data Links servers (see Figure 8). To do this, the export utility produces one control file per Data Links server. The name of the control file is the same as the name of the Data Links server. The control files are created in a new directory that has the name dlfm/YYYYMMDD/HHMMSS, where YYYYMMDD represents YearMonthDay, and HHMMSS represents HourMinuteSecond. This directory is created under the same directory in which the export data file is created. A control file lists the names of the corresponding DB2 Data Links Manager files that are referenced by the DATALINK columns of the rows that are exported.

For the Distributed File System (DFS) on AIX, the export utility produces one control file for all Data Links servers within a cell. There will be one control file for each cell. The name of the control file is the same as the name of the cell. The control file lists the URLs of all DB2 Data Links Manager files within a cell that are referenced by the DATALINK columns of the rows that are exported.

On the WINDOWS NT operating system, the export utility produces only one control file for all Data Links servers. The name of this control file is ctrlfile.lst. It is created in a new directory that has the name dlfm\YYYYMMDD\HHMMSS. This directory is created under the same directory in which the export data file is created. The control file lists the URLs of all DB2 Data Links Manager files that are referenced by the DATALINK columns of the rows that are exported.

DATALINK values that have the NO LINK CONTROL property are not placed in the control file.

The control files must be transported to their respective Data Links servers. For DFS, the control file for each cell must be transported to one of the Data Links servers within the cell. On the Windows NT operating system, the single control file must be transported to all referenced Data Links servers. The dlfm_export utility should be run at each Data Links server, specifying the control file name. This utility produces an archive of the files listed in the control file for that Data Links server. For DFS, the dlfm_export utility should be run on the Data Links server to which the control file was transported. This utility produces an archive of the files listed in the control file for all the Data Links servers within the cell. Set the DLFM_FS_ENVIRONMENT registry variable appropriately before running the dlfm_export utility.

To ensure that a consistent copy of the table and the corresponding files that are referenced by the DATALINK columns are copied, perform the following steps:

  1. Ensure that no update transactions are in progress when the export operation is running by issuing the following command:
       db2 quiesce tablespaces for table tablename share
    
  2. Invoke the export utility.
  3. Run the dlfm_export utility with root authority at each Data Links server; this will successfully archive files to which the Data Links File Manager administrator may not have access. For DFS, the dlfm_export utility will get the DCE network root credentials before archiving the files listed in the control file. The utility does not capture the ACLs information of the files that are archived. As input to dlfm_export, specify the name of the control file that was generated by the export utility.
  4. Make the table available for updates by issuing the following command:
       db2 quiesce tablespaces for table tablename reset
    

The export utility executes as an SQL application. The rows and columns that satisfy the conditions of the SELECT statement are extracted from the database. For DATALINK columns, the SELECT statement should not specify any scalar functions.

The export utility generates the following files:

Use the dlfm_export utility to export files from one or more Data Links servers as follows:

   dlfm_export control-file-name archive-file-name

where control-file-name is the name of the control file generated by running the export utility on the DB2 client, and archive-file-name is the name of the archive file that will be generated. The default archive-file-name is export.tar, located in the current working directory.

A complementary utility called dlfm_import is provided to retrieve and restore files from the archive that dlfm_export generates. This utility must be used whether the archived files are being restored on the same, or a different, Data Links server.

Use the dlfm_import utility to retrieve files from the archive as follows:

   dlfm_import archive-file-name [LISTFILES]

where archive-file-name is the name of the archive file that will be used to restore the files. The default archive-file-name is export.tar. LISTFILES is an optional keyword that, when specified, causes the utility to return a list of the files contained within the archive. Run the dlfm_import utility with root authority at each Data Links server, because you may want to restore the archived files on a different Data Links server, which may not have the same directory structure and user IDs as the Data Links server on which the dlfm_export utility was run. For DFS, run the dlfm_import utility at one of the Data Links servers within the target cell. This utility will get the DCE network root credentials before extracting the files from the archive. Set the DLFM_FS_ENVIRONMENT registry variable appropriately before running the dlfm_import utility.
Note:When running the dlfm_import utility on a Data Links server other than the one on which the dlfm_export utility was run, the files will be restored in the correct paths. The files will be owned by root in case some of the user IDs do not exist on the importing machine. Before inserting these files into a database, ensure that all files have the correct permissions and belong to the correct user IDs. For DFS, create the required file sets, and set up the required ACLs before running the dlfm_import utility. This utility will create the directory (if one does not exist) required to extract the files.

The following table shows (for the non-DFS case) how to export the DB2 data and the files that are referenced by the database called SystemA to the database called SystemB. SystemA uses the Data Links servers DLFM1 and DLFM2. SystemB uses the Data Links servers DLFMX and DLFMY. The files on DLFM1 will be exported to DLFMX, and the files on DLFM2 will be exported to DLFMY.
Database SystemA with Data Links Servers DLFM1 and DLFM2 Step
DB2 data on File File1 with file names for DLFM1 File2 with file names for DLFM2 1) Run the dlfm_export command (as root) on both Data Links servers. This will produce an archive on both Data Links servers.
Database SystemB with Data Links Servers DLFMX and DLFMY

On DLFMX, restore from archive On DLFMY, restore from archive 2) Run dlfm_import (as root) on both Data Links servers.



3) Run the IMPORT command on SystemB, using the parameter DL_URL_REPLACE_PREFIX to specify the appropriate Data Links server for each exported file.
When you run the IMPORT command on SystemB, the SystemA data and all files referenced by DATALINK columns are imported.


[ Top of Page | Previous Page | Next Page ]