Thanks to visit codestin.com
Credit goes to www.scribd.com

100% found this document useful (1 vote)
900 views88 pages

Teradata Utilities

Uploaded by

sravan001
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
900 views88 pages

Teradata Utilities

Uploaded by

sravan001
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 88

1 Teradata Client Tools

Client Tools
2 Application Utilities
• Teradata Database provides several application
utilities for data manipulation
• Each utility exploits the capabilities of Teradata
parallel architecture
• Teradata application utilities are supported on
several hardware platforms including a wide range
of channel-attached mainframes and LAN-attached
clients
• Regardless of host platform, all access between the
host and the Teradata Database relies on Call Level
Interface (CLI)
Client Tools
3 Application Utilities ….
• The Teradata application utilities run on the host
computer, whether it is mainframe or a workstation
• BTEQ is a transparent interface to CLI, to transmit
textual SQL to Teradata server, and deliver response
to the user
• FastLoad, MultiLoad and TPump performs high
volume data transfer from the host to Teradata
• Fast Export performs high volume SELECTs to
export data from Teradata server to the host
• CLI is the vehicle that makes parallel access possible
Client Tools
4 Application Utilities ….
Operating System
Support Environment
Fast
BTEQ Multi Fast
Load TPump
Load Export
CLI

Host

Server
Client Tools
5 Request and Response Flow

Application
Request

CLI

MTDP

MOSI

Response Server
Client Tools
6 Data Flow

Host

BTEQ FastLoad MultiLoad TPump Fast Export

Gateway

PE PE

AMP AMP AMP AMP

Data Data
Disk Disk Disk Disk
Client Tools
7 Application Development
More
INMODs
Flexibility Application

Utilities
Less
Easy Ease of Use Difficult
Selection of the right vehicle can be crucial and
depends on how difficult it is to implement and
maintain
Use of application utilities
• Offer less complexity
• Takes full advantage of parallel processing
Client Tools
8 Using An INMOD Routine
The application utilities allow input data to be read or
pre-processed by a user-written INMOD routine.
An INMOD routine can perform various functions:
• Generate records to be passed to the utility
• Validate a data record before passing it to the utility
• Read data directly from one or more database systems
• Select specific records for input to the Teradata
Database
• Perform data conversions not supported by utilities
• Add or change data fields in the records
Client Tools
9 Using An INMOD Routine

IMS ORACLE

User–written INMOD

FastLoad, MultiLoad, TPump, …

Server
10
Client Tools

BTEQ

FastLoad

Fast Export

MultiLoad

TPump
Client Tools
11 BTEQ
• Batch mode utility for submitting SQL requests to
the Teradata Database
• Runs on every supported platform – laptop to
mainframe
• Flexible and easy to use report writer
• Exports data to a client system from the Teradata
Database
• Reads input data and imports it to the Teradata
Database
• Limited ability to branch forward to a LABEL
Client Tools BTEQ
12 Request Flow

BTEQ script CLI


.logon
select
BTEQ
MTDP
.logoff
MOSI
Network attached Client

Server
PE

AMP AMP AMP AMP

Data Data Data Data


Client Tools BTEQ
13 Response Flow

BTEQ script CLI


.logon
select
BTEQ
MTDP
.logoff
MOSI
Network attached Client

Server
PE Generated answer set

AMP AMP AMP AMP

Data Data Data Data


Client Tools BTEQ
14 Conditional Logic
• BTEQ has the ability to branch forward in a script
based on a test of either an error code or an activity
count

• This is not a true loop function yet it can be used to


