Top Banner
Teradata Client Tools 1
88

Teradata Utilities

Oct 31, 2014

Download

Documents

Vishal Gupta

Teradata Utilities
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Teradata Utilities

Teradata Client Tools 1

Page 2: Teradata Utilities

Client Tools 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)

2

Page 3: Teradata 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 Application Utilities ….3

Page 4: Teradata Utilities

CLI

Support Environment

Client Tools Application Utilities ….

BTEQFast Load

Multi

Load

Fast Expor

t

TPump

Operating System

Host

Server

4

Page 5: Teradata Utilities

Request and Response Flow

ApplicatiApplicationon

CLICLI

MTDPMTDP

MOSIMOSI

ServeServerr

Request

Response

Client Tools5

Page 6: Teradata Utilities

Data Flow Data Flow Client Tools

BTEQ FastLoad MultiLoad TPump Fast Export

Gateway Gateway

PE PE

AMP AMP AMP AMP

Disk

Data Data

Disk Disk Disk

Host

6

Page 7: Teradata Utilities

Application

Client ToolsApplication Development

INMODs

Utilities

Easy Ease of Use Difficult

More

Flexibility

Less

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

7

Page 8: Teradata Utilities

Client ToolsUsing 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

8

Page 9: Teradata Utilities

ServerServer

User–written INMODUser–written INMOD

Client ToolsUsing An INMOD Routine

IMSIMS ORACLEORACLE

FastLoad, MultiLoad, TPump, …FastLoad, MultiLoad, TPump, …

9

Page 10: Teradata Utilities

Client Tools

BTEQ

FastLoad

MultiLoad

Fast Export

TPump

10

Page 11: Teradata Utilities

Client ToolsBTEQ

• 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

11

Page 12: Teradata Utilities

DataData

Client Tools BTEQRequest Flow

CLI

MTDP

MOSI

BTEQ script .logon select .logoff

BTEQ

PE

AMP AMP AMP AMP

DataData DataData DataData

Server

Network attached Client

12

Page 13: Teradata Utilities

BTEQ script .logon select .logoff

Network attached Client

Client Tools BTEQResponse Flow

Generated answer set

CLI

MTDP

MOSI

AMP AMP AMP AMP

PE

DataData DataData DataData DataData

Server

BTEQ

13

Page 14: Teradata Utilities

Client Tools BTEQConditional 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

14

Page 15: Teradata Utilities

Client Tools BTEQConditional Logic - Example

DELETE Customer_Info ALL;.IF ERRORCODE = 0 THEN .GOTO TableOKCREATE TABLE Customer_Info ( Acc_no INTEGER, Cust_Name VARCHAR(20), Balance DECIMAL(9,2));.LABEL TableOKINSERT 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

15

Page 16: Teradata Utilities

Client Tools BTEQCommand Set

BTEQ commands can be classified as follows:

• Session control commands

• File control commands

• Sequence control commands

• Format control commands

16

Page 17: Teradata Utilities

Client Tools BTEQSession Control Commands

Controls session characteristics.

Commands:LOGONSESSIONSLOGOFFQUIT,EXITSHOW CONTROLSSESSION TRANSACTION

17

Page 18: Teradata Utilities

Client Tools BTEQFile Control Commands

Specify the format of incoming/outgoing information and identify the source and destination of input/output streams.

Commands:OSRUNIMPORTREPEATQUIETEXPORTINDICDATA/RECORDMODE

18

Page 19: Teradata Utilities

Client Tools BTEQSequence Control Commands

Controls the sequence in which other BTEQ commands and SQL statements will be executed within the scripts and macros.

Commands:IF THENELSEENDIFGOTO

19

Page 20: Teradata Utilities

Client Tools BTEQFormat Control Commands

To specify the way in which BTEQ presents information on the screen/printer.

Commands:FOOTINGHEADINGRETLIMITFOLDLINESUPPRESSQUIET

40

Page 21: Teradata Utilities

Client Tools BTEQEXPORT

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.

41

Page 22: Teradata Utilities

Client Tools BTEQEXPORT

.logon .logon mac/user,passwdmac/user,passwd

.export data .export data file=x.datfile=x.dat

sel * from table;sel * from table;

.export reset.export reset

.quit;.quit;

BTEQ Script

BTEQ

Logon completeLogon complete1200 rows returned1200 rows returnedTime 15 secondsTime 15 seconds

Default OutputDefault Output

1234800912348009234987632349876385687338568733933435490933435490

x.datx.dat

42

Page 23: Teradata Utilities

Client Tools BTEQEXPORT 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

43

Page 24: Teradata Utilities

Client Tools BTEQData 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.

44

