Teradata v13 New

28
 SURYA SOFTWARE SOLUTIONS SURYA Software Solutions Ph: 9966661188 TERADATA V13 What is Teradata? Teradata is a relational database management sy stem (RDBMS) That is: • An open system, running on a UNIX MP-RAS or Windows 2000 server platform. • Capable of supporting many concurrent (legally/multi) users from various client Platforms (over a TCP/IP or IBM channel connection). It acts as a server • Compatible with industry  standards (ANSI (  American National Standards Institute)).ASCII. BTET(Basic Teradata Transaction/tranformation) ………..ANSI/ASCII • Built on a parallel architecture. Why Teradata? # 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Transcript of Teradata v13 New

Page 1: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 1/28

  SURYA SOFTWARE SOLUTIONS

SURYA Software SolutionsPh:

9966661188

TERADATA V13

What is Teradata?

Teradata is a relational database management system (RDBMS)That is:

• An open system, running on a UNIX MP-RAS or Windows 2000server platform.

• Capable of supporting many concurrent (legally/multi) users fromvarious clientPlatforms (over a TCP/IP or IBM channel connection).

It acts as a server 

• Compatible with industry  standards (ANSI ( American National 

Standards Institute)).ASCII.

BTET(Basic Teradata Transaction/tranformation)………..ANSI/ASCII

• Built on a parallel architecture.

Why Teradata?

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 2: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 2/28

  SURYA SOFTWARE SOLUTIONS

Teradata Advantages

Unlimited, Proven Scalability (∏=1012 bytes =1000GB)

• Most Concurrent Users - Use multiple complex queries

• Unlimited Parallelism - Parallel sorts/aggregations, temporary tables - “shared-nothing”architecture

• Mature Optimizer - Complex queries, joins per query, ad-hoc Processing (translations)

• Model the Business - 3NF, robust (3D) view processing, star Schema

• Lowest TCO (total cost of owner) - Ease of setup and maintenance, robust parallelutilities, no

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 3: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 3/28

  SURYA SOFTWARE SOLUTIONS

re-orgs, lowest disk to data ratio, robust (HashAlgorithm)

expansion utility

• High Availability - No single point of failure, scalable of data loading, parallel load

utilities.Teradata History

1979 TERADATA CORPORATION GROUNDED IN LA, CA1982 YNET TECH ADOPTED.1983 THE 1ST DBC TD COMPUTER RELEASED,ITS REVENUE IS $3MILLION.1989 TD TOOK HELP OF NCR.1991 AT&T JOINED WITH NCR.1992 TD IS MERGED IN TO NCR.1996 AT&T CAME OUT OF TD, NCR ARE PARTNERS.1997 WORLDS 1ST COMMERCIAL WAREHOUSE REVENUE IS $200 MILLION.

2000 100 SYSTEMS GOT PRODUCTIONISED LIKE WALMART,CITIGROUP,FEDEXETC.2002 TDV2R5 RELEASED IN THE MARKET.2006 NCR , TD SEPERATED AND V2R6 RELEASED.2007 TDV2R12 RELEASED IN THE MARKET2010—Teradata V13 ReleasedTeradata Features

• Designed to process large quantities of detail data.

• Ideal for data warehouse applications.

• Parallelism makes easy access to very large tables possible.

• Open architecture (system) – uses industry standard components.

• Performance increase is linear as components (nodes) are added.

• Runs as a database server to client applications.

• Runs on multiple hardware platforms.

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 4: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 4/28

  SURYA SOFTWARE SOLUTIONS

 

TERADATA COMPONENTS

1) P.E 2) BYNET 3) AMP 4) VDISKS

  P.E Architecture

 

The Parsing Engine is responsible for:

• Managing individual sessions (up to 120 sessions per PE)

• Parsing and optimizing your SQL requests

• Building query plans with the parallel-aware, intelligent Optimizer 

• Dispatching the optimized plan to the AMPs

• Sending the answer set response back to the requesting client.

  BYNET(Banyan Network) Architecture

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 5: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 5/28

  SURYA SOFTWARE SOLUTIONS

• Automatic load balancing of message traffic.• Automatic reconfiguration after fault detection.