avoid unnecessary, time-consuming steps
Client Tools BTEQ
15 Conditional Logic - Example
DELETE Customer_Info ALL;
.IF ERRORCODE = 0 THEN .GOTO TableOK
CREATE TABLE Customer_Info ( Acc_no INTEGER,
Cust_Name VARCHAR(20),
Balance DECIMAL(9,2));
.LABEL TableOK
INSERT INTO Customer_Info (
SELECT A.Acc_no, Cust_Name, Balance
FROM Accounts A, Acc_Cust B, Customer C
WHERE Balance > 100000
AND A.Acc_no = B.Acc_no);
.IF ACTIVITYCOUNT > 0 THEN .GOTO Continue
.QUIT
.LABEL Continue
Client Tools BTEQ
16 Command Set
BTEQ commands can be classified as follows:
• Session control commands
• File control commands
• Sequence control commands
• Format control commands
Client Tools BTEQ
17 Session Control Commands
Controls session characteristics.
Commands:
LOGON
SESSIONS
LOGOFF
QUIT,EXIT
SHOW CONTROLS
SESSION TRANSACTION
Client Tools BTEQ
18 File Control Commands
Specify the format of incoming/outgoing information and
identify the source and destination of input/output
streams.

Commands:
OS
RUN
IMPORT
REPEAT
QUIET
EXPORT
INDICDATA/RECORDMODE
Client Tools BTEQ
19 Sequence Control Commands
Controls the sequence in which other BTEQ commands
and SQL statements will be executed within the scripts
and macros.

Commands:
IF THEN
ELSE
ENDIF
GOTO
Client Tools BTEQ
40 Format Control Commands
To specify the way in which BTEQ presents information
on the screen/printer.

Commands:
FOOTING
HEADING
RETLIMIT
FOLDLINE
SUPPRESS
QUIET
Client Tools BTEQ
41 EXPORT
BTEQ by default delivers a response to all SQL queries
that includes a helpful message along with helpful
diagnostic information about the time taken to perform
the query.

If all of this information is captured in a single output


file, this mixed output typically renders the data
unsuitable for some purposes.

The .EXPORT feature provides the ability to separate


the report or output data from the accounting
information.
Client Tools BTEQ
42 EXPORT
BTEQ Script
Logon complete
.logon mac/user,passwd 1200 rows returned
.export data file=x.dat Time 15 seconds

sel * from table;


BTEQ Default Output

.export reset 12348009


23498763
.quit; 8568733
933435490
x.dat
Client Tools BTEQ
43 EXPORT Types
.EXPORT REPORT
.EXPORT DATA
.EXPORT INDICDATA
.EXPORT DIF
Output converted to DIF used to transport data to
various PC programs.
Example: dBase, Lotus 1-2-3
.EXPORT RESET
Reverses the effect of a previous .EXPORT
Client Tools BTEQ
44 Data Modes
Field mode is set by .EXPORT REPORT

.EXPORT REPORT
Sends results to a host file in field mode. Data set
contains column headings and formatted data.
column A column B column C
1 2 3
4 5 6
7 8 9
Transfers data one column at a time with numeric data
converted to character.
Client Tools BTEQ
45 Data Modes ….
Record mode is set by .EXPORT DATA.

.EXPORT DATA
Sends results to a host file in record mode.

field1 field2 field3 field4

Transfers data one row at a time in a host format. Nulls


are represented as zeros or spaces.
Client Tools BTEQ
46 Data Modes ….
Record mode is set by .EXPORT INDICDATA.

.EXPORT INDICDATA
Sends query results that contain indicator variables to a
host file. Allows host programs to deal with NULLs.

Ind Var field1 field2 field3 field4

Transfers data one row at a time in a host format, sending an


indicator variable for nulls. Nulls are represented as zeros or
spaces.
Client Tools BTEQ
47 Indicator Variables
Indicator variables allow utilities to process records that
contain NULL indicators.
.EXPORT INDICDATA - BTEQ
.[SET] INDICDATA [ON] - BTEQ
INDICATORS ON - FastLoad
INDICATORS - MultiLoad, Fast Export
TPump

NULL Columns

01001000 00000000 F1 F2 F3 F4 F5 F6 F7 …... F12


