Teradata Utilities

download Teradata Utilities

of 88

  • date post

    31-Oct-2014
  • Category

    Documents

  • view

    307
  • download

    10

Embed Size (px)

description

Teradata Utilities

Transcript of Teradata Utilities

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 channelattached mainframes and LAN-attached clients Regardless of host platform, all access between the host and the Teradata Database relies on Call Level Interface

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

Client Tools 4

Application Utilities .Operating System Fast Loa d Support Environment Mult i Loa CLI d Host Fast Expor t TPum p

BTEQ

Server

Client Tools 5

Request and Response FlowRequest CLI

Applicati on

MTDP MOSI Response Serve r

Client Tools 6

Data Flow

HostBTEQ FastLoad MultiLoad Gateway PE PE TPump Fast Export

AMPData Disk

AMP

AMPData

AMP

Disk

Disk

Disk

Client Tools 7

Application DevelopmentINMODs

More

Flexibility Application Utilities Easy Ease of Use Difficult

Less

election of the right vehicle can be crucial and epends on how difficult it is to implement and maintain Offer less complexity Takes full advantage of parallel processing

Use of application utilities

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

Client Tools 9

Using An INMOD RoutineIMS ORACLE

Userwritten INMOD FastLoad, MultiLoad, TPump,

Server

10

Client ToolsBTEQ 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 12 BTEQ script .logon select .logoff

Request FlowBTEQNetwork attached ClientCLI MTDP MOSI

BTEQ

ServerPE AMP Data AMP Data AMP Data AMP Data

Client Tools 13 BTEQ script .logon select .logoff

Response FlowCLI

BTEQ

BTEQNetwork attached Client

MTDP MOSI

PE AMP

Generated answer set

Server

AMP

AMP

AMP

Data

Data

Data

Data

Client Tools 14

Conditional Logic

BTEQ

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, timeconsuming steps

Client Tools 15

Conditional Logic - Example

BTEQ

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

Client Tools 16

Command Set

BTEQ

BTEQ commands can be classified as follows: Session control commands File control commands Sequence control commands Format control commands

Client Tools 17

Session Control Commands

BTEQ

Controls session characteristics. Commands:LOGON SESSIONS LOGOFF QUIT,EXIT SHOW CONTROLS SESSION TRANSACTION

Client Tools 18

File Control Commands

BTEQ

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 19

Sequence Control Commands

BTEQ

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 40

Format Control Commands

BTEQ

To specify the way in which BTEQ presents information on the screen/printer. Commands:FOOTING HEADING RETLIMIT FOLDLINE SUPPRESS QUIET

Client Tools 41

EXPORT

BTEQ

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 42

EXPORT

BTEQ

BTEQ Script .logon mac/user,passwd .export data file=x.dat sel * from table; .export reset .quit; Logon complete 1200 rows returned Time 15 seconds Default Output 12348009 23498763 8568733 933435490 x.dat

BTEQ

Client Tools 43

EXPORT TypesREPORT DATA INDICDATA DIF

BTEQ

.EXPORT .EXPORT .EXPORT .EXPORT

Output converted to DIF used to transport data to various PC programs. Example: dBase, Lotus 12-3

.EXPORT RESETReverses the effect of a previous .EXPORT

Client Tools 44

Data Modes

BTEQ

Field mode is set by .EXPORT REPORT .EXPORT REPORTSends results to a host file in field mode. Data set contains column headings and formatted data. column A 1 4 7 column B 2 5 8 column C 3 6 9

Transfers data one column at a time with numeric data converted to character.

Client Tools 45

Data Modes .

BTEQ

Record mode is set by .EXPORT DATA. .EXPORT DATASends 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 46

Data Modes .

BTEQ

Record mode is set by .EXPORT INDICDATA. .EXPORT INDICDATASends query results that contain indicator variables to a host file. Allows host programs field1 field2 field3 field4 to Ind with NULLs. deal Var 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 47

Indicator Variables

BTEQ

Indicator variables allow utilities to process records that contain NULL indicators. .EXPORT INDICDATA .[SET] INDICDATA [ON] INDICATORS ON INDICATORS ExportNULL ColumnsF 010010 00000000 F 1 2 00 F 3 F 4 F 5 F 6 F 7

-

BTEQ BTEQ FastLoad MultiLoad, Fast TPump

.. .

F1 2

Client Tools 48

Data Handling With IMPORT

BTEQ

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 49

Data Load From Host

BTEQ

.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

Client Tools 50

Application Utility Checklist

BTEQ

BTE FastLoa Fast Export DDL Functions QAll d DML Functions All Yes Multiple DML Multiple tables Yes Yes Multiple SQ sessions used Protocol L es Y Conditional Exp. Arithmetic Yes Calc Data Yes conversion Error files No Error limits No User routines No

MultiLoa TPum d p

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 52

Purpose/Concepts

FastLoad

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 53

Restrictions

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

Client Tools 54

FastLoad Phases Phase 1

FastLoad

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