Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 6

USING INFORMATICA WITH TERADATA UTILITIES -III

(Script creation)
TPUMP:
The basic steps involved in the TPUMP script creation:
(a)

Setting up a Logtable and Logging onto Teradata: The


logtable is defined using the .logtable command. The table name is
arbitrary. However to avoid duplication, usage of target table name
is preferred. By default, the Integration Service uses
TL_<target_table_name><partition_number>. The database
where the table has to be located is also specified like in the below
ex. WORK_DB.LOG_PUMP (where WORK_DB is the database name
and LOG_PUMP is the table name). The .RUN FILE command is
used to run the logon file.

NOTE: The logtable in case of all the 3 loaders stores the information
about the progress during the load.
Begin load process, add Parameters, naming the error
table: In this section of the script the parameters such as
SESSION, PACK FACTOR, ERROR LIMIT are defined based on the
requirements.For ex. the PACK FACTOR has been defined as 40
which means that TPUMP would pack 40 rows at a time and load.
The error table names are also specified here.
(c)
Defining the INPUT flat file: The .LAYOUT command is used to
define the layout. The different layouts supported by TPUMP are
mentioned in fig 1. The column names and their data types are
listed using the .FIELD command. The * is used as a separator
between the columns or the .FILLER command for positioning the
cursor for the next field.
(b)

Fig 1
(d)

(e)

(f)
(g)

(h)

Defining the DML activities to occur: The INSERT, UPDATE


and DELETE SQLs are defined in this section. The MARK and
IGNORE parameters are defined to define the type of errors to be
stored and the ones to be neglected respectively.
Naming the IMPORT file and defining its FORMAT: The
.IMPORT INLINE command is used to define the input file and its
format. In the below ex. "CDW_Export.txt" is the input file.
Associate data with description: For the input file imported a
layout such as FILELAYOUT is specified.
Telling the system to start loading data rows: Finally the
APPLY .DML LABEL to instruct TPUMP to start loading data in to the
target tables. The example below is for a simple INSERT script
hence there is a single .DML label. In case of UPSERT scripts
separate .DML LABELS can also be defined and conditional
statements can be defined in the APPLY statement of .IMPORT
clause to execute the labels.
Finishing loading and logging off of Teradata: The .END
LOAD command tells TPUMP to finish the load and .LOGOFF
command causes TPUMP to log off and exit from Teradata.

Sample Tpump script (Simple Insert)


MLOAD:
Steps involved in a simple MULTILOAD script:

Setting up a Logtable: This step is similar to that of TPUMP


using the .LOGTABLE command followed by logging into Teradata.
The order of these commands is interchangeable but it is better to
define the logtable and then logon into Teradata. The default
logtable name is ML_<target_table_name>.
Identifying the Target, Work and Error tables: The target,
work and error table names are defined here. Their names and the
database where they are to be located have to be specified. MLOAD
creates them automatically. If unspecified integration service uses
WT_<target_table_name>, ET_<target_table_name> and
UV_<target_table_name>.The .DATABASE command can be used

to specify the database for all the tables to be created or the


database can be defined individually for each of the tables.

Defining the INPUT flat file: The input flat file structure is
defined. Data input files come in a variety of formats but MultiLoad
is flexible enough to handle many of them. MultiLoad supports the
following five format options: BINARY, FASTLOAD, TEXT, UNFORMAT
and VARTEXT (same as a TPUMP - refer to fig 1)

Defining the DML activities to occur: SQL for the various


DML operation are defined .The error tracking conditions can also
be defined here. (MARK and IGNORE parameters). Like TPUMP
multiple labels can be defined for performing various DML
operations.
Naming the IMPORT file, layout and start data load: Using
the .IMPORT label the input file name and its format is specified
and then the APPLY label triggers the load.
Finishing loading and logging off of Teradata: The .END
MLOAD command is used to finish the data load and finally the
.LOGOFF command to exit Teradata.

Sample MLOAD script (simple insert script)


FLOAD:

Logging onto Teradata: The fastload script begins by defining


the no. of sessions that would be needed to execute the load
followed by the Teradata logon.
Defining the Teradata table that you want to load (target
table): The structure of the empty table which has to be
fastloaded is specified. The CREATE TABLE statement can be used
to define the structure or the .DEFINE command can be used to
define the internal flat file structure. However the usage of CREATE
TABLE is not considered a good practice. Instead by just defining at
column level using .DEFINE the Fastload automatically creates the
table from the script.
Defining the INPUT data file: The input file structure with its
layout type is specified. The layouts supported are TEXT,
UNFORMATTED OR VARTEXT.
Telling the system to start loading: The .BEGIN LOADING
command is used to initiate the load. In this statement the target
table name and the two error table names are defined. The
CHECKPOINT parameter can also be defined in this section. This
parameter is optional but is useful during restartability as it keeps a
track of the no. of rows loaded successfully. The INSERT SQL for
loading the rows is defined below the .BEGIN LOADING label.
Finishing the load and logging off: The last step is to logoff
from all the sessions. At this point the table locks are released and
error tables are dropped automatically. If however there is any
entry into the error table then the data has to be checked and the
table has to be dropped manually.

Simple Fastload script

References:
Teradata Utilities Breaking the Barriers by Tom Coffing
www.teradata.com
Contributed By:
Rajalakshmi
SE
Best Buy
MDC

You might also like