The BYNET connects all the AMPs on the system:• Between nodes, the BYNET hardware carries broadcast and point-to-

point Communications. (1 AMP….1AMP)• On a node, BYNET software and PDE together control which AMPs

receive a multicast communication (1….more, 1….many.)(1….more AMPs)

BYNET Features:

• Enables multiple SMP nodes (MPP) to communicate.• Automatic load balancing of message traffic.

• Automatic reconfiguration after fault detection.• Fully operational dual BYNETs provide fault tolerance.• Scalable bandwidth as nodes are added.

  Access Module Processor (AMP)

Amp is called as Heart of teradata and every AMP will consists of its

own virtual disk(VDISK)

It retrieves data and updates the data on its own vdisks

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 6: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 6/28

  SURYA SOFTWARE SOLUTIONS

AMPs are responsible for:

• Storing and retrieving rows to and from disks• Lock management (lock/unlock)• Sorting rows and aggregating columns• Join processing• Output conversion and formatting (ANSI, ASCII, EBCDIC)• Creating answer sets for clients• Disk space management and Accounting• Recovery processing (ARC, LOCKS, JOURNAL, FALLBACK...)

  FAULT T OLERANCES:

Fallback: A fallback table is a duplicate copy of a primary table. Each row in a fallback 

table is stored on an AMP different from the one to which the primary row

hashes. This reduces the likelihood of loss of data due to simultaneous losses of the 2 AMPs or their associated disk storage.

AMP Clusters:

Clustering is a means of logically grouping AMPs to minimize (or eliminate)

data loss that might occur from losing an AMP. Note that AMP clusters are

used only for fallback data.

Cliques

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 7: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 7/28

  SURYA SOFTWARE SOLUTIONS

• The clique is a feature of multinode systems that physically groups nodes together by

multiported access to common disk array units.

• A clique is the mechanism that supports the migration of vprocs under PDE following a

node failure. If a node in a clique fails, then AMP and PE vprocs migrate to other nodes

in the clique and continue to operate while recovery occurs on their home node.

• PEs for channel-attached hardware cannot migrate because they are dependent on the

hardware that is physically attached to the node to which they are assigned.

• PEs for LAN-attached connections do migrate when a node failure occurs, as do all

AMPs.

Hot Standby Nodes

The Hot Standby Node feature allows spare nodes to be incorporated into the production

environment so that the Teradata Database can take advantage of the presence of the

spare nodes to improve availability.

A hot standby node is a node that:

Is a member of a clique

Does not normally participate in the production

Can be brought into the production to compensate for the loss of a node in

the clique

Configuring a hot standby node can eliminate the system-wide performance degradation

associated with the loss of a single node in a single clique. When a node fails, the Hot

Standby Node feature migrates all AMP and PE vprocs on the failed node to other nodes

in the system, including the node that you have designated as the hot standby. The hot

standby node becomes a production node. When the failed node returns to service, it

 becomes the new hot standby node.

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 8: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 8/28

  SURYA SOFTWARE SOLUTIONS

  RAID Protection

RAID 1 (Mirroring)

• Each physical disk in the array has an exact copy in the same array.• The array controller can read from either disk and write to both.• When one disk of the pair fails, there is no change in performance.• Mirroring reduces available disk space by 50%.• Array controller reconstructs failed disks quickly.• good performance with disk failures• higher cost in terms of disk space

RAID 5 (Parity)

• Data and parity are striped across a rank of 4 disks.• If a disk fails, any missing block may be reconstructed using the other three

disks.

• Parity reduces available disk space by 25% in a 4-disk rank.• Array controller reconstruction of failed disks takes lesser than RAID1.• Reduced performance with disk failure• Lower cost in terms of disk space  

TEMPORARY TABLES:

Global Temporary Tables:

Global temporary tables are tables that exist only for the duration of the

SQL session in which they are used.

The contents of these tables are private to the session, and the system

automatically drops the table at the end of that session.

However, the system saves the global temporary table definition

 permanently in the data dictionary. In addition, global temporary tables

allow the database administrator to define a template in the schema,

which a user can reference for their exclusive use during a session.

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 9: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 9/28

  SURYA SOFTWARE SOLUTIONS