Client Tools BTEQ
48 Data Handling With IMPORT
• Useful to IMPORT data from the host to Teradata as
a series of INSERTs, UPDATEs, DELETEs and
macro transactions
• BTEQ supports IMPORT in DATA, INDICDATA
and REPORT modes only
• .IMPORT loads data from the host to the Teradata
database with a USING clause
Client Tools BTEQ
49 Data Load From Host

.LOGON TDPid/UserName, Password


.IMPORT DATA FILE=datain.dat;
.QUIET ON
.REPEAT *
USING CustNo( INTEGER ),
Filler ( CHAR(30)),
CustName( CHAR(20))
INSERT INTO Customer ( Customer_Number,
Name )
VALUES ( :CustNo, :CustName );
.QUIT

.REPEAT * Causes BTEQ to read records until EOF.


USING Defines the input data from the host.
Client Tools BTEQ
50 Application Utility Checklist
BTEQ FastLoad Fast Export MultiLoad TPump
DDL Functions All
DML Functions All
Multiple DML Yes
Multiple tables Yes
Multiple sessions Yes
Protocol used SQL
Conditional Exp. Yes
Arithmetic Calc Yes
Data conversion Yes
Error files No
Error limits No
User routines No
Client Tools
51 FastLoad
• Fast batch mode utility for loading new tables onto
the Teradata Database
• Can reload previously emptied tables
• Full restart capability
• Error limits and error tables, accessible using SQL
• Restartable INMOD routine capability
• Ability to load data in several stages
Client Tools FastLoad
52 Purpose/Concepts
Purpose:
Load large amounts of data into an empty table at
high speed.

Concepts:
Load into an empty table with no secondary indexes.
Creates two error tables.
Checkpoints can be taken for restarts.
Client Tools FastLoad
53 Restrictions
• If an AMP goes down, FastLoad cannot be restarted
until it is back online
• The Teradata Database will accommodate up to 15
FL/ML/FE runs at one time
• Tables defined with referential integrity or secondary
indexes cannot be loaded with FastLoad
• Duplicate rows cannot be loaded into multi-set table
with FastLoad
Client Tools FastLoad
54 FastLoad Phases – Phase 1
Phase 1
• FastLoad uses one SQL session to define AMP
steps
• The PE sends a block to each AMP
• AMPs hash each record and redistribute them to the
AMP responsible for the hash value
• Records are written to the target table in unsorted
blocks
Client Tools FastLoad
55 Phase 1

Host SQL & Data PE

BYNET

AMP AMP

Disk Disk
Client tools
Tools FastLoad
56 Phase 1

PE

Data
Host BYNET

AMP AMP

Disk Disk
Client Tools FastLoad
57 FastLoad Phases – Phase 2
Phase 2
• When loading completes, each AMP sorts the
target table, puts the rows into blocks, and
writes the blocks to the disk
• Fall back rows are then generated if required
Client Tools FastLoad
58 Phase 2

PE

BYNET

AMP AMP

Data
Disk
Client Tools FastLoad
59 FastLoad Script
fastload < floadjob > floadjob.out
.logon Tdpid/User,Passwd
.begin loading Customer Name of empty table
errorfiles custerr1, custerr2; Starts Phase 1
define
CustNum ( Integer ),
Name ( Char(20) ) Defines input
file = CustData.dat; record
insert into Customer values SQL Insert
(:CustNum, :Name); statement
.end Loading; Start phase 2; if
.logoff; omitted utility
will pause
Client Tools FastLoad
60 Paused FastLoad Job
SQL & Data
datafile1 PE

BYNET

AMP AMP

Disk Disk
Client Tools FastLoad
61 Paused FastLoad Job ….

PE
datafile1
Data
BYNET

AMP AMP

Disk Disk
Client Tools FastLoad
62 Paused FastLoad Job ….

PE
datafile n
Data
BYNET

AMP AMP

Disk Disk
Client Tools FastLoad
63 Paused FastLoad Job ….

PE

BYNET

AMP AMP

