SURYA SOFTWARE SOLUTIONS

SURYA Software Solutions
Ph: 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 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.

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 parallel utilities, no

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

SURYA SOFTWARE SOLUTIONS
re-orgs, lowest disk to data ratio, robust (Hash Algorithm) expansion utility • High Availability - No single point of failure, scalable of data loading, parallel load utilities.
Teradata History

1979 1982 1983 1989 1991 1992 1996 1997 2000 ETC. 2002 2006 2007

TERADATA CORPORATION GROUNDED IN LA, CA YNET TECH ADOPTED. THE 1ST DBC TD COMPUTER RELEASED,ITS REVENUE IS $3MILLION. TD TOOK HELP OF NCR. AT&T JOINED WITH NCR. TD IS MERGED IN TO NCR. AT&T CAME OUT OF TD, NCR ARE PARTNERS. WORLDS 1ST COMMERCIAL WAREHOUSE REVENUE IS $200 MILLION. 100 SYSTEMS GOT PRODUCTIONISED LIKE WALMART,CITIGROUP,FEDEX TDV2R5 RELEASED IN THE MARKET. NCR , TD SEPERATED AND V2R6 RELEASED. TDV2R12 RELEASED IN THE MARKET2010—Teradata V13 Released

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

SURYA SOFTWARE SOLUTIONS
TERADATA COMPONENTS 1) P.E 2) BYNET P.E Architecture 3) AMP 4) VDISKS

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.

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

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.

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.

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.

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, they should 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.

SURYA SOFTWARE SOLUTIONS

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

SURYA SOFTWARE SOLUTIONS

Teradata Tools & Utilities

Utility BTEQ(Basic Teradata Query utility) Fast Load

Purpose Import/export import

MultiLoad

import

TPump(Teradata parallel data pump)

import

Fast Export

export

Features & Limitations 1)it loads & unloads with minimal speed 2)we can do transformations and error handling 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 phases 5) Used for high volume data maintenance with maximum speed 1)it loads into up to 5 tables 2)table may be empty or populated 3)it will perform insert ,update, delete & upsert 4)it runs 5 phases 5) Used for high volume data maintenance with maximum speed 1)it loads data with minimum speed 2)we can use multiple sessions and additional 3)it loads INFINITY TABLES 4) it support constant loading with low volume of data 5) we can perform insert ,update, delete and upsert operation 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.

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. SESSIONS max, min TENACITY hours { Default 4, 1 } { Default 4} .BEGIN EXPORT

SESSIONS: - maximum number of FastExport sessions that is logged on when you

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

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 and Windows, 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 data

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

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 specifies that each record is a two-byte integer, n,

where: • • • •
FASTLOAD

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, specifies that each record is exported as it is received

followed by an end-of-record marker
UNFORMAT

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.

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)) financial.customer; .END EXPORT; .LOGOFF;
--Exporting data from multiple tables to multiple sources—

from

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

SURYA SOFTWARE SOLUTIONS