Volatile Temporary Tables:

A volatile temporary table resides in memory but does not survive across

a system restart.

If a user needs a temporary table for a single use only, theyshould define a volatile temporary table.

Using volatile temporary tables improves performance even more than

using global temporary tables, since the system does not store the

definitions of volatile temporary tables in the data dictionary. Moreover,

users require no privilege to access volatile temporary tables.

The maximum number of temporary tables is provided in the

following table:

global temporary tables (materialized) 2000 per session.

volatile tables 1000 per session.

Primary Keys and Primary Indexes

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 10: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 10/28

  SURYA SOFTWARE SOLUTIONS

 

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 11: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 11/28

  SURYA SOFTWARE SOLUTIONS

  Teradata Tools & Utilities

Utility Purpose Features & LimitationsBTEQ(Basic TeradataQuery utility)

Import/export 1)it loads & unloads with minimal speed2)we can do transformations and error 

handling

Fast Load import 1)it loads data only on empty table

2)it loads data only one table at a time

3)we will perform only insert operation

4)it runs 2 phases5) Used for high volume data maintenance

with maximum speed

MultiLoad import 1)it loads into up to 5 tables

2)table may be empty or populated

3)it will perform insert ,update, delete &upsert4)it runs 5 phases

5) Used for high volume data maintenance

with maximum speed

TPump(Teradata parallel

data pump)

import 1)it loads data with minimum speed

2)we can use multiple sessions and

additional3)it loads INFINITY TABLES

4) it support constant loading with low

volume of data

5) we can perform insert ,update, delete and

upsert operationFast Export export 1)it support constant unloading with

maximum volume of data

2) we can use multiple sessions and

additional

3) it loads data with maximum speed

FASTEXPORT

FastExport is a command-driven utility that uses multiple sessions to quickly

transfer large

amounts of data from tables and views of the Teradata Database to a client-based

application.

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 12: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 12/28

  SURYA SOFTWARE SOLUTIONS

You can export data from any table or view to which you have the SELECT access

privilege.

The destination for the exported data can be:

• A file on your channel-attached or network-attached client system

• An Output Modification (OUTMOD) routine you write to select, validate, and

preprocess the exported data

The FastExport utility runs in the following operating modes:

• Interactive

• Batch

Fast export Commands

A FastExport job script, or program, is a set of FastExport commands and Teradata

SQL

statements that select and export data from the Teradata Database.

.LOGTABLE loginfotabl1;

.LOGON DEMOTDAT/DBC, DBC;

• Both the LOGTABLE and LOGON commands are required.

• LOGTABLE and LOGON command may appear in any order,

but must precede other commands except RUN commands used to identify the file

containing the LOGON command.

• If you enter the LOGON command first, the FastExport utility warns you that the

LOGTABLE command is also required.

• LOGTABLE specifies a restart log table for the FastExport checkpoint information.

.BEGIN EXPORT

SESSIONS max, min { Default 4, 1 }

TENACITY hours { Default 4}

SESSIONS: - maximum number of FastExport sessions that is logged on when youenter a LOGON command and, optionally,

the minimum number of sessions required to run the job.

NOTE:- If you specify a SESSIONS max value that is larger than the number

of available

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 13: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 13/28

  SURYA SOFTWARE SOLUTIONS

AMPs, the FastExport utility limits the sessions to one per working

AMP.

TENACITY: - Number of hours that the FastExport utility tries to log on to the

Teradata Database. The default value is 4.

SLEEP: - number of minutes that the FastExport utility waits between logon

attempts. The default value is 6.

.END EXPORT;

The END EXPORT command signifies the end of an export task and

initiates processing by the Teradata Database.

.EXPORT OUTFILE <ABC.TXT>

BLOCKSIZE <INTEGER>FORMAT FASTLOAD / BINARY / TEXT / UNFORMAT

MODE INDICATOR / RECORD

The EXPORT command provides the client system destination and file format

specifications

for the export data retrieved from the Teradata Database and, optionally,

generates a

MultiLoad script file that you can use to reload the export data.

OUTFILE: - data destination file on the client system. In UNIX andWindows, the fileid is the path name for a file. If the path name has

