Introduction
Typical DB2 data movement tasks involve three steps:
Exporting the data from the source database into a temporary data exchange file in binary or text format
Moving the generated file between systems
Importing or loading the data from the file into the target database.
Generating the data exchange file using the EXPORT utility is often a lengthy process in the case of large amounts of data. Besides, different database codepages and operating systems have to be considered when moving data in and out of a database.
Such problems can be avoided by using the LOAD utility's FROM CURSOR option. When specifying the FROM CURSOR option, the LOAD utility directly references the result set of a SQL query as the source of a data load operation, thus bypassing the need to produce a temporary data exchange file. This way, a LOAD FROM CURSOR is a fast and easy possibility to move data between different tablespaces or different databases. LOAD FROM CURSOR operations can be executed on the command line as well as from within an application or a stored procedure by utilizing DB2's ADMIN_CMD stored procedure. This article introduces the LOAD FROM CURSOR feature and provides usage samples for both interfaces, the DB2 Command Line Processor (CLP) and ADMIN_CMD stored procedure.
使用 DB2 LOAD 实用程序的 FROM CURSOR 选项简化 DB2® for Linux®, UNIX®, and Windows® 的数据转移过程。本文介绍 LOAD FROM CURSOR 特性并提供两个接口 Command Line Processor 和 ADMIN_CMD 存储过程的使用示例。