Disk Disk
Client Tools FastLoad
64 Error Tables
Error Table 1
Contains one row for each row which failed to be
loaded due to constraint violations or translation errors.
Column_Name Content
Error_Code The Error code in DBC.ErrorMsgs
Error Field name The column that cause the error
Data Parcel The data record sent by the host

Error Table 2
Captures rows that contain duplicate values for UPIs
Client Tools FastLoad
65 INMOD

Data INMOD FastLoad Teradata


Server

To acquire data from a non-standard data source, make


unusual conversion of data, FastLoad can use an
INMOD or exit routine.
Communication needs to be established between the
INMOD and FastLoad. This is done via return codes,
and the INMOD will pass data records to FastLoad.
Client Tools FastLoad
66 INMOD/FastLoad Communication
INMOD to FastLoad return codes
0 Indicates that INMOD is returning a record
Non 0 INMOD indicates end-of-file condition

FastLoad to INMOD return codes


0 Calling for the first time. INMOD should open
files to read data. FastLoad expects a record.
1 indicates Next Record Transfer
Client Tools FastLoad
67 Additional Return Codes
FastLoad to INMOD
3 FastLoad has been restarted. INMOD should
position itself to the last checkpoint. FastLoad is
not expecting a record and will not send a zero
return code.
2 Indicates a checkpoint has been written and
INMOD should remember it. No record
expected.
4 Indicates a Teradata failure, INMOD should
position itself to the last checkpoint. No record
expected.
5 FastLoad instructs INMOD to clean up.
Client Tools FastLoad
68 Other FastLoad Commands
AXSMOD init-string (optional )
SESSIONS max [min]
ERRLIMIT max rejected records
TENACITY hours
SLEEP minutes
DATEFORM integerdate/ansidate
Client Tools FastLoad
69 Application Utility Checklist
BTEQ FastLoad Fast Export MultiLoad TPump
DDL Functions All Limited
DML Functions All INS
Multiple DML Yes No
Multiple tables Yes No
Multiple sessions Yes Yes
Protocol used SQL FastLoad
Conditional Exp. Yes No
Arithmetic Calc Yes No
Data conversion Yes Limited
Error files No Yes
Error limits No Yes
User routines No Yes
Client Tools
70 Support Environment
• Launch vehicle for utilities such as MultiLoad, Fast
Export and TPump
• Provides a fully nested .RUN file facility
• Interprets utility commands and provides error
reporting
• Supports a wide range of DDL and DML commands
• Allows for conditional processing of commands
• Supports system and user defined variables
• Provides recovery management from a Teradata or
host failure
Client Tools Support
71 Invoking Utilities Environment

MultiLoad is invoked with:


.BEGIN IMPORT MLOAD
or
.BEGIN DELETE MLOAD

Fast Export is invoked with:


.BEGIN EXPORT

TPump is invoked with:


.BEGIN LOAD
Client Tools Support
72 Invoking Utilities …. Environment

A sample Fast Export script


.logtable cust_table;
.logon mac/user,passwd;
.begin export;
Support
.export outfile Dataout; Environment
Commands
select * from Transaction;
.end export;
.logoff
Client Tools Support
73 Commands Environment

.LOGTABLE Acquires or creates the restart log table


.LOGON Connects multiple session to Teradata
.LOGOFF Terminates the utility operation
.RUN Specifies an external script file
.IF/.ELSE Identifies statements to be executed if
certain conditions are true or otherwise
.ENDIF Resumes the program after a .IF condition
.DISPLAY Writes messages to a specific destination
.SET Assigns a data type and value to a variable
Client Tools Support
74 System Variables Environment

.SET var [TO] expression; Permits a variable to be set