Page 25: Teradata Utilities

Client Tools BTEQData 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.

45

Page 26: Teradata Utilities

Client Tools BTEQData Modes ….

Record mode is set by .EXPORT INDICDATA.

.EXPORT INDICDATASends query results that contain indicator

variables to a host file. Allows host programs to deal with NULLs.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.

Ind Var

46

Page 27: Teradata Utilities

F1

F2

F3

F4

F5

F6

F7

F12

…...

01001000

00000000

Client Tools BTEQIndicator Variables

Indicator variables allow utilities to process records that contain NULL indicators.

.EXPORT INDICDATA - BTEQ

.[SET] INDICDATA [ON] - BTEQINDICATORS ON - FastLoadINDICATORS - MultiLoad, Fast Export TPump

NULL Columns

47

Page 28: Teradata Utilities

Client Tools BTEQData 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

48

Page 29: Teradata Utilities

Client Tools BTEQData 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.

49

Page 30: Teradata Utilities

Client ToolsApplication Utility Checklist

DDL Functions

User routines

DML FunctionsMultiple DML Multiple tablesMultiple sessionsProtocol usedConditional Exp.Arithmetic CalcData conversionError files

Error limits

FastLoaFastLoaddAll

AllYesYesYesSQLYes

Yes

Yes

No

No

No

BTEQ

Fast Fast ExportExport

MultiLoaMultiLoadd

TPumTPumpp

BTEBTEQQ

50

Page 31: Teradata Utilities

Client ToolsFastLoad

• 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

51

Page 32: Teradata Utilities

Client ToolsPurpose/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.

FastLoad

52

Page 33: Teradata Utilities

Client ToolsRestrictions

FastLoad

• 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

53

Page 34: Teradata Utilities

FastLoadFastLoadFastLoad 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

54

Page 35: Teradata Utilities

FastLoadFastLoad Phase 1

BYNETBYNET

Host

DiskDisk

AMP AMP

DiskDisk

SQL & DataPE

Client Tools

55

Page 36: Teradata Utilities

Client tools FastLoadClient Tools FastLoad Phase 1

HostData

BYNETBYNET

PE

AMP AMP

DiskDiskDiskDisk

56

Page 37: Teradata Utilities

FastLoadClient Tools FastLoadFastLoad 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

57

Page 38: Teradata Utilities

FastLoadClient Tools FastLoad Phase 2

PE

BYNETBYNET

AMP AMP

Data

Disk

58

Page 39: Teradata Utilities

Client Tools FastLoadFastLoad Script

fastload < floadjob > floadjob.out.logon Tdpid/User,Passwd.begin loading Customer errorfiles custerr1, custerr2;define CustNum ( Integer ), Name ( Char(20) )file = CustData.dat;insert into Customer values (:CustNum, :Name);.end Loading;.logoff;

Name of empty tableStarts Phase 1

Defines input record

SQL Insert statement

Start phase 2; if omitted utility will pause

59

Page 40: Teradata Utilities

FastLoadPaused FastLoad Job

Client Tools FastLoad

datafile1

DiskDisk

SQL & Data PE

BYNETBYNET

AMP AMP

DiskDisk

60

Page 41: Teradata Utilities

AMP AMP

FastLoadPaused FastLoad Job ….

FastLoad

datafile1

DiskDisk DiskDisk

DataBYNETBYNET

PE

Client Tools

61

Page 42: Teradata Utilities

FastLoadPaused FastLoad Job ….

FastLoad

datafile n Data

PE

BYNETBYNET

AMP AMP

DiskDisk DiskDisk

Client Tools

62

Page 43: Teradata Utilities

AMP AMP

FastLoadPaused FastLoad Job ….

FastLoad

Disk Disk

PE

BYNETBYNET

Client Tools

63

Page 44: Teradata Utilities

Error TablesClient Tools FastLoad

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

Error Field nameData Parcel

The Error code in DBC.ErrorMsgsThe column that cause the error The data record sent by the host

Error Table 2

Captures rows that contain duplicate values for UPIs

64

Page 45: Teradata Utilities

INMODClient Tools FastLoad

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.

65

Page 46: Teradata Utilities

0

1

Calling for the first time. INMOD should open files to read data. FastLoad expects a record. indicates Next Record Transfer

0

Non 0

Indicates that INMOD is returning a recordINMOD indicates end-of-file condition

INMOD/FastLoad CommunicationClient Tools FastLoad

INMOD to FastLoad return codes

FastLoad to INMOD return codes

66

Page 47: Teradata Utilities

Additional Return CodesClient Tools FastLoad

3

2

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.

FastLoad to INMOD

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.

67

Page 48: Teradata Utilities