embedded white space characters, you must enclose the entire path name in

single or double quotes.

BLOCKSIZE: - maximum block size that should be used when returning datato the client.

The default block size is 64K bytes, which is the maximum

supported by the

Teradata Database V2R3.0 and later.

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 14: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 14/28

  SURYA SOFTWARE SOLUTIONS

Note: The BLOCKSIZE specification for a FastExport EXPORT

command cannot be larger than the row size supported by the

Teradata Database.

FORMAT: - Record format of the export file on network-attached systems

where:

• FASTLOAD specifies that each record is a two-byte integer, n,

followed by n bytes of data, followed by an end-of-record marker.

• BINARY specifies that each record is a two-byte integer, n, followed

by n bytes of data.

• TEXT specifies that each record is an arbitrary number of bytes,

followed by an end-of-record marker

• UNFORMAT specifies that each record is exported as it is received

from CLIv2 without any client modifications.

Note: The FORMAT options apply only to UNIX and Windows

platforms. The default, if you do not specify a FORMAT option, is

FASTLOAD.

MODE:- Format mode of the export data returned to the client system:

• INDICATOR

• RECORD

The default, if you do not specify a MODE option, is INDICATOR mode.

Note: The FastExport utility does not support field mode. To export field

mode data, use the appropriate format clauses in your SELECT statements

to enable the Teradata Database to convert response data to character form

SCRIPT:-

.LOGTABLE ismail.fexp_logtable;

.LOGON 127.0.0.1/dbc, dbc;

.BEGIN EXPORT

SESSIONS 6;

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 15: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 15/28

  SURYA SOFTWARE SOLUTIONS

.EXPORT OUTFILE ‘C:\abc.txt’ 

Mode RECORD

FORMAT TEXT;

SELECT CAST(

COALESCE (TRIM (cust_id),' ')|| '| '||

COALESCE (TRIM (income ),' ')|| '| '||

COALESCE (TRIM (age ),' ')|| '| '||

COALESCE (TRIM (years_with_bank ),' ')|| '| '||

COALESCE (TRIM (nbr_children),' ')|| '| '||

COALESCE (TRIM (gender ),' ')|| '| '||

COALESCE (TRIM (marital_status),' ') as char(300)) from

financial.customer;

.END EXPORT;

.LOGOFF;

--Exporting data from multiple tables to multiple sources—

.logtable retail.chandrika_log;

.logon 127.0.0.1/dbc,dbc;

.begin export

sessions 3;.export outfile "C:\Documents and Settings\Anay\Desktop\test1.txt"mode record

format text;select

cast

(coalesce(trim(l_orderkey),'')||'|'||

coalesce(trim(l_partkey),'')||'|'||coalesce(trim(l_suppkey),'')||'|'||

coalesce(trim(l_comment),'') as char(100))

from retail.item sample 100;.end export;

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 16: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 16/28

  SURYA SOFTWARE SOLUTIONS

.begin export;

.export outfile "C:\Documents and Settings\Anay\Desktop\test11.txt"

mode recordformat text;

selectcast

(

coalesce(trim(empno),'')||'|'||coalesce(trim(name),'')||'|'||

coalesce(trim(phone),'')||'|'||coalesce(trim(salary),'') as char(200))

from retail.employee;

.end export;

.logoff;

.quit;

Exporting from multiple tables to single file

.logtable retail.chandrika_log;

.logon 127.0.0.1/dbc,dbc;

.begin exportsessions 3;

.export outfile "C:\Documents and Settings\Anay\Desktop\test1.txt"mode record

format text;

selectcast

(coalesce(trim(l_orderkey),'')||'|'||

coalesce(trim(l_partkey),'')||'|'||

coalesce(trim(l_suppkey),'')||'|'||coalesce(trim(l_comment),'') as char(100))

from retail.item sample 100;

.export outfile "C:\Documents and Settings\Anay\Desktop\test1.txt"

mode recordformat text;

selectcast

(

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 17: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 17/28

  SURYA SOFTWARE SOLUTIONS

coalesce(trim(empno),'')||'|'||coalesce(trim(name),'')||'|'||

coalesce(trim(phone),'')||'|'||coalesce(trim(salary),'') as char(200))

