load - db2 utility

20
LOAD – DB2 utility

Upload: nilesh

Post on 11-Sep-2015

45 views

Category:

Documents


3 download

DESCRIPTION

It's presentation on the IBM DB2's Load utility.

TRANSCRIPT

  • LOAD DB2 utility

  • *LOAD DB2 utility

    PurposeAuthorizationInputOutputPhasesOptionsSyntaxExamples

    Contents

  • *LOAD DB2 utility

    To load one or more tables of a table space

    PurposeDataData

  • *LOAD DB2 utility

    Table OwnershipLOAD privilege for the databaseDBADM or DBCTRL authority for databaseSYSADM or SYSCTRL authoritySTATS authority on the database to run LOAD STATISTICS

    Authorization

  • *LOAD DB2 utility

    Data set which contains the data to be loaded Specify its template or DD name with the INDDN optionDefault name is SYSRECIt must be a sequential data set that is readable by BSAM

    Input

  • *LOAD DB2 utility

    A loaded table space or partition A discard file of rejected recordsAn optional summary report of errors encountered during processingOutput

  • *LOAD DB2 utility

    UTILINIT InitializationRELOAD Load records, extract keysSORT Sort extracted keysBUILD Build indexesSORTBLD SORT & BUILD for parallel indexINDEXVAL Check unique index constraint ENFORCE Check referential constraintDISCARD Copy error records to discard data setREPORT Generate a summary reportUTILTERM CleanupPhases

  • *LOAD DB2 utilityOptionsLOG indicates whether logging is to occur during the RELOAD phase of the LOAD process. YES All records that are loaded are logged. The default is YES. NO No logging of data during the load process. It sets the COPY-pending restriction against the target table space or partition. NOCOPYPEND LOAD will not set the table space in the COPY-pending status, even though LOG NO was specified.

    ENFORCE indicates whether LOAD is to enforce check constraints and referential constraints. CONSTRAINTS constraints are to be enforced. It is default. If LOAD detects a violation, it deletes the errant row and issues a message to identify it. NO constraints are not to be enforced. This option places the target table space in the CHECK-pending status if at least one referential constraint or check constraint is defined for the table.

  • *LOAD DB2 utilityOptions (cont..)RESUME Indicates whether records are to be loaded into an empty or non-empty tablespace. YES Loads records into a non-empty table space. If the table space is empty, a warning message is issued, but the table space is loaded. NO Loads records into an empty table space. If the table space is not empty, and you have not used REPLACE, a message is issued and the utility job step terminates with a job step condition code of 8. The default is NO.

    REUSE Specifies (when used with REPLACE) that LOAD is to logically reset and reuseDB2-managed data sets without deleting and redefining them. If you do not specify REUSE,DB2 deletes and redefines DB2-managed data sets to reset them. REUSE must beaccompanied by REPLACE to do the logical reset for all data sets.

  • *LOAD DB2 utilityOptions (cont..)SHRLEVEL Specifies the extent to which applications can concurrently access the tablespace or partition during the LOAD utility job. NONE Specifies that applications have no concurrent access to the table space or partition. The default is NONE. CHANGE Specifies that applications can concurrently read from and write to the table space or partition into which LOAD is loading data. LOAD SHRLEVEL CHANGE does not perform the SORT, BUILD, SORTBLD, INDEXVAL, ENFORCE, or REPORT phases .

    INDDN ddname Specifies the DD statement or template that identifies the input data setfor the partition. The default is SYSREC. INCURSOR cursor-name Specifies the cursor for the input data set. You must declare thecursor before it is used by the LOAD utility. Use the EXEC SQL utility control statement todefine the cursor. You cannot load data into the same table on which you defined thecursor.

  • *LOAD DB2 utilityOptions (cont..)REPLACE Indicates whether the table space and all its indexes need to be reset to emptybefore records are loaded. With this option, the newly loaded rows replace all existingrows of all tables in the table space, not just those of the table that you are loading. REPORT Indicates whether a set of messages is to be generated to report the collectedstatistics. NO - Indicates that the set of messages is not sent to SYSPRINT as output. YES - Indicates that the set of messages is sent to SYSPRINT as output. REPORT YES always generates a report of SPACE and ACCESSPATH statistics. STATISTICS Specifies the gathering of statistics for a table space, index, or both; thestatistics are stored in the DB2 catalog.

  • *LOAD DB2 utilityOptions (cont..)

    HISTORY records all catalog table updates to the catalog history tables.

    ALL - all collected statistics are to be updated in the catalog history tables.

    ACCESSPATH - Indicates that updates are to be made only to the catalog history

    table columns that provide statistics that are used for access path selection.

    SPACE - updates are to be made only to the catalog history table columns that

    provide space related statistics of a particular table space or index.

    NONE - no catalog history tables are to be updated with the collected statistics.

    UPDATE whether the collected statistics are to be inserted into the catalog tables.

    ALL - all collected statistics are to be updated in the catalog. Its default.

    ACCESSPATH - Indicates that updates are to be made only to the catalog table

    columns that provide statistics that are used for access path selection.

    SPACE - updates are to be made only to the catalog table columns that provide

    space related statistics of a particular table space or index.

    NONE - no catalog tables are to be updated with the collected statistics

  • *LOAD DB2 utilityOptions (cont..)COPYDDN (ddname1,ddname2) Specifies the DD statements for the primary (ddname1) andbackup (ddname2) copy data sets for the image copy. The default is SYSCOPY for theprimary copy. No default exists for the backup copy. The COPYDDN keyword can bespecified only with REPLACE. The table space or partition for which an image copy isproduced is not placed in COPY-pending status. RECOVERYDDN (ddname3,ddname4) Specifies the DD statements for the primary(ddname3) and backup (ddname4) copy data sets for the image copy at the recovery site. ERRDDN ddname Specifies the DD statement for a work data set that is being used during error processing. Information about errors that are encountered during processing is stored in this data set. A SYSERR data set is required if you request discard processing. The default is SYSERR. DISCARDDN ddname Specifies the DD statement for a discard data set that is to hold copies of records that are not loaded (for example, if they contain conversion errors). The discard data set also holds copies of records that are loaded and then removed (due to unique index errors, or referential or check constraint violations).

  • *LOAD DB2 utilitySyntax

  • *LOAD DB2 utilityExamples1) Load the records from the data set that is defined by SYSREC (default) into the table DSN8810.DEPT. POSITION (start:length) clause specifies the location of a field in the input record. DEPTNO, DEPTNAME, MGRNO etc. are the columns of the table DEPT. RESUME YES specifies new records are added at the end of the table.

  • *LOAD DB2 utilityExamples (cont..)2) Data from the data set that is defined by SYSREC DD statement is to be loaded into the first partition of table DSN8810.DEPT. The REPLACE option indicates that the input data is to replace only the specified partition. If the REPLACE option was specified before the PART option, REPLACE would indicate that entire table space is to be replaced, and the data is to be loaded into the specified partition.

  • *LOAD DB2 utilityExamples (cont..)3) All rows that are identified by cursor C1 are to be loaded into table MYEMP. The INCURSOR option is used to specify cursor C1, which is defined in the EXEC SQL utility control statement. Cursor C1 points to the rows that are returned by executing the statement SELECT * FROM DSN8810.EMP. In this example, the column names in table DSN8810.EMP are the same as the column names in table MYEMP. Note that the cursor cannot be defined on the same table into which DB2 is to load the data.

  • *LOAD DB2 utilityReference ManualFor more information on utilities, search DB2 Utility Guide and Reference, SC18-7427 on IBM website www.ibm.com

  • Company ConfidentialQuestions?

  • Company ConfidentialThank You!

    *