or reset to an expression or a
pre-existing variable
Variable Description Format Example
&SYSDATE System Date YY/MM/DD 98/04/01
&SYSTIME System Time HH:MM:SS 11:05:00
&SYSDAY Day Of Week X(3) MON
&SYSOS Host Op. System X(5) VM/SP
&SYSUSER User Id BRM
Client Tools Support
75 Example Environment
Create or acquire
.logtable cust_logtable; restart log table
.run File Logon; Accept LOGON
.IF ‘&SYSDAY’ NE ‘FRI’ THEN string from Logon
.DISPLAY ‘This job runs File
Fridays Check for Day of
only’ TO file ErrFile; week. Write a
.LOGOFF; message and
.ENDIF; terminate job if
****** not ‘FRI’
******
****** Invoke utility
.begin import mload
******
Client Tools
76 Fast Export
• Exports large volumes of formatted data from
Teradata to a host file or user-written application
• Export from multiple tables
• Uses support environment
• Fully automated restart
Client Tools Fast Export
77 BEGIN Export
.BEGIN EXPORT
SESSIONS max min
TENACITY hours
SLEEP minutes
NOTIFY high | medium | low | ;

To Specify:
• Number of SESSIONS required
• Number of hours Fast Export will try to establish a
connection
• Number of minutes between each logon attempts
• Parameter for specifying the notify user exit option.
Client Tools Fast Export
78 END Export
.END EXPORT
• Delimits a series of commands that define a single
EXPORT action
• Must be the last directive in a Fast Export script
• Causes the utility to send the SELECT to the
Teradata Database
Client Tools Fast Export
79 Sample Fast Export Script

.logtable RestartLog; Define Restart Log


.run file logon;
.begin export sessions 12; Specify sessions.
.export outfile dataout; Destination file.
select * from Customer;
.end export; Send request
.logoff; Terminate sessions
Client Tools Fast Export
80 Application Utility Checklist
BTEQ FastLoad Fast Export MultiLoad TPump
DDL Functions All Limited No
DML Functions All INS SEL
Multiple DML Yes No Yes
Multiple tables Yes No Yes
Multiple sessions Yes Yes Yes
Protocol used SQL FastLoad EXPORT
Conditional Exp. Yes No Yes
Arithmetic Calc Yes No Yes
Data conversion Yes Limited Yes
Error files No Yes No
Error limits No Yes No
User routines No Yes Yes
Client Tools
81 MultiLoad
• Supports up to five populated tables
• Multiple operations with one pass of input files
• Conditional logic for applying changes
• Supports Inserts, UPDATEs, DELETEs and
UPSERTs
• Full restart capability
• Error reporting via error tables
• Support for INMODs
Client Tools
82 MultiLoad

Table A
Table B
update Insert
MultiLoad Table C
Delete
Table D
Host Table E

Server
Client Tools MultiLoad
83 MultiLoad Limitations
• No data retrieval capability
• Arithmetic functions, exponentiation or
aggregates are not processed
• Cannot process tables with Secondary Indexes or
Referential Integrity defined
• Import tasks require use of Primary Index
Client Tools MultiLoad
84 MultiLoad Tasks
MultiLoad allows INSERT, UPDATE, DELETE and
UPSERT operations against up to five target tables per
task.
Two distinct tasks are:
IMPORT task:
These are the tasks which intermix a number of different
SQL/DML statements and apply them to up to five
different tables depending on the APPLY conditions

DELETE task:
These are tasks which execute a single DELETE statement
on a single table.
Client Tools MultiLoad
85 IMPORT TASK
Host inserts
updates
Input
deletes
Data
upserts

MultiLoad

Apply Conditions
Server

T1 T2 T3 T4 T5
Client Tools MultiLoad
86 DELETE TASK
Host
Data value

deletes only

MultiLoad

Server delete Rows