from retail.employee;

.end export;

.logoff;

.quit;

Execution: start….>run…..>cmd…..>fexp<script path >logfilepath

. ….………………………>fexp<d:\fexp\fastexport_export.txt>d:\fastexport\log.txt

  FASTLOAD

1). Fastload is a BATCH MODE, command-driven utility that uses multiple sessions to

quickly transfer large amounts of data from

client-based application (flat files) to Teradata Database.

2). Fastload is used to load data into only one Empty table.

3). Target table should not contain secondary indexes, join indexes, transient journals.

By avoiding SI, JI, TJ fastload will be the fastest load in load utilities.

4). It can perform only insert operations.

5). Even if target table is NUPI and multiset, it will not allow duplicate records. It is fullyautomatic restartable and checkpoint configurable.

6). We can run 15 fastloads jobs concurrently.

Describe the two phases of FastLoad.

Phase 1

• FastLoad uses one SQL session to define AMP steps.

• The PE sends a block to each AMP which stores blocks of unsorted data

records.

• AMPs hash each record and redistribute them to the AMP responsible for 

the hash value.

• At the end of Phase 1, each AMP has the rows it should have, but the

rows are not in row hash sequence.

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 18: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 18/28

  SURYA SOFTWARE SOLUTIONS

Phase 2

• When the FastLoad job receives END LOADING; statement, FastLoad

starts Phase 2.

• Each AMP sorts the target table, puts the rows into blocks, and writes the

blocks to disk.

• Fallback rows are then generated if required.

• Table data is available when Phase 2 completes.

Infrastructure of FASTLOAD

1. LOGTABLE

In fastload logtable will be created defaultly in sysadmin.

  SYNTAX: .select * from sysadmin.fastlog;

2. ERROR TABLES-2

ERROR TABLES

Error table1. Error table 2.1. Conversion errors

2. Constraint errors 1.Unique violation errors.

3. Down amp errors

Example1:

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 19: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 19/28

  SURYA SOFTWARE SOLUTIONS

FastLoad froma UNIX Server 

SESSIONS8;

LOGONeduc2/bank, bkpasswd ;

BEGINLOADINGCustomer 

ERRORFILES CustrErr1, CustrErr2;

DEFINE in_CustNum (INTEGER)

,in_ SocSec (INTEGER)

,Filler (CHAR(40))

,in_Lname (CHAR(30))

,in_Fname (CHAR(20))

FILE= custdata .dat ;

INSERT INTOCUSTOMERVALUES (

:in_CustNum

,:in_Lname

,:in_Fname

,:in_ SocSec );

ENDLOADING;

LOGOFF;

fastload < /home/job1.fld > /home/job1.out

Input script file

name&output

file (report) name

Name of empty

table

Starts Phase1

Defines input

record

SQLInsert

statement

Start Phase2; if 

omitted, utilitywillpause

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 20: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 20/28

  SURYA SOFTWARE SOLUTIONS

Convertingthe Data

LOGONeduc2/user14, ziplock ;

DROPTABLEAccounts;

DROPTABLE Accts _ErrTab _1;

DROPTABLE Accts _ErrTab _2;

CREATETABLEAccounts, FALLBACK(Account_Number INTEGER

,Account_Status CHAR(15)

,Trans_Date DATE

,Balance_Forward DECIMAL(5,2)

,Balance_Current DECIMAL(7,2) )

UNIQUEPRIMARYINDEX(Account_Number);

BEGINLOADINGAccounts

ERRORFILES Accts _ErrTab _1, Accts _ErrTab _2;

DEFINE in_ Acctno (CHAR(9))

, in_ Trnsdate (CHAR(10))

, in_ Balcurr (CHAR(7))

, in_ Balfwd (INTEGER)

, in_Status (CHAR(10))

FILE=INFILE;

INSERTINTOAccounts

(Account_Number 

,Account_Status

,Trans_Date

,Balance_Forward,Balance_Current)

VALUES(

:in_ Acctno

,:in_Status,:in_ Trnsdate (Format ‘YYYY -MM -DD’)

,:in_ Balfwd

,:in_ Balcurr );

