MultiLoad General Code
MultiLoad General Code
Top of Form
Bottom of Form
Tags:
error handling
high availability
MultiLoad
1. Preliminary
Parses and validates all of the MultiLoad commands and Tera-data SQL
statements in your MultiLoad job
Creates and protects temporary work tables and error tables in the Teradata
Database
2. DML Transaction
Submits the DML statements specifying the insert, update, and delete tasks
to the Teradata Database
3. Acquisition
Loads the selected records into the worktables in the Tera-data Database
4. Application
Acquires locks on the specified target tables and views in the Teradata
Database
For an import task, inserts the data from the temporary work tables into the
target tables or views in the Teradata Data-base
For a delete task, deletes the specified rows from the target table in the
Teradata Database
5. Cleanup
Drops the temporary work tables and all empty error tables from the
Teradata Database
Reports the transaction statistics associated with the import and delete
tasks.
Multiload returns the returns codes described previously (0, 4, 8, 12) to the
operating system or calling program.
Restarts
A Multiload job creates a restart log table that must be present for a job to
be restarted and must be dropped before a job can be rerun. It creates a
work table for each input source. These tables must be pre-sent for a job to
restart and must be dropped to rerun a job. Multiload also creates two error
tables for each target table that must be present for a restart and that must
be dropped to rerun a Multiload job.
A Multiload job can not be restarted or rerun if these tables are not present
for an interruption that occurs during the APPLICATION PHASE.
Interruptions that occur during the application phase will be restarted based
on internal checkpoints created by the database.
The following is a simple Multiload script that will be use to illustrate the
Multiload restart capabilities.
Code
1 .logtable test.tranmllog;
2 .LOGON test/testuser,test;
4 .begin import
6 checkpoint 20000;
8 .layout tranlayout;
9 .FIELD STORE * varchar(10);
30
36 layout tranlayout
37 apply insdml;
38.end mload;
39.logoff;
This script inserts rows into one table, “TRAN”. It set a checkpoint every
20000 input records.
Code
3 ============================================
============================
4
= MultiLoad Utility Release MLOD.13.00.00.000 =
5
= Platform WIN32 =
6
============================================
7
============================
8
= Copyright 1990-2009, Teradata Corporation. ALL RIGHTS
9 RESERVED. =
1 ============================================
0 ============================
1 **** 22:11:09 UTY2411 Processing start date: SUN AUG 09, 2009
1
============================================
1 ============================
2
= Logon/Connection =
1
============================================
3
============================
1
0001 .logtable test.tranmllog;
4
0002 .LOGON test/testuser,;
1
5 **** 22:11:11 UTY8400 Teradata Database Release: 12.00.01.24
2
1
0003 .begin import
2
mload tables test.tran
2
checkpoint 20000;
2
3 ============================================
============================
2
4 = Processing MultiLoad Statements =
2 ============================================
5 ============================
2
6
0004 .layout tranlayout;
2
0005 .FIELD STORE * varchar(10);
7
0006 .field TRAN_NO * varchar (10);
2
8 0007 .field TRAN_DATE * varchar (10);
2 0008 .field TRAN_TIME * varchar (10);
9
0009 .field TRAN_TYPE * varchar (1);
3
0 0010 .field TRAN_TERMINAL * varchar (3);
4
0028 .import infile C:\DataIntegration\Data\TRAN2.DAT
2
format vartext '|'
4
3 layout tranlayout
4 apply insdml;
4
0029 .end mload;
4
5 ============================================
============================
4
6 = MultiLoad Initial Phase =
4 ============================================
7 ============================
4 **** 22:11:12 UTY0829 Options in effect for this MultiLoad import task:
8
. Sessions: One session per available amp.
4
. Checkpoint: 20000 records.
9
. Tenacity: 4 hour limit to successfully connect load sessions.
5
0 . Errlimit: No limit in effect.
6 ds have been
0
sent to the RDBMS.
6
1 **** 22:11:43 UTY0817 MultiLoad submitting the following request:
6
6 ============================================
============================
6
7 = MultiLoad Initial Phase =
6 ============================================
8 ============================
6 **** 22:11:43 UTY0829 Options in effect for this MultiLoad import task:
9
7 . Sessions: One session per available amp.
0
. Checkpoint: 20000 records.
7
. Tenacity: 4 hour limit to successfully connect load sessions.
1
. Errlimit: No limit in effect.
7
2 . AmpCheck: In effect for apply phase transitions.
7 **** 22:11:44 UTY0815 MLOAD session(s) connected: 2.
3
============================================
7 ============================
4
= MultiLoad Acquisition Phase =
7
5 ============================================
============================
7
6 **** 22:11:46 UTY1806 This MultiLoad Import task is re-starting from
checkpoint
7
7 taken at
8 ds have been
4
8 sent to the RDBMS.
5
**** 22:11:50 UTY0827 A checkpoint has been taken, recording that
8 input record 6
6
0000 has been
8
processed for IMPORT 1 of this MultiLoad Import task.
7
**** 22:11:51 UTY0826 A checkpoint has been taken, recording that end
8
of file ha
8
s been reached
8
9 for IMPORT 1 of this MultiLoad Import task.
9 **** 22:11:51 UTY1803 Import processing statistics
0
. IMPORT 1 Total thus far
9
1 . ========= ==============
9 ============================================
6 ============================
1
**** 22:12:12 UTY0822 MultiLoad processing complete for this MultiLoad
0
import ta
7
sk.
1
0 ============================================
8 ============================
1 ============================================
1 ============================
1
= Logoff/Disconnect =
1
============================================
1
============================
2
**** 22:12:12 UTY6216 The restart log table has been dropped.
1
1 **** 22:12:12 UTY6212 A successful disconnect was made from the
3 RDBMS.
1
1
6
1
1
7
1
1
8
1
1
9
1
2
0
1
2
1
1
2
2
1
2
3
1
2
4
1
2
5
1
2
6
1
2
7
1
2
8
1
2
9
1
3
0
1
3
1
1
3
2
1
3
3
1
3
4
1
3
5
1
3
6
1
3
7
1
3
8
1
3
9
1
4
0
1
4
1
1
4
2
1
4
3
1
4
4
1
4
5
1
4
6
1
4
7
1
4
8
1
4
9
1
5
0
1
5
1
1
5
2
1
5
3
1
5
4
1
5
5
1
5
6
1
5
7
1
5
8
1
5
9
1
6
0
1
6
1
1
6
2
1
6
3
1
6
4
1
6
5
code
3 ============================================
============================
4
= MultiLoad Utility Release MLOD.13.00.00.000 =
5
= Platform WIN32 =
6
============================================
7
============================
8
= Copyright 1990-2009, Teradata Corporation. ALL RIGHTS
9 RESERVED. =
1 ============================================
0 ============================
1 **** 22:22:57 UTY2411 Processing start date: SUN AUG 09, 2009
1
============================================
1 ============================
2
= Logon/Connection =
1
============================================
3
============================
1
4 0001 .logtable test.tranmllog;
2 checkpoint 20000;
3
============================================
2 ============================
4
= Processing MultiLoad Statements =
2
============================================
5
============================
2
6
0004 .layout tranlayout;
2
7 0005 .FIELD STORE * varchar(10);
2 0006 .field TRAN_NO * varchar (10);
8
2 0007 .field TRAN_DATE * varchar (10);
9
0008 .field TRAN_TIME * varchar (10);
3
0009 .field TRAN_TYPE * varchar (1);
0
0010 .field TRAN_TERMINAL * varchar (3);
3
1 0011 .field CLERK * varchar (10);
3 0012 .field CUST_NO * varchar (10);
2
0013 .field NAME * varchar (30);
3
3 0014 .field TOTAL_SALE * varchar (14);
4
1 0026 .dml label insdml;
4
0028 .import infile C:\DataIntegration\Data\TRAN2.DAT
3 format vartext '|'
4 layout tranlayout
4
apply insdml;
4
0029 .end mload;
5
============================================
4
============================
6
= MultiLoad Initial Phase =
4
7 ============================================
============================
4
8 **** 22:23:00 UTY0829 Options in effect for this MultiLoad import task:
8 ============================================
2 ============================
9 Inserts: 67817
2
Updates: 0
9
3 Deletes: 0
9 ============================================
4 ============================
1 ============================================
0 ============================
7
= Logoff/Disconnect =
1
============================================
0
============================
8
**** 22:24:29 UTY6216 The restart log table has been dropped.
1
0 **** 22:24:29 UTY6212 A successful disconnect was made from the
9 RDBMS.
1
1
3
1
1
4
1
1
5
1
1
6
1
1
7
1
1
8
1
1
9
1
2
0
1
2
1
1
2
2
1
2
3
1
2
4
1
2
5
1
2
6
1
2
7
1
2
8
1
2
9
1
3
0
1
3
1
1
3
2
1
3
3
1
3
4
1
3
5
1
3
6
1
3
7
1
3
8
1
3
9
1
4
0
1
4
1
1
4
2
1
4
3
1
4
4
1
4
5
1
4
6
1
4
7
1
4
8
1
4
9
1
5
0
1
5
1
1
5
2
1
5
3
1
5
4
1
5
5
1
5
6
1
5
7
1
5
8
code
3 ============================================
============================
4
= MultiLoad Utility Release MLOD.13.00.00.000 =
5
= Platform WIN32 =
6
============================================
7
8 ============================
1 ============================================
2 ============================
1 = Logon/Connection =
3
============================================
1 ============================
4
0001 .logtable test.tranmllog;
1
0002 .LOGON test/testuser,;
5
**** 22:35:53 UTY8400 Teradata Database Release: 12.00.01.24
1
6 **** 22:35:53 UTY8400 Teradata Database Version: 12.00.01.24
2 ============================================
4 ============================
2
0004 .layout tranlayout;
7
0005 .FIELD STORE * varchar(10);
2
8 0006 .field TRAN_NO * varchar (10);
2 0007 .field TRAN_DATE * varchar (10);
9
0008 .field TRAN_TIME * varchar (10);
3
0 0009 .field TRAN_TYPE * varchar (1);
4
3
0028 .import infile C:\DataIntegration\Data\TRAN2.DAT
4
format vartext '|'
4
layout tranlayout
4
5 apply insdml;
6
9
7
0
7
1
7
2
7
3
7
4
7
5
7
6
7
7
7
8
7
9
8
0
8
1
8
2
8
3
8
4
8
5
8
6
8
7
8
8
8
9
9
0
The gateway sessions associated with the Multiload job will remain ac-tive
for the gateway timeout time (20 minutes default). These sessions can be
killed using the gtwglobal utility in the same manner that was described for
the Fastload utility.
The interrupted Multiload job can be restarted by re-executing the job. The
following output is from a re-execution of the example Multiload job.
code
3 ============================================
============================
4 = MultiLoad Utility Release MLOD.13.00.00.000 =
5 = Platform WIN32 =
6 ============================================
============================
7
= Copyright 1990-2009, Teradata Corporation. ALL RIGHTS
8
RESERVED. =
9
============================================
1 ============================
0
**** 22:42:35 UTY2411 Processing start date: SUN AUG 09, 2009
1
============================================
1
============================
1
= Logon/Connection =
2
============================================
1
============================
3
0001 .logtable test.tranmllog;
1
4 0002 .LOGON test/testuser,;
2
0003 .begin import
2
mload tables test.tran
2
3 checkpoint 20000;
2 ============================================
4 ============================
2
7 0004 .layout tranlayout;
4
0026 .dml label insdml;
2
0027 insert into test.tran.*;
4
3
4 ============================================
7 ============================
6 **** 22:42:43 UTY0826 A checkpoint has been taken, recording that end
4 of file ha
6 s been reached
5
6 for IMPORT 1 of this MultiLoad Import task.
6
**** 22:42:43 UTY1803 Import processing statistics
6
. IMPORT 1 Total thus far
7
. ========= ==============
6
8 Candidate records considered:........ 67817....... 67817
6 Apply conditions satisfied:.......... 67817....... 67817
9
Candidate records not applied:....... 0....... 0
7
0 Candidate records rejected:.......... 0....... 0
7 ============================================
1 ============================
7 ============================================
6 ============================
8
Target table 1: test.tran
2
Number of Rows Error Table Name
8
3 ==============
==============================================
8
==========
4
0 test.ET_tran
8
5 0 test.UV_tran
8
6
**** 22:42:58 UTY0822 MultiLoad processing complete for this MultiLoad
8 import ta
7
sk.
8
8 ============================================
============================
8
9 = MultiLoad Task Complete =
9 ============================================
0 ============================
9
1
0030 .logoff;
9
============================================
2
============================
9
= Logoff/Disconnect =
3
============================================
9
============================
4
**** 22:42:59 UTY6216 The restart log table has been dropped.
9
5 **** 22:42:59 UTY6212 A successful disconnect was made from the
9 RDBMS.
6
**** 22:42:59 UTY2410 Total processor time used = '0.8125 Seconds'
9
. Start : 22:42:35 - SUN AUG 09, 2009
7
. End : 22:42:59 - SUN AUG 09, 2009
9
8 . Highest return code encountered = '0'.
9
9
1
0
0
1
0
1
1
0
2
1
0
3
1
0
4
1
0
5
1
0
6
1
0
7
1
0
8
1
0
9
1
1
0
1
1
1
1
1
2
1
1
3
1
1
4
1
1
5
1
1
6
1
1
7
1
1
8
1
1
9
1
2
0
1
2
1
1
2
2
1
2
3
1
2
4
1
2
5
1
2
6
1
2
7
1
2
8
1
2
9
1
3
0
1
3
1
It is important to note that the restart log and error tables must be
available. If they are not the Multiload job can not be restarted or rerun. In
this case the table must be reloaded from backup or source because they
are unusable.
code
3 ============================================
============================
4
= MultiLoad Utility Release MLOD.13.00.00.000 =
5
= Platform WIN32 =
6
============================================
7
============================
8
= Copyright 1990-2009, Teradata Corporation. ALL RIGHTS
9 RESERVED. =
1 ============================================
0 ============================
1 **** 22:53:17 UTY2411 Processing start date: SUN AUG 09, 2009
1
============================================
1 ============================
2
= Logon/Connection =
1
============================================
3
============================
1
0001 .logtable test.tranmllog;
4
0002 .LOGON test/testuser,;
1
5 **** 22:53:19 UTY8400 Teradata Database Release: 12.00.01.24
2
2
0003 .begin import
2
mload tables test.tran
3
checkpoint 20000;
2
4 ============================================
2 ============================
5
= Processing MultiLoad Statements =
2
============================================
6
============================
2
7
0004 .layout tranlayout;
2
8 0005 .FIELD STORE * varchar(10);
2 0006 .field TRAN_NO * varchar (10);
9
0007 .field TRAN_DATE * varchar (10);
3
0 0008 .field TRAN_TIME * varchar (10);
4
2 0026 .dml label insdml;
4
4 0028 .import infile C:\DataIntegration\Data\TRAN2.DAT
4 ============================================
9 ============================
5 **** 22:53:19 UTY0829 Options in effect for this MultiLoad import task:
0
. Sessions: One session per available amp.
5
. Checkpoint: 20000 records.
1
. Tenacity: 4 hour limit to successfully connect load sessions.
5
2 . Errlimit: No limit in effect.
5 . AmpCheck: In effect for apply phase transitions.
3
**** 22:53:20 UTY0815 MLOAD session(s) connected: 2.
5
4 ============================================
5 ============================
5
= MultiLoad Application Phase =
5
============================================
6
============================
5
**** 22:53:25 UTY0818 Statistics for table test.tran:
7
Inserts: 67817
5
8 Updates: 0
5 Deletes: 0
9
============================================
6 ============================
0
= MultiLoad Task Cleanup =
6
1 ============================================
============================
6
2 **** 22:53:25 UTY0821 Error table test.ET_tran is EMPTY, dropping
table.
6
3 **** 22:53:26 UTY0821 Error table test.UV_tran is EMPTY, dropping
table.
6
4 **** 22:53:26 UTY0825 Error table statistics for:
6
5
Target table 1: test.tran
6
Number of Rows Error Table Name
6
==============
6
==============================================
7
==========
6
0 test.ET_tran
8
0 test.UV_tran
6
9
7
0
**** 22:53:27 UTY0822 MultiLoad processing complete for this MultiLoad
7 import ta
1
sk.
7
============================================
2
============================
7
= MultiLoad Task Complete =
3
============================================
7
============================
4
7
5 0030 .logoff;
7 ============================================
6 ============================
7 = Logoff/Disconnect =
7
============================================
7 ============================
8
**** 22:53:27 UTY6216 The restart log table has been dropped.
7
9 **** 22:53:27 UTY6212 A successful disconnect was made from the
RDBMS.
8
0 **** 22:53:27 UTY2410 Total processor time used = '0.671875 Seconds'
8
3
8
4
8
5
8
6
8
7
8
8
8
9
9
0
9
1
9
2
9
3
9
4
9
5
9
6
9
7
9
8
9
9
1
0
0
1
0
1
1
0
2
1
0
3
1
0
4
1
0
5
1
0
6
1
0
7
1
0
8
1
0
9
Rerun
Multiload jobs that are interrupted before the application phase starts or
after the application phase ends may be rerun. Jobs that are inter-rupted
during the application phase must be restarted.
To rerun an entire Multiload job the following actions must be taken before
the job is rerun:
Use BTEQ to execute RELEASE MLOAD command for each target table in
Multiload script
These actions can be executed by a BTEQ SQL script that is run as part of a
Multiload script or run by an external job scheduling system.
The following is an example of a SQL script that will allow this example to be
rerun.
code
1 .logon test/testuser,test
3 database test;
10
11.logoff
12.quit
This script can be executed as part of a Multiload script that executes this
script with BTEQ and then executes the Multiload job as illustrated in the
following Multiload script.
code
4.logoff;
This script can always be run when the intent is to run the entire Multi-load
job.
In the next article in this series we will look at the Tpump Utility.