Other FastLoad CommandsClient Tools FastLoad

AXSMOD init-string (optional )

SESSIONS max [min]

ERRLIMIT max rejected records

TENACITY hours

SLEEP minutes

DATEFORM integerdate/ansidate

68

Page 49: Teradata Utilities

Client ToolsApplication Utility Checklist

FastLoad

DDL Functions

User routines

DML FunctionsMultiple DML Multiple tablesMultiple sessionsProtocol usedConditional Exp.Arithmetic CalcData conversionError files

Error limits

FastLoaFastLoaddAll

AllYesYesYesSQLYes

Yes

Yes

No

No

No

Fast Fast ExportExport

MultiLoaMultiLoadd

TPumTPumpp

BTEBTEQQ Limite

dINSNoNoYes

FastLoad No

No

Limited Yes

YesYes

69

Page 50: Teradata Utilities

Client Tools 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

70

Page 51: Teradata Utilities

Client ToolsInvoking Utilities

MultiLoad is invoked with: .BEGIN IMPORT MLOAD or .BEGIN DELETE MLOAD

Fast Export is invoked with: .BEGIN EXPORT

TPump is invoked with: .BEGIN LOAD

Support Environment

71

Page 52: Teradata Utilities

Client Tools Support Environment

Invoking Utilities ….

.logtable cust_table;

.logon mac/user,passwd;

.begin export;

.export outfile Dataout;

select * from Transaction;

.end export;

.logoff

Support Environment Commands

A sample Fast Export script

72

Page 53: Teradata Utilities

Client Tools Support Environment

Commands

.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

73

Page 54: Teradata Utilities

Client Tools Support Environment

System Variables

.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

74

Page 55: Teradata Utilities

.logtable cust_logtable;

.run File Logon;

.IF ‘&SYSDAY’ NE ‘FRI’ THEN

.DISPLAY ‘This job runs

Fridays only’ TO file ErrFile;

.LOGOFF;

.ENDIF;******************.begin import mload******

Client Tools Support Environment

ExampleCreate or acquire restart log tableAccept LOGON string from Logon File

Check for Day of week. Write a message and terminate job if not ‘FRI’Invoke utility

75

Page 56: Teradata Utilities

Client ToolsFast 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

76

Page 57: Teradata Utilities

Client Tools Fast ExportBEGIN 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.

77

Page 58: Teradata Utilities

Client Tools Fast ExportEND 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

78

Page 59: Teradata Utilities

Client Tools Fast ExportSample Fast Export Script

.logtable RestartLog;

.run file logon;

.begin export sessions 12;

.export outfile dataout;

select * from Customer;

.end export;

.logoff;

Define Restart Log

Specify sessions.

Destination file.

Send request

Terminate sessions

79

Page 60: Teradata Utilities

Client ToolsApplication Utility Checklist

Fast Export

DDL Functions

User routines

DML FunctionsMultiple DML Multiple tablesMultiple sessionsProtocol usedConditional Exp.Arithmetic CalcData conversionError files

Error limits

FastLoaFastLoaddAll

AllYesYesYesSQLYes

Yes

Yes

No

No

No

Fast Fast ExportExport

MultiLoaMultiLoadd

TPumTPumpp

BTEBTEQQ Limite

dINSNoNoYes

FastLoad No

No

Limited Yes

YesYes

NoSELYesYesYes

EXPORTYes

Yes

Yes

Yes

No

No

80

Page 61: Teradata Utilities

Client ToolsMultiLoad

• 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

81

Page 62: Teradata Utilities

Client ToolsMultiLoad

MultiLoad

Table ATable A

Table BTable B

Table CTable C

Table DTable D

Table ETable E

updateupdate

DeleteDelete

InsertInsert

Host

Server

82

Page 63: Teradata Utilities

Client ToolsMultiLoad Limitations

MultiLoad

• 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

83

Page 64: Teradata Utilities

Client ToolsMultiLoad Tasks

MultiLoad

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.

84

Page 65: Teradata Utilities

Client ToolsIMPORT TASK

MultiLoad

Input Data

T1

T2

T3

T4

T5

inserts updates deletes upserts

Apply Conditions

Host

Server

MultiLoad

85

Page 66: Teradata Utilities

Client ToolsDELETE TASK

MultiLoad

T1

delete Rows

Host

Server

Data value

deletes only

MultiLoad

86

Page 67: Teradata Utilities

Client toolsSample MultiLoad Script

MultiLoad

.logtable logtable001;

.logon TDPID/User/Passwd;

.begin mload tables Emploee, Emp_History;

.layout Employee_Trans; .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 );

define logtablebegin loadingdefine