ENDLOADING;

LOGOFF;

FastLoadpermits

conversionfrom

onedatatypeto

another, once for 

eachcolumn.

Includingcolumn

namesprovidesscript documentation

whichmayaidinfuturewhen

debuggingor modifyingthejob

script.

Checkpoints:

a. Checkpoints entries posted to restart table (logtable) at regular

intervals during Fastload data transfer (checkpoint information

stores in Logtable).

b. If processing stops while Fastload job running. You can start from

recent checkpoint.

Ex: - You have 10, 00,000 records. U declared checkpoint 50,000

when each 50,000 records successfully completed Fastload

pushes and post entry to restart table. Your Fastload job stops at

1, 60,000 records. When restart same Fastload job it starts from

1, 50, 001 record.

><. To see error records, error records will be in error tables first we need to

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 21: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 21/28

  SURYA SOFTWARE SOLUTIONS

release error table.

><. To release error table .locking row for access select * from error table

name;

 NOTE:

1). If fastload is loading it failed in the middle of inserting records in to target table u don’thave access to view the

data in target table bcoz target table will be in lock(object level locking).

If u want to view the data release target table lock, in order to release target table lock 

run empty script.To run empty script remove .ins into target table command in script.

.i.e. Between .begin loading;

.end loading;

2).In fastload we can run multiple sources (up to 5 sources) to single target table.

 

M-LOAD Utility (MULTILOAD)

1) MLOAD is a command-driven utility.

2) MLoad uses multiple sessions to load large amount of data into teradata tables and

views to a client application

3) You can use 5 tables or views in one Mload job.

4) You can use Insert, Delete, Update, Upsert operations.5) Mload to import data from

..Source File on Network Attached systems

6) You can run Mload commands in Interactive, Batch operating modes.

7) Mload support flowing operating systems

a) Network attached workstations: - Window 2000, 2003, xp, UNIX MP-RAS and HP

 –UX, IBM AIX, Solaris SPARC and LINUX Red Hat 32-bit.

b) Channel attached systems: - IBM MVS, VM.

8) MLoad support Target Table already has data and empty tables also. FastlLoad

supports only for empty table.Mload is used as incremental loading

9) Target Table can have NUSI’s but not have unique secondary Indexs. Fast load will

not alloe secondary indexes

10)If Target Table is Multiset, Mload support duplicate rows. Fastload don’t allow

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 22: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 22/28

  SURYA SOFTWARE SOLUTIONS

duplicate rows even Target Table is MULTISET.

 Infrastructure of M-LOAD

1. LOGTABLE

2. ERROR TABLES-2

3. WORKTABLE-1

5Phases of Multiload Import Task 

Preliminary Phase

Start Multiload sessions

Create temporary tables.

Apply utility locks (disallow DDLs (create, drop, alter)) on the tables. DML Transaction Phase

Send DML requests, USING clause and Match-Tags to server.

Acquisition Phase Client sends data buffers to server 

AMPs receives the data blocks are redistributes (by row hash) each datarecords to its target AMPs.

Data rows are accumulated in work tables of corresponding target table.

At the end of acquisition phase it puts write locks on the target tables. Application Phase

Apply work table changes to target table.

Clean-up Phase

Release locks

Drop empty error tables, work table and log table.

Report load statistics(log file)

Logoff sessions.Target Table

1) Each IMPORT task can access upto 5 tables on the teradata database.

2) To perform import task, you must have appropriate access permission

(INSERT, DELETE, and UPDATE) on each target tables.

3) Target tables can Empty table. (but need not be Empty )

4) Target table have NUSI’s, but can not have unique secondary indexes

5) Each IMPORT task commend need not access same Target Table

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 23: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 23/28

  SURYA SOFTWARE SOLUTIONS

Checkpoints

a. Mload supports the use of Checkpoints

b. Checkpoints entries posted to restart table (logtable) at regular intervals

during Mload data transfer (checkpoint information stores in Logtable).

c. If processing stops while Mload job running. You can start from recent

checkpoint.

Ex: - You have 10, 00,000 records. U declared checkpoint 50,000 when

each 50,000 records