T1
Client tools MultiLoad
88 Sample MultiLoad Script
.logtable logtable001; define logtable
.logon TDPID/User/Passwd;
.begin mload tables Emploee, Emp_History; begin loading
.layout Employee_Trans; define
.filler Transcode 1 char(3);
.field Empno * smallint;
.field Deptno * smallint;
.field Salary * decimal(8,2);
.dml label payroll;
do insert for missing update rows;
update Employee set Salary = :Salary where
Empno = :Empno;
insert into Employee (Empno, Salary ) values
(:Empno, :Salary );
Client Tools MultiLoad
89 Sample MultiLoad Script ….
.dml label Terminate;
delete from Employee where Empno = :Empno;
insert into Emp_History (Empno, Deptno)
values (:Empno, :Deptno );
.import infile Filename; File name
layout Employee_Trans Insert
apply Payroll where Transcode = ‘PAY’ statement
apply Terminate where Transcode = ‘DEL’;
.end mload End loading
.logoff
Client Tools MultiLoad
90 Script Components
.logtable defines the name of the restart log.
.logon defines username which will own the sessions.
.begin mload tables defines the tables which will
participate in the MultiLoad.
.layout defines the layout of the incoming record(s).
.field defines the name of an input field, its position in the
record, and its datatype.
.dml label defines a set of DML instructions which will
be applied if conditions are met.
Client tools MultiLoad
91 Script Components ….
do insert for missing update rows indicates that UPSERT
processing follows:
do update if present.
do insert if not present.
.import infile references filename of the input file.
layout references previously defined layout.
apply references label to be applied and conditions
under which to do so.
.end mload defines end of MultiLoad script.
.logoff terminate the sessions.
Client Tools MultiLoad
92 IMPORT Phases
IMPORT consists of five separate phases of processing.
Preliminary Phase Basic setup
DML Phase Get DML steps down on AMPs
Acquisition Phase Send the input data to AMPs and
sort it
Application Phase Apply the input data to the
appropriate target tables
End Phase Basic clean up
Client Tools MultiLoad
93 Preliminary Phase
Validate all statements MultiLoad and SQL
Start all sessions #AMPS + 2
Create work tables One per target table
Create error tables Two per target table
Create restart log One per IMPORT run
Apply locks to target tables Prevent DDL
Client Tools MultiLoad
94 DML Transaction Phase
Send prototype DML to the Server
Send DML steps in work tables
Add a USING modifier to the request
Host data to be filled in from input file
Client Tools MultiLoad
95 Acquisition Phase
Get the data from host and apply it to appropriate AMP
worktables.
- Duplicate rows for each successful APPLY
- Make blocks and send to AMPs
- Deblock and resend record to ‘correct’ AMP
Reblock and store in worktable of target table.
- Sort the reblocked records in the work tables
- Sort by hash value and sequence to be applied
Set up transition to the application phase.
- Upgrade locks on target tables to write
- Set table headers for application phase
Client Tools MultiLoad
96 Application Phase
Execute MLOAD for each target table as a single multi-
statement request.
- End of host interaction until end of phase
- AMPs independently apply changes to target
tables
- Executed as a single transaction without
rollback
- Restartable based on last checkpoint
- No Transient Journal needed
Client Tools MultiLoad
97 Cleanup Phase
Execute END MLOAD processing as a series of
transactions performed by the host utility.
- All locks are released
- Table headers are restored across all AMPs
- Dictionary cache of Target tables is spoiled
- Statistics are reported
- Final error code is reported
- Target tables are made available to other users
- Work tables are dropped
- Logtable is dropped
Mload Session logoff.
- Logoff request sent to each AMP with a session
Client Tools MultiLoad
98 DELETE/IMPORT Differences
DELETE tasks operate very similarly to IMPORT tasks
with some differences.
• Deleting based on a Primary Index is not permitted
• DML DELETE statement sent to each AMP with a
match tag parcel
• No Acquisition phase because no variable input
record to apply
• Application phase reads each target block and
deletes qualifying rows
• All other aspects similar to IMPORT task
Client Tools MultiLoad
99 Restarting MultiLoad
DBC restart
• MLOAD reinitiated automatically after DBC
recovery
• Continue from checkpoint without user interaction
Host restart
• Resubmit the script as-is
• MLOAD determines its stopping point and restarts
Client Tools MultiLoad
100 Application Utility Checklist
BTEQ FastLoad Fast Export MultiLoad TPump
DDL Functions All Limited No All
DML Functions All INS SEL Ins/upd/del
Multiple DML Yes No Yes Yes
Multiple tables Yes No Yes Yes
Multiple sessions Yes Yes Yes Yes
Protocol used SQL FastLoad EXPORT MultiLoad
Conditional Exp. Yes No Yes Yes
Arithmetic Calc Yes No Yes Yes
Data conversion Yes Limited Yes Yes
Error files No Yes No Yes
Error limits No Yes No Yes
User routines No Yes Yes Yes
Client Tools
101 TPump
• Allows near real-time updates from transactional
systems into the wearhouse
• Performs INSERT, UPDATE, and DELETE
operations, or a combination, to more than 60 tables
at a time from the same source
• Alternative to MultiLoad for low-volume batch
maintenance of large databases
• Allows target tables to:
- Have secondary indexes and Referential Integrity
constraints
- Be MULISET or SET
- Be populated or empty
Client Tools
102 TPump
• Allows conditional processing
• Supports automatic restarts
• No session limit
• Uses row-hash locks, allowing concurrent updates on
the same table
• User can specify how many updates occur minute by
minute
• No limit to the number of concurrent instances
Client Tools TPump
103 Limitations
• Exponential operators are not allowed
• Aggregate operators are not allowed
• Arithmetic functions are not supported
• There is a limit of four IMPORT commands
within a single TPump “load” task
Client Tools TPump
104 TPump Sample Script