88

Page 68: Teradata Utilities

Client ToolsSample MultiLoad Script ….

MultiLoad

.dml label Terminate; delete from Employee where Empno = :Empno; insert into Emp_History (Empno, Deptno) values (:Empno, :Deptno );.import infile Filename; layout Employee_Trans apply Payroll where Transcode = ‘PAY’ apply Terminate where Transcode = ‘DEL’;.end mload.logoff

File nameInsert statement

End loading

89

Page 69: Teradata Utilities

Client ToolsScript Components

MultiLoad

.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.

90

Page 70: Teradata Utilities

Client toolsScript Components ….

MultiLoad

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.

91

Page 71: Teradata Utilities

Client Tools IMPORT Phases

MultiLoad

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

92

Page 72: Teradata Utilities

Client ToolsPreliminary Phase

MultiLoad

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

93

Page 73: Teradata Utilities

Client ToolsDML Transaction Phase

MultiLoad

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

94

Page 74: Teradata Utilities

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’

AMPReblock and store in worktable of target table.

- Sort the reblocked records in the work tables

- Sort by hash value and sequence to be appliedSet up transition to the application phase.

- Upgrade locks on target tables to write

- Set table headers for application phase

Client ToolsAcquisition Phase

MultiLoad

95

Page 75: Teradata Utilities

Client ToolsApplication Phase

MultiLoad

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

96

Page 76: Teradata Utilities

Client ToolsCleanup Phase

MultiLoad

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 droppedMload Session logoff. - Logoff request sent to each AMP with a session

97

Page 77: Teradata Utilities

Client ToolsDELETE/IMPORT Differences

MultiLoad

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

98

Page 78: Teradata Utilities

Client ToolsRestarting MultiLoad

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

99

Page 79: Teradata Utilities

Application Utility ChecklistMultiLoad

AllIns/upd/delYes

YesYes

MultiLoad Yes

Yes

Yes

Yes

YesYes

DDL Functions

User routines

DML FunctionsMultiple DML Multiple tablesMultiple sessionsProtocol usedConditional Exp.Arithmetic CalcData conversionError files

Error limits

FastLoaFastLoaddAll

AllYesYesYesSQLYes

Yes

Yes

No

No

No

Fast Fast ExportExport

MultiLoaMultiLoadd

TPumTPumpp

BTEBTEQQ Limite

dINSNoNoYes

FastLoad No

No

Limited Yes

YesYes

NoSELYesYesYes

EXPORTYes

Yes

Yes

Yes

No

No

Client Tools

100

Page 80: Teradata Utilities

• 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 ToolsTPump101

Page 81: Teradata Utilities

Client ToolsTPump

• 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

102

Page 82: Teradata Utilities

Client ToolsLimitations

TPump

• 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

103

Page 83: Teradata Utilities

Client ToolsTPump Sample Script

TPump

.logtable logtbl002;

.logon TDPID/User,Passwd;

.begin load errlimit 50checkpoint 1sessions 11tenacity 2

error table tlnterr BTET pack 10;.layout lay1a;.filler ATest * byteint;.field AByteInt * byteint;.field AInteger * integer;

104

Page 84: Teradata Utilities

Client ToolsTPump Sample Script ….

TPump

.dml label labelaignore 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

+ 1where AByteInt = :AByteInt;insert into TPumptbl values

(:AByteInt, :Ainteger);

105

Page 85: Teradata Utilities

Client Tools TPump

.import infile TPumptbl.dat layout lay1a from 1 for 400apply labela where ATest = 1;

.import infile Tpumptbl.datlayout lay1a from 1 for 400apply labelb;

.end mload;

.logoff;

TPump Sample Script ….106

Page 86: Teradata Utilities

• 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 ToolsTPump / MultiLoad

TPump107

Page 87: Teradata Utilities

Client ToolsApplication Utility Checklist

AllI/U/DYesYesYes

TPumpYesNo

Yes

Yes

Yes

Yes

AllIns/upd/delYes

YesYes

MultiLoad Yes

Yes

Yes

Yes

YesYes

DDL Functions

User routines

DML FunctionsMultiple DML Multiple tablesMultiple sessionsProtocol usedConditional Exp.Arithmetic CalcData conversionError files

Error limits

FastLoadAll

AllYesYesYesSQLYes

Yes

Yes

No

No

No

Fast Export

MultiLoad

TPump

BTEQ Limite

dINSNoNoYes

FastLoad No

No

Limited Yes

YesYes

NoSELYesYesYes

EXPORTYes

Yes

Yes

Yes

No

No

TPump108

Page 88: Teradata Utilities

• 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?

Client ToolsChoosing The Best Method109