successfully completed MLoad pushes and post entry to restart table.

Your Mload job stops at 1, 60,000 records.

When restart same Mload job it starts from 1, 50, 001 record.

d. You enable checkpoint function by specifying at BEGIN IMPORT MLOADcommand.

BEGIN IMPORT MLOAD TABLES retail.sourcetable

WORKTABLES retail.WT_table

ERRORTABLES retail.cv_errtable1

Retail.uv_errtable2

CHECKPOINT 50,000

SAMPLE SCRIPT;

(MLOAD: IMPORTING DATA FROM FLAT FILE TO TABLE)

.LOGTABLE RETAIL.MLOAD_LOG1;

.logon 127.0.0.1/dbc, dbc;

.BEGIN IMPORT MLOAD TABLES RETAIL.ITEM3

ERRORTABLES RETAIL.MLOADERR1

RETAIL.MLOADUV

WORKTABLES RETAIL.WT

SESSIONS 8

ERRLIMIT 20

CHECKPOINT 400; /*TILL THIS LINE: initialization phase*/

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 24: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 24/28

  SURYA SOFTWARE SOLUTIONS

.LAYOUT gopal;

.FIELD L_ORDERKEY *VARCHAR(10);

.FIELD L_PARTKEY * VARCHAR(30);

.DML LABEL gopal1

INSERT INTO RETAIL.ITEM3.*;

.IMPORT INFILE 'D:\Documents and Settings\ANAY\Desktop\TD practice\ITEM_2.TXT'

FORMAT VARTEXT '|'

LAYOUT gopal

APPLY gopal1;

.END MLOAD;

.LOGOFF;

1).IF PROCESSING FAILS AT AQUISATION PHASE

SYNTAX: .RELEASE MLOAD TARGET TABLE NAME;

2).IF PROCESSING FAILS AT APPLICATION PHASE

SYNTAX: .RELEASE MLOAD TARGET TABLE NAME IN APPLY;

MULTILOAD DELETE:

.LOGTABLE RETAIL.M_log;

.logon 127.0.0.1/dbc,dbc;

.BEGIN delete MLOAD TABLES RETAIL.ITEMFASTLOAD2;delete from retail.ITEMFASTLOAD2;

.END MLOAD;

.LOGOFF;

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 25: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 25/28

  SURYA SOFTWARE SOLUTIONS

Execution: start..>run..cmd…..>mload<script path>logfilepath

. ….…………………>mload<d:\multiload\multiload_import.txt>d:\multiload\log.txt

T-pump

•Teradata parallel data pump provides an excellent utility for low volume batchmaintenance of large TD databases.

•T-PUMP is a data loading utility that helps you maintain (update,delete,insert andautomatic upserts) the data in your TD-RDBMS.

•Allows near real-time updates from transactional systems into the warehouse.•Performs INSERT, UPDATE, and DELETE operations, or a combination, from thesame source.Up to 63 DML statements can be included for one IMPORT task.

•Alternative to MultiLoad for low-volume batch maintenance of large tables.•Allows target tables to:–Have secondary indexes, join indexes, hash indexes, andReferential Integrity.–Be MULTISET or SET.–Be populated or empty.•Allows conditional processing (via APPLY in the .IMPORT statement).•Supports automatic restarts; uses Support Environment.•No session limit —use as many sessions as necessary.•No limit to the number of concurrent instances.•Uses row-hash locks, allowing concurrent updates on the same table.•Can always be stopped and locks dropped with no ill effect.•Designed for highest possible throughput.–User can specify how many updates occur minute by minute; can be changed as the job runs.

• Tpump has 4 properties1).PACK2).Rate3).Robust4).Serializer 

•Pack: If we specify pack 500 then 500 records are put in a single macro for insertion.NOTE: Max value for pack is 600.

•Rate: If we specify rate 500 in a minute of time it loads only 500records.

•Robust: Whenever a macro is completed tpump notes a robust point in a log table.If the tpump is restarting after the failure it starts from recent robust point or from