.begin export; .export outfile "C:\Documents and Settings\Anay\Desktop\test11.txt" mode record format text; select cast ( 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 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; .export outfile "C:\Documents and Settings\Anay\Desktop\test1.txt" mode record format text; select cast (

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

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

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. 1. Conversion errors 2. Constraint errors 3. Down amp errors

Error table 2. 1.Unique violation errors.

Example1:

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

SURYA SOFTWARE SOLUTIONS
F tL ad fro a U IX S er as o m N erv

fa a </h m o 1fld >/ o e b .o t stlo d o e/j b . h m /jo 1 u S S IO S8; ES N L G Ned c /b n OO u 2 a k, B G L A IN C sto e E IN O D G u m r E R R ILE C s rr1 C s rr2 R O F S u trE , u trE ; DF E E IN in C s u _ u tN m (IN E E ) TGR ,in S c ec _ oS ,F iller ,in L a e _ nm ,in F a e _ nm (IN E E ) TGR (C A (4 )) HR 0 (C A (3 )) HR 0 (C A (2 )) HR 0

In t s rip file pu c t n e &ou t am tpu file(re o na e p rt) m

b as d kp s w

;

N m o em ty a e f p ta le b S rts P a 1 ta h se

D fin s inp e e ut re o c rd

F E c std ta .d t ; IL = u a a IN E T IN OC S O E VA U S( S R T UT MR L E : _ u u in C stN m ,:in L a e _ nm ,:in F a e _nm ,:in S c e _ o Sc E DL AD G N O IN ; L GF; OOF );

S L In e Q s rt s tem t ta en

S rt P a 2; if ta h se o itte , u m d tility w ill pu a se

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

SURYA SOFTWARE SOLUTIONS
C n et gt eD t o v rin h aa
L GN d c/ sr 4 O O e u 2 e1 , u zpo k il c ; D O T B EAc u t ; R P A L c o ns D O T BE R P AL Acs ct _ Er a r Tb _; 1 D O T BE R P AL Acs ct _ Er a r Tb _; 2 C E T T B EAc u t ,F L B C ( R AE A L c o ns AL A K Ac u t N me c o n_ u b r I T GR NE E , c o n_ t t s Ac u t Sau C A( 5 H R1) , r n_ a Ta sD te DT AE , a n eF rwr Bl c _ o ad a D C A( , ) E I L5 M 2 , a n eC r n Bl c _ ure t a D C A( , )) E I L7 M 2 U I U P I A YI D X c o n_ u b r ; N E R R N E (Ac u t N me) Q M B G L A I G co ns E I OD N N Ac u t E R RI E R OF S L Ac cts _Er a rT b _ , Acs 1 ct _Er a rT b D FN EI E i _ Ac o n ctn ( H R9) C A( ) , i _ Tn d t n r s ae ( H R1) C A ( 0) , i _ Blc r n a ur ( H R7) C A( ) , i _ Bl d n a fw (N E E ) I T GR ,i _t t s nS u a ( H R1) C A ( 0) F E=I FL ; I L NI E I S R I T Ac u t N E T N O c o ns ( co n_ u b r Ac u t N me , c o n_ t t s Ac u t Sau , r n_ a Ta sD te , a n eF rwr Bl c _ o ad a , a n eC r n) Bl c _ ure t a VL E ( AU S :n Acn i_ ct o ,i _t t s :n Sau , i _ Tn d t :n r s ae ( om ‘ Y Y Fr a Y Y t -M M -D ’ D ) , i _ Bl d :n a fw , i _ Bl ur :n a r c ) ; E D OD G N L AI ; N L GF; O OF

F sL a pr it a t o d ems c n es nf o o v r io r m o ed t t p t n aa y e o a oh r n t e, oc ne e c c lu n a h o m.
_; 2

fr o

I c d gc l m nl i u n ou n n mspo i e a e r vd s srp d c mnai n ci t o u e t to wic m y i i hh aa n d f t r we uue h n d b g i go eug n r md y g e b o i i th jo f n srp. ci t

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.

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’t have 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. views to a client application

2) MLoad uses multiple sessions to load large amount of data into teradata tables and 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.

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

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

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.

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 batch maintenance of large TD databases. •T-PUMP is a data loading utility that helps you maintain (update,delete,insert and automatic 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 the same 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, and Referential 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 properties 1).PACK 2).Rate 3).Robust 4).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 and Verifies 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.

SURYA SOFTWARE SOLUTIONS
SAMPLE SCRIPT: .LOGTABLE RETAIL.TPUMP_LOG;

.LOGON 192.168.1.6/DBC, DBC; .BEGIN LOAD ERRORTABLE RETAIL.ERRTABLE PACK 100 RATE 100 ROBUST ON SERIALIZE ON SESSIONS 6 TENACITY 4 CHECKPOINT 50; .LAYOUT LAY1; .FIELD l_orderkey * VARCHAR(10) KEY; .FIELD l_partkey * VARCHAR(44); .DML LABEL LAB1 IGNORE 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.

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 and Settings\db2admin\Desktop\test.txt' select coalesce(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.

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_SocSec WHERE Customer_Number = :in_CustNo ; .QUIT;
.QUIET statistics. .REPEAT * USING :Limits output to reporting only errors and request processing :Causes BTEQ to read records until EOF. :Defines the input data file.

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