DB2 Version 10.1 for Linux, UNIX, and Windows

GENERATE_DISTFILE procedure - Generate a data distribution file

The GENERATE_DISTFILE procedure generates a data distribution file for the given table and saves it under the given fileName.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-GENERATE_DISTFILE--(--inTbSchema--,--inTbName--,------------->

>--fileName--)-------------------------------------------------><

The schema is SYSPROC.

Procedure parameters

inTbSchema
An input argument of type VARCHAR (128) that specifies the table schema name.
inTbName
An input argument of type VARCHAR (128) that specifies the table name.
fileName
An input or output argument of type VARCHAR (255) that specifies data distribution file name. If the given file name is just a file name, the file will be saved in the tmp sub-directory under the instance directory, and the full file path name will be returned in the parameter.

Authorization

  • EXECUTE privilege on the GENERATE_DISTFILE procedure.
  • SELECT privilege on SYSCAT.TABLES, SYSCAT.COLUMNS, and the specified table.

In addition, the fenced user ID must be able to create files in the tmp sub-directory under the instance directory.

Default PUBLIC privilege

In a non-restrictive database, EXECUTE privilege is granted to PUBLIC when the procedure is automatically created.

Example

Generate a data distribution file to be used by the redistribute process.
CALL SYSPROC.GENERATE_DISTFILE('TEST', 'EMP', 
   '$HOME/sqllib/function/SAMPLE.IBMDEFAULTGROUP_swrdData.dst')"

Usage notes

The redistribute stored procedures and functions work only in partitioned database environments, where a distribution key has been defined for each table.