.logtable logtbl002;
.logon TDPID/User,Passwd;
.begin load
errlimit 50
checkpoint 1
sessions 11
tenacity 2
error table tlnterr BTET pack 10;
.layout lay1a;
.filler ATest * byteint;
.field AByteInt * byteint;
.field AInteger * integer;
Client Tools TPump
105 TPump Sample Script ….

.dml label labela


ignore duplicate rows
ignore missing rows
ignore extra rows
insert into TPumptbl values (:AByteInt, :AInteger );
.dml label labelb
ignore missing rows
ignore extra rows
do insert for missing update rows;
update TPumptbl set AInteger = AInteger + 1
where AByteInt = :AByteInt;
insert into TPumptbl values (:AByteInt, :Ainteger);
Client Tools TPump
106 TPump Sample Script ….

.import infile TPumptbl.dat


layout lay1a from 1 for 400
apply labela where ATest = 1;
.import infile Tpumptbl.dat
layout lay1a from 1 for 400
apply labelb;
.end mload;
.logoff;
Client Tools TPump
107 TPump / MultiLoad
• MultiLoad performance improves as the volume of
changes increases.
• TPump does better on relatively low volumes of
changes
• TPump uses macros to modify tables rather than actual
DML commands
• MultiLoad uses the DML statements.
• TPump uses row hash locking to allow for concurrent
read and write access to target tables.
• MultiLoad locks tables for write access (Phase 2) until
it completes
Client Tools TPump
108 Application Utility Checklist
BTEQ FastLoad Fast Export MultiLoad TPump
DDL Functions All Limited No All All
DML Functions All INS SEL Ins/upd/del I/U/D
Multiple DML Yes No Yes Yes Yes
Multiple tables Yes No Yes Yes Yes
Multiple sessions Yes Yes Yes Yes Yes
Protocol used SQL FastLoad EXPORT MultiLoad TPump
Conditional Exp. Yes No Yes Yes Yes
Arithmetic Calc Yes No Yes Yes No
Data conversion Yes Limited Yes Yes Yes
Error files No Yes No Yes Yes
Error limits No Yes No Yes Yes
User routines No Yes Yes Yes Yes
Client Tools
109 Choosing The Best Method
• Utility support
- Does it run on your host?
• Restart capability
- Is there a restart log?
- What happens with a Teradata restart?
- What happens if the host fails?
• Multiple sessions
- Does the utility support multiple sessions?
- How do you choose the optimum number?
• Error handling
- Are errors captured in an error file?
- Do you have control over error handling?
• Does the utility support INMODs?

You might also like