general checkpoint which is closest to tpump.Robust on/off;•serialize: whenever we specify serialize on tpump control goes to the flat file andVerifies the records under of same order and puts in a same macro.Serialize on/off;••Tpump always takes checkpoint value in no. of minutes not more than 60min.••Tpump requires 1 log table, 1 error table

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 26: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 26/28

  SURYA SOFTWARE SOLUTIONS

SAMPLE SCRIPT:

.LOGTABLE RETAIL.TPUMP_LOG;

.LOGON 192.168.1.6/DBC, DBC;

.BEGIN LOADERRORTABLE RETAIL.ERRTABLEPACK 100RATE 100ROBUST ONSERIALIZE ONSESSIONS 6TENACITY 4CHECKPOINT 50;

.LAYOUT LAY1;.FIELD l_orderkey * VARCHAR(10) KEY;

.FIELD l_partkey * VARCHAR(44);

.DML LABEL LAB1IGNORE DUPLICATE ROWS;INSERT INTO RETAIL.itemfastload.*;

.IMPORT INFILE "C:\Documents and Settings\Anay\Desktop\SQLAExport.TXT"FORMAT VARTEXT '|'LAYOUT LAY1

APPLY LAB1;.END LOAD;.LOGOFF;

BTEQ(BASIC TERADATA QUERY)

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

 –  As displayable characters suitable for reports, or  –  In native host format, suitable for other applications.• Reads input data and imports it to the Teradata database as INSERTs,

UPDATEs or DELETEs.• Limited ability to branch forward to a LABEL, based on a return code or an

activity count.• BTEQ does error reporting, not error capture.

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 27: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 27/28

  SURYA SOFTWARE SOLUTIONS

4 sets of commands

- Session Controls- LOGON- LOGOFF- DEFAULTS- CONTROLS- VERSIONS- SESSIONS- SESSION TRANS- OS

- File Control Commands- EXPORT- EXPORT RESET- USING- REPEAT- IMPORT- RUN

- Sequence Control Commands- IF- THEN- GOTO- ( Imp COMMAND: ERRORCODE, ACTIVITYCOUNT, ERRORLEVEL)- LABEL

- Format Control Commands- HEADING- FOOTER- SEPARATOR- FOLDLINE- SUPPRESS- SKIPLINE- FORMAT- SIDETITLE

Sample export script;.SET SESSIONS 8.LOGON DEMOTDAT/dbc,dbc;

.export report/indicdata/data file = 'E:\Documents andSettings\db2admin\Desktop\test.txt'selectcoalesce(trim(L_ORDERKEY),' ')|| '| '||coalesce(trim(L_PARTKEY),' ') || '| '||coalesce(trim(L_SUPPKEY),' ')|| '| '||coalesce(trim(L_LINENUMBER),' ')|| '| '||coalesce(trim(L_COMMENT ),' ')from retail.mahi3;

.export reset

# 307 / B, Nilagiri Block,Aditya Enclave,Ameerpet : 040-40163198 / 9966661188.

Page 28: Teradata v13 New

8/3/2019 Teradata v13 New

http://slidepdf.com/reader/full/teradata-v13-new 28/28

  SURYA SOFTWARE SOLUTIONS

  Sample import script;

.logon 192.168.1.6/dbc,dbc;

.IMPORT vartext '|' FILE ='C:\Documents and Settings\Any\Desktop\test.txt',skip=2

.REPEAT 100;USING

(L_ORDERKEY VARCHAR(100),L_PARTKEY VARCHAR(100))INSERT INTO retail.itemfastload(L_ORDERKEY,L_PARTKEY)

VALUES(:L_ORDERKEY,:L_PARTKEY

);.quit;

BTEQ IMPORT (from a UNIX Environment)

Enter your BTEQ Command:or 

bteq < jobscript.btq > jobscript.out

  jobscript.btq :

LOGON tpd1/user1,passwd1. IMPORT DATA FILE = datafil3.dat

. QUIET ON. REPEAT *USING in_CustNo (INTEGER)

, in_SocSec (INTEGER)UPDATE Customer 

SET Social_Security = :in_SocSecWHERE Customer_Number = :in_CustNo ;

.QUIT;

.QUIET :Limits output to reporting only errors and request processingstatistics.

.REPEAT * :Causes BTEQ to read records until EOF.USING :Defines the input data file.