SlideShare a Scribd company logo
1 of 28
Download to read offline
MultiLoad
After completing this module, you will be able to:
• Describe the capabilities of MultiLoad.
• Name the five phases of MultiLoad and state the main
function of each.
• Create a MultiLoad script.
• Run a script to update/load table(s) using MultiLoad.
• Explain the advantages of using MultiLoad.
What is MultiLoad?
• Batch mode utility that runs on the host system.
• FastLoad-like technology – TPump-like functionality.
• 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; typically with
batch inputs from a host file.
• Affected data blocks only written once.
• Host and LAN support.
• Full Restart capability.
• Error reporting via error tables.
• Support for INMODs.
MULTILOAD
HOST
Teradata DB
UPDATEs
INSERTs
DELETEs
TABLE A
TABLE B
TABLE C
TABLE D
TABLE E
How MultiLoad Works
IMPORT TASK
MULTILOAD
Teradata
HOST
INSERTS
UPDATES
DELETES
UPSERTS
APPLY CONDITIONS
INPUT
DATA
T
A
B
L
E
1
T
A
B
L
E
2
T
A
B
L
E
3
T
A
B
L
E
4
T
A
B
L
E
5
DELETE TASK
MULTILOAD
Teradata
HOST
DELETES only
DELETE ROWS
DATA
VALUE
T
A
B
L
E
1
Advantages of MultiLoad
• Minimizes the use of the PEs.
• Gets input data to the AMPs as quickly as possible.
• Uses multiple-AMP sessions.
• Uses the parallelism of the AMPs to apply changes.
• Keeps BYNET activity low with AMP-local processing.
• Avoids Transient Journaling overhead.
• Allows Checkpoint/Restartability even with down AMPs.
• Prevents lengthy rollbacks of aborted jobs.
• Allows for maximum access to table during processing.
• Posts errors to special error tables.
• Provides extensive processing statistics.
Basic MultiLoad Statements
.LOGTABLE [ restartlog_tablename ] ;
.LOGON [ tdpid/userid, password ] ;
.BEGIN MLOAD TABLES [ tablename1, ... ] ;
.LAYOUT [ layout_name ] ;
.FIELD ….. ;
.FILLER ….. ;
.DML LABEL [ label ] ;
.IMPORT INFILE [ filename ]
[ FROM m ] [ FOR n ] [ THRU k ]
[ FORMAT FASTLOAD | BINARY | TEXT | UNFORMAT | VARTEXT 'c' ]
LAYOUT [ layout_name ]
APPLY [ label ] [ WHERE condition ] ;
.END MLOAD ;
.LOGOFF ;
.FIELD fieldname { startpos datadesc } || fieldexp [ NULLIF nullexpr ]
[ DROP {LEADING / TRAILING } { BLANKS / NULLS }
[ [ AND ] {TRAILING / LEADING } { NULLS / BLANKS } ] ] ;
.FILLER [ fieldname ] startpos datadesc ;
Sample MultiLoad IMPORT Task
.LOGTABLE Logtable001_mld;
.LOGON tdp3/user2,tyler;
.BEGIN MLOAD TABLES Employee, Employee_History;
.LAYOUT Employee_Trans;
.FILLER in_Transcode 1 CHAR(3);
.FIELD in_EmpNo * SMALLINT;
.FIELD in_DeptNo * SMALLINT;
.FIELD in_Salary * DECIMAL (8,2);
.DML LABEL Payroll DO INSERT FOR MISSING UPDATE ROWS ;
UPDATE Employee SET Salary = :in_Salary
WHERE EmpNo = :in_EmpNo;
INSERT INTO Employee (EmpNo, Salary)
VALUES (:in_EmpNo, :in_Salary);
.DML LABEL Terminate ;
DELETE FROM Employee WHERE EmpNo = :in_EmpNo;
INSERT INTO Employee_History (EmpNo, DeptNo)
VALUES (:in_EmpNo, :in_DeptNo);
.IMPORT INFILE infile1
LAYOUT Employee_Trans
APPLY Payroll WHERE in_Transcode = 'PAY'
APPLY Terminate WHERE in_Transcode = 'DEL';
.END MLOAD;
.LOGOFF;
Definition of input layout.
Begin loading.
End loading.
Definition of an UPSERT.
File name to import from.
IMPORT Task
• INSERTs, DELETEs, UPDATEs and UPSERTs allowed.
• Up to a maximum of five tables:
– Empty or populated.
– NUSIs permitted.
• MultiLoad Import task operations are always primary index operations -
however, you are not allowed to change the value of a table’s primary index.
• Change the value of a column based on its current value.
• Permits non-exclusive access to target tables from other users except during
Application Phase.
• Input error limits may be specified as a number or percentage.
• Allows restart and checkpoint during each operating phase.
• IMPORT tasks cannot be done on tables with USI’s, Referential Integrity, Join
Indexes, Hash Indexes, or Triggers.
– With V2R5, IMPORT tasks can be done on tables defined with “Soft
Referential Integrity”.
5 Phases of IMPORT Task
DML
Transaction
Acquisition
Application
Send the input data to the AMPs
Apply the input data to appropriate
table(s)
Basic clean up
Basic set up
Send the DML steps to the AMPs
Preliminary
Cleanup
Details
Phase 1: Preliminary
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
IMPORT
Phases
Phase 2: DML Transaction
Send prototype DML to the Teradata Database
Store DML steps in work tables
Add a USING modifier to the request
Host data to be filled in from input file
Add a “Match Tag” to the request
Allows link between DML and transaction record
IMPORT
Phases
Phase 3: Acquisition
• Get the data from host and apply it to appropriate AMP worktables.
– Duplicate “input records” record for each successful APPLY.
– Add “Match Tag” information to record.
– Make blocks and send “quickpath” to AMPs.
– Deblock and resend record to “correct” AMP.
• Reblock and store in worktable of target table.
– Sort the reblocked records in the work tables.
– Sort by hash value and sequence to be applied.
• Set up transition to the Application phase.
– Upgrade locks on target tables to Write.
– Set table headers for Application phase.
– This is effectively the “point of no return”.
Notes:
– Errors that occur in this phase go into the Acquisition Error
Table (default name is ET_tablename).
– There is no acquisition phase activity for a DELETE Task.
IMPORT
Phases
Phase 3: Acquisition – a Closer Look
IMPORT
Phases PE
AMP 1
SESSION AMP1
SESSION AMP2
SESSION AMP3
SQL/LOG SESSION
ALTERNATE SESSION
ARRIVAL
FROM HOST
RECEIVER
TASK
BLK
AMP 2
BLK
AMP 3
BLK
REBLOCKED
AND SORTED
BLK
BLK
BLK
BLK
BLK
BLK
BLK
WORK TABLE
BLK
BLK
BLK
BLK
BLK
BLK
WORK TABLE
BLK
BLK
BLK
BLK
BLK
BLK
WT
Acquisition steps
• Get host data to appropriate AMP worktables.
• Sort the reblocked records in the work tables.
• Set up transition to the Application phase.
Phase 4: Application
• 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.
Note:
– Errors that occur in this phase go into the Application Error
Table (default name is UV_tablename).
IMPORT
Phases
Phase 4: Application – a Closer Look
IMPORT
Phases
AMP
TARGET
BLOCK
WORK
UNIT
DML
STEPS
READ WRITE
A C B
TARGET TABLE
OLD NEW
C
A
SORTED
DATA ROWS
TO BE
APPLIED
WORK SUBTABLE
ONE ROW
FOR EACH
DML
WORK SUBTABLE
B
NUSI
CHANGE
ROWS
WORK SUBTABLE
CHECKPOINT
SUBTABLE
(2 ROWS)
WORK SUBTABLE
Apply work subtable
changes to target subtables:
• Affected blocks
read/written only once.
• Changes applied based
on matching row-hash.
• Errors written to
appropriate error table.
• Checkpoint after writing
each block.
• NUSI subtable changes
applied.
Phase 5: Cleanup
• 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.
– Empty Error Tables are dropped.
– Log Table is dropped (if Error Code = 0).
• MLOAD Session Logoff:
– LOGOFF request is sent to each AMP with a session.
IMPORT
Phases
Sample MultiLoad DELETE Tasks
.LOGTABLE Logtable002_mld;
.LOGON tdp3/user2,tyler;
.BEGIN DELETE MLOAD TABLES Employee;
DELETE FROM Employee WHERE Term_date > 0;
.END MLOAD;
.LOGOFF;
Hard code the values of
rows to be deleted.
.LOGTABLE Logtable003_mld;
.LOGON tdp3/user2,tyler;
.BEGIN DELETE MLOAD TABLES Employee;
.LAYOUT Remove;
.FIELD in_Termdate * INTEGER;
DELETE FROM Employee WHERE Term_date > :in_Termdate;
.IMPORT INFILE infile2
LAYOUT Remove;
.END MLOAD;
.LOGOFF;
Pass a single row
containing value(s) to be
used.
DELETE Task Differences from
IMPORT Task
DELETE tasks operate very similarly to IMPORT tasks with some differences:
• Deleting based on a UPI access is not permitted.
• A DML DELETE statement is sent to each AMP with a match tag parcel.
• No Acquisition phase because no variable input records to apply.
• Application phase reads each target block and deletes qualifying rows.
• All other aspects similar to IMPORT task.
Why use MultiLoad DELETE (versus SQL DELETE)?
• MultiLoad DELETE is faster and uses less disk disk (no Transient Journal).
• MultiLoad DELETE is restartable.
– If SQL DELETE is aborted, Teradata applies Transient Journal rows.
SQL DELETE can be resubmitted, but starts from beginning.
A Closer Look at DELETE Task
Application Phase
AMP
TARGET
BLOCK
DML DELETE
STEP
READ WRITE
A
TARGET TABLE
OLD NEW
A
ONE ROW
FOR
DELETE
STATEMENT
WORK SUBTABLE
NUSI
CHANGE
ROWS
WORK SUBTABLE
CHECKPOINT
SUBTABLE
(2 ROWS)
WORK SUBTABLE
• Note absence of Work
Table for Import rows.
• Faster than traditional
SQL DELETE due to:
– Lack of transient
journaling
– No rollback of
work
– Restartable from
checkpoint
MultiLoad Locks
Utility locks
Utility locks: Placed in table headers to alert other utilities that a MultiLoad
is in session for this table. They include:
• Acquisition lock
DML — allows all
DDL — allows DROP only
• Application lock
DML — allows SELECT with ACCESS only
DDL — allows DROP only
Restarting MultiLoad
Teradata Restart
• MLOAD reinitiated automatically after Teradata recovery.
• Continue from checkpoint without user interaction.
Host restart
• Resubmit the original script.
• MLOAD determines its stopping point and restarts.
Acquisition phase
• Checkpointing is performed according to user.
• Checkpoint based on time or on number of records.
• Default checkpoint interval is fifteen minutes.
Application phase
• Checkpointing done after each write of data block.
• Each block is written at most only one time.
Sort phase(s)
• Sort operations do their own internal checkpointing.
MultiLoad Checkpointing Strategy
RELEASE MLOAD Statement
• Returns target tables to general availability.
• Prevents any attempt to restart MultiLoad.
• Cannot be successful in all cases.
• Cannot override a target table lock.
• IMPORT — possible before Application phase.
• DELETE — possible during Preliminary phase.
To successfully complete a RELEASE MLOAD:
1. Make sure MLOAD is not running; abort if it is. (If it is past the point of
no return, go to step 4.)
2. Enter RELEASE MLOAD.
3. If successful, drop the log, work, and error tables.
4. If not successful:
a.) restart MLOAD and let it complete, or
b.) drop target, work, and error tables, or
c.) handle error as appropriate.
RELEASE MLOAD Employee, Job, Department;
Invoking MultiLoad
Network Attached Systems: mload [PARAMETERS] < scriptname >outfilename
Channel-Attached MVS Systems: // EXEC TDSMLOAD MLPARM= [PARAMETERS]
Channel-Attached VM Systems: EXEC MLOAD [PARAMETERS]
Channel Network Description
Parameter Parameter
BRIEF -b Reduces print output runtime to the least information
required to determine success or failure.
CHARSET=charsetname -c charsetname Specify a character set or its code. Examples are EBCDIC,
ASCII, or Kanji sets.
ERRLOG=filename -e filename Alternate file specification for error messages; produces a
duplicate record.
"multiload command" -r 'multiload cmd' Signifies the start of a MultiLoad job; usually a RUN FILE
command that specifies the script file.
MAXSESS=max sessions -M max sessions Maximum number of MultiLoad sessions logged on.
MINSESS=min sessions -N min sessions Minimum number of MultiLoad sessions logged on.
< scriptname Name of file that contains MultiLoad commands and SQL
statements.
> outfilename Name of output file for MultiLoad messages.
Application Utility Checklist
Feature BTEQ FastLoad FastExport MultiLoad TPump
DDL Functions ALL LIMITED No ALL
DML Functions ALL INSERT SELECT INS/UPD/DEL
Multiple DML Yes No Yes Yes
Multiple Tables Yes No Yes Yes
Multiple Sessions Yes Yes Yes Yes
Protocol Used SQL FASTLOAD EXPORT MULTILOAD
Conditional Expressions Yes No Yes Yes
Arithmetic Calculations Yes No Yes Yes
Data Conversion Yes 1 per column Yes Yes
Error Files No Yes No Yes
Error Limits No Yes No Yes
User-written Routines No Yes Yes Yes
Summary
• Batch mode utility.
• 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; typically with batch
inputs from a host file.
• Affected data blocks only written once.
• Full Restart capability.
• Error reporting via error files.
• Support for INMODs.
Review Questions
Answer True or False.
1. True or False. With MultiLoad, you can import data from the host into populated tables.
2. True or False. MultiLoad cannot process tables with USIs or Referential Integrity defined.
3. True or False. MultiLoad allows changes to the value of a table’s primary index.
4. True or False. MultiLoad allows you to change the value of a column based on its current value.
5. True or False. MultiLoad permits non-exclusive access to target tables from other users except
during Application Phase.
Match the MultiLoad Phase in the first column to its corresponding task in the second column.
1. ___ Preliminary A. Acquires or creates Restart Log Table.
2. ___ DML Transaction B. Locks are released.
3. ___ Acquisition C. Applies (loads) data to the work tables.
4. ___ Application D. Execute mload for each target table as a single multi-statement request.
5. ___ Cleanup E. Stores DML steps in work tables
Review Question Answers
Answer True or False.
1. True or False. With MultiLoad, you can import data from the host into populated tables.
2. True or False. MultiLoad cannot process tables with USIs or Referential Integrity defined.
3. True or False. MultiLoad allows changes to the value of a table’s primary index.
4. True or False. MultiLoad allows you to change the value of a column based on its current value.
5. True or False. MultiLoad permits non-exclusive access to target tables from other users except
during Application Phase.
Match the MultiLoad Phase in the first column to its corresponding task in the second column.
1. _A_ Preliminary A. Acquires or creates Restart Log Table.
2. _E_ DML Transaction B. Locks are released.
3. _C_ Acquisition C. Applies (loads) data to the work tables.
4. _D_ Application D. Execute mload for each target table as a single multi-statement request.
5. _B_ Cleanup E. Stores DML steps in work tables
Lab Exercises
Lab Exercise
Purpose
In this lab, you will use MultiLoad to delete rows from your three tables. An input file will be created which will contain
a control letter (A - Accounts, C - Customer, and T - Trans) followed by a primary index value for the appropriate table.
What you need
Your three tables with two hundred (200) rows in each.
Tasks
1. Prepare the data file by executing the macro AU.Lab6_1. Export your data to a file called data6_1.
2. Prepare your tables by doing the following:
a. In BTEQ, issue a Delete All command on each of your tables.
b. While still in BTEQ, execute the following script which will load the specified 200 rows into each of the tables:
INSERT INTO Accounts SELECT * FROM AU.Accounts WHERE Account_Number LT 20024201;
INSERT INTO Customer SELECT * FROM AU.Customer WHERE Customer_Number LT 2201;
INSERT INTO Trans SELECT * FROM AU.Trans WHERE Account_Number LT 20024201;
3. Prepare your MultiLoad script to Delete Rows from each of the tables depending on the incoming code (A, C, or T) from
data6_1. This job should result in deleting 100 rows from each of the three tables.
4. Check your results by doing a SELECT COUNT(*) on each of your tables.
Lab Solution for Lab
cat lab613.mld
.LOGTABLE Restartlog613_mld;
.LOGON u4455/tljc30,tljc30 ;
.BEGIN MLOAD TABLES Accounts, Customer, Trans ;
.LAYOUT Record_Layout_613;
.FILLER File_Control * CHAR(1) ;
.FIELD PI_Value * INTEGER ;
.DML LABEL Del_Acct ;
DELETE FROM Accounts WHERE Account_Number = :PI_Value ;
.DML LABEL Del_Cust ;
DELETE FROM Customer WHERE Customer_Number = :PI_Value ;
.DML LABEL Del_Trans ;
DELETE FROM Trans WHERE Account_Number = :PI_Value ;
.IMPORT INFILE data6_1
LAYOUT Record_Layout_613
APPLY Del_Acct WHERE File_Control = 'A'
APPLY Del_Cust WHERE File_Control = 'C'
APPLY Del_Trans WHERE File_Control = 'T' ;
.END MLOAD ;
.LOGOFF ;
mload < lab613.mld > lab613.out

More Related Content

Similar to 6.3 Mload.pdf

Oracle applications r12.2, ebr, online patching means lot of work for devel...
Oracle applications r12.2, ebr, online patching   means lot of work for devel...Oracle applications r12.2, ebr, online patching   means lot of work for devel...
Oracle applications r12.2, ebr, online patching means lot of work for devel...Ajith Narayanan
 
Legacy system migration workbench
Legacy system migration workbenchLegacy system migration workbench
Legacy system migration workbenchSD Tutorial
 
Tips Tricks and Little known features in SAP ASE
Tips Tricks and Little known features in SAP ASETips Tricks and Little known features in SAP ASE
Tips Tricks and Little known features in SAP ASESAP Technology
 
40043 claborn
40043 claborn40043 claborn
40043 clabornBaba Ib
 
My cool new Slideshow!
My cool new Slideshow!My cool new Slideshow!
My cool new Slideshow!Anas Mohammed
 
Introducing Spirit - Online Schema Change
Introducing Spirit - Online Schema ChangeIntroducing Spirit - Online Schema Change
Introducing Spirit - Online Schema ChangeMorgan Tocker
 
04 laboratory exercise 1
04 laboratory exercise 104 laboratory exercise 1
04 laboratory exercise 1Anne Lee
 
Part 3 - Data Warehousing Lecture at BW Cooperative State University (DHBW)
Part 3 - Data Warehousing Lecture at BW Cooperative State University (DHBW)Part 3 - Data Warehousing Lecture at BW Cooperative State University (DHBW)
Part 3 - Data Warehousing Lecture at BW Cooperative State University (DHBW)Andreas Buckenhofer
 
PL/SQL Fundamentals I
PL/SQL Fundamentals IPL/SQL Fundamentals I
PL/SQL Fundamentals INick Buytaert
 
Time Travelling With DB2 10 For zOS
Time Travelling With DB2 10 For zOSTime Travelling With DB2 10 For zOS
Time Travelling With DB2 10 For zOSLaura Hood
 
News in abap concepts to further increase the power of abap development 2
News in abap   concepts to further increase the power of abap development  2News in abap   concepts to further increase the power of abap development  2
News in abap concepts to further increase the power of abap development 2Alexander Talac
 

Similar to 6.3 Mload.pdf (20)

IDUG 2015 NA Data Movement Utilities final
IDUG 2015 NA Data Movement Utilities finalIDUG 2015 NA Data Movement Utilities final
IDUG 2015 NA Data Movement Utilities final
 
Stored procedure
Stored procedureStored procedure
Stored procedure
 
Stored procedure
Stored procedureStored procedure
Stored procedure
 
Oracle applications r12.2, ebr, online patching means lot of work for devel...
Oracle applications r12.2, ebr, online patching   means lot of work for devel...Oracle applications r12.2, ebr, online patching   means lot of work for devel...
Oracle applications r12.2, ebr, online patching means lot of work for devel...
 
EC8691-MPMC-PPT.pptx
EC8691-MPMC-PPT.pptxEC8691-MPMC-PPT.pptx
EC8691-MPMC-PPT.pptx
 
Taking Full Advantage of Galera Multi Master Cluster
Taking Full Advantage of Galera Multi Master ClusterTaking Full Advantage of Galera Multi Master Cluster
Taking Full Advantage of Galera Multi Master Cluster
 
SQL / PL
SQL / PLSQL / PL
SQL / PL
 
Legacy system migration workbench
Legacy system migration workbenchLegacy system migration workbench
Legacy system migration workbench
 
Overview of Oracle database12c for developers
Overview of Oracle database12c for developersOverview of Oracle database12c for developers
Overview of Oracle database12c for developers
 
Tips Tricks and Little known features in SAP ASE
Tips Tricks and Little known features in SAP ASETips Tricks and Little known features in SAP ASE
Tips Tricks and Little known features in SAP ASE
 
MySQL 5.5
MySQL 5.5MySQL 5.5
MySQL 5.5
 
Triggers n Cursors.ppt
Triggers n Cursors.pptTriggers n Cursors.ppt
Triggers n Cursors.ppt
 
40043 claborn
40043 claborn40043 claborn
40043 claborn
 
My cool new Slideshow!
My cool new Slideshow!My cool new Slideshow!
My cool new Slideshow!
 
Introducing Spirit - Online Schema Change
Introducing Spirit - Online Schema ChangeIntroducing Spirit - Online Schema Change
Introducing Spirit - Online Schema Change
 
04 laboratory exercise 1
04 laboratory exercise 104 laboratory exercise 1
04 laboratory exercise 1
 
Part 3 - Data Warehousing Lecture at BW Cooperative State University (DHBW)
Part 3 - Data Warehousing Lecture at BW Cooperative State University (DHBW)Part 3 - Data Warehousing Lecture at BW Cooperative State University (DHBW)
Part 3 - Data Warehousing Lecture at BW Cooperative State University (DHBW)
 
PL/SQL Fundamentals I
PL/SQL Fundamentals IPL/SQL Fundamentals I
PL/SQL Fundamentals I
 
Time Travelling With DB2 10 For zOS
Time Travelling With DB2 10 For zOSTime Travelling With DB2 10 For zOS
Time Travelling With DB2 10 For zOS
 
News in abap concepts to further increase the power of abap development 2
News in abap   concepts to further increase the power of abap development  2News in abap   concepts to further increase the power of abap development  2
News in abap concepts to further increase the power of abap development 2
 

More from ssuser8b6c85

5.Analytical Function.pdf
5.Analytical Function.pdf5.Analytical Function.pdf
5.Analytical Function.pdfssuser8b6c85
 
5.Agg. Function.pdf
5.Agg. Function.pdf5.Agg. Function.pdf
5.Agg. Function.pdfssuser8b6c85
 
2.1 Data types.pdf
2.1 Data types.pdf2.1 Data types.pdf
2.1 Data types.pdfssuser8b6c85
 
1.8 Data Protection.pdf
1.8 Data Protection.pdf1.8 Data Protection.pdf
1.8 Data Protection.pdfssuser8b6c85
 
1.6 PI Mechanics.pdf
1.6  PI Mechanics.pdf1.6  PI Mechanics.pdf
1.6 PI Mechanics.pdfssuser8b6c85
 
1.4 System Arch.pdf
1.4 System Arch.pdf1.4 System Arch.pdf
1.4 System Arch.pdfssuser8b6c85
 
1.1 Intro to WinDDI.pdf
1.1 Intro to WinDDI.pdf1.1 Intro to WinDDI.pdf
1.1 Intro to WinDDI.pdfssuser8b6c85
 

More from ssuser8b6c85 (10)

5.Analytical Function.pdf
5.Analytical Function.pdf5.Analytical Function.pdf
5.Analytical Function.pdf
 
5.Agg. Function.pdf
5.Agg. Function.pdf5.Agg. Function.pdf
5.Agg. Function.pdf
 
2.1 Data types.pdf
2.1 Data types.pdf2.1 Data types.pdf
2.1 Data types.pdf
 
1.8 Data Protection.pdf
1.8 Data Protection.pdf1.8 Data Protection.pdf
1.8 Data Protection.pdf
 
1.6 PI Mechanics.pdf
1.6  PI Mechanics.pdf1.6  PI Mechanics.pdf
1.6 PI Mechanics.pdf
 
1.5 PI Access.pdf
1.5 PI Access.pdf1.5 PI Access.pdf
1.5 PI Access.pdf
 
1.4 System Arch.pdf
1.4 System Arch.pdf1.4 System Arch.pdf
1.4 System Arch.pdf
 
Spark basic.pdf
Spark basic.pdfSpark basic.pdf
Spark basic.pdf
 
1.1 Overview.pdf
1.1 Overview.pdf1.1 Overview.pdf
1.1 Overview.pdf
 
1.1 Intro to WinDDI.pdf
1.1 Intro to WinDDI.pdf1.1 Intro to WinDDI.pdf
1.1 Intro to WinDDI.pdf
 

Recently uploaded

Seizure stage detection of epileptic seizure using convolutional neural networks
Seizure stage detection of epileptic seizure using convolutional neural networksSeizure stage detection of epileptic seizure using convolutional neural networks
Seizure stage detection of epileptic seizure using convolutional neural networksIJECEIAES
 
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...Amil baba
 
21scheme vtu syllabus of visveraya technological university
21scheme vtu syllabus of visveraya technological university21scheme vtu syllabus of visveraya technological university
21scheme vtu syllabus of visveraya technological universityMohd Saifudeen
 
Linux Systems Programming: Semaphores, Shared Memory, and Message Queues
Linux Systems Programming: Semaphores, Shared Memory, and Message QueuesLinux Systems Programming: Semaphores, Shared Memory, and Message Queues
Linux Systems Programming: Semaphores, Shared Memory, and Message QueuesRashidFaridChishti
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxkalpana413121
 
5G and 6G refer to generations of mobile network technology, each representin...
5G and 6G refer to generations of mobile network technology, each representin...5G and 6G refer to generations of mobile network technology, each representin...
5G and 6G refer to generations of mobile network technology, each representin...archanaece3
 
Final DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manualFinal DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manualBalamuruganV28
 
21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docxrahulmanepalli02
 
Diploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdfDiploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdfJNTUA
 
Piping and instrumentation diagram p.pdf
Piping and instrumentation diagram p.pdfPiping and instrumentation diagram p.pdf
Piping and instrumentation diagram p.pdfAshrafRagab14
 
Research Methodolgy & Intellectual Property Rights Series 2
Research Methodolgy & Intellectual Property Rights Series 2Research Methodolgy & Intellectual Property Rights Series 2
Research Methodolgy & Intellectual Property Rights Series 2T.D. Shashikala
 
Basics of Relay for Engineering Students
Basics of Relay for Engineering StudentsBasics of Relay for Engineering Students
Basics of Relay for Engineering Studentskannan348865
 
"United Nations Park" Site Visit Report.
"United Nations Park" Site  Visit Report."United Nations Park" Site  Visit Report.
"United Nations Park" Site Visit Report.MdManikurRahman
 
Passive Air Cooling System and Solar Water Heater.ppt
Passive Air Cooling System and Solar Water Heater.pptPassive Air Cooling System and Solar Water Heater.ppt
Passive Air Cooling System and Solar Water Heater.pptamrabdallah9
 
Lab Manual Arduino UNO Microcontrollar.docx
Lab Manual Arduino UNO Microcontrollar.docxLab Manual Arduino UNO Microcontrollar.docx
Lab Manual Arduino UNO Microcontrollar.docxRashidFaridChishti
 
Autodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptxAutodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptxMustafa Ahmed
 
Low Altitude Air Defense (LAAD) Gunner’s Handbook
Low Altitude Air Defense (LAAD) Gunner’s HandbookLow Altitude Air Defense (LAAD) Gunner’s Handbook
Low Altitude Air Defense (LAAD) Gunner’s HandbookPeterJack13
 
Module-III Varried Flow.pptx GVF Definition, Water Surface Profile Dynamic Eq...
Module-III Varried Flow.pptx GVF Definition, Water Surface Profile Dynamic Eq...Module-III Varried Flow.pptx GVF Definition, Water Surface Profile Dynamic Eq...
Module-III Varried Flow.pptx GVF Definition, Water Surface Profile Dynamic Eq...Nitin Sonavane
 
Raashid final report on Embedded Systems
Raashid final report on Embedded SystemsRaashid final report on Embedded Systems
Raashid final report on Embedded SystemsRaashidFaiyazSheikh
 
Performance enhancement of machine learning algorithm for breast cancer diagn...
Performance enhancement of machine learning algorithm for breast cancer diagn...Performance enhancement of machine learning algorithm for breast cancer diagn...
Performance enhancement of machine learning algorithm for breast cancer diagn...IJECEIAES
 

Recently uploaded (20)

Seizure stage detection of epileptic seizure using convolutional neural networks
Seizure stage detection of epileptic seizure using convolutional neural networksSeizure stage detection of epileptic seizure using convolutional neural networks
Seizure stage detection of epileptic seizure using convolutional neural networks
 
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
 
21scheme vtu syllabus of visveraya technological university
21scheme vtu syllabus of visveraya technological university21scheme vtu syllabus of visveraya technological university
21scheme vtu syllabus of visveraya technological university
 
Linux Systems Programming: Semaphores, Shared Memory, and Message Queues
Linux Systems Programming: Semaphores, Shared Memory, and Message QueuesLinux Systems Programming: Semaphores, Shared Memory, and Message Queues
Linux Systems Programming: Semaphores, Shared Memory, and Message Queues
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptx
 
5G and 6G refer to generations of mobile network technology, each representin...
5G and 6G refer to generations of mobile network technology, each representin...5G and 6G refer to generations of mobile network technology, each representin...
5G and 6G refer to generations of mobile network technology, each representin...
 
Final DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manualFinal DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manual
 
21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx
 
Diploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdfDiploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdf
 
Piping and instrumentation diagram p.pdf
Piping and instrumentation diagram p.pdfPiping and instrumentation diagram p.pdf
Piping and instrumentation diagram p.pdf
 
Research Methodolgy & Intellectual Property Rights Series 2
Research Methodolgy & Intellectual Property Rights Series 2Research Methodolgy & Intellectual Property Rights Series 2
Research Methodolgy & Intellectual Property Rights Series 2
 
Basics of Relay for Engineering Students
Basics of Relay for Engineering StudentsBasics of Relay for Engineering Students
Basics of Relay for Engineering Students
 
"United Nations Park" Site Visit Report.
"United Nations Park" Site  Visit Report."United Nations Park" Site  Visit Report.
"United Nations Park" Site Visit Report.
 
Passive Air Cooling System and Solar Water Heater.ppt
Passive Air Cooling System and Solar Water Heater.pptPassive Air Cooling System and Solar Water Heater.ppt
Passive Air Cooling System and Solar Water Heater.ppt
 
Lab Manual Arduino UNO Microcontrollar.docx
Lab Manual Arduino UNO Microcontrollar.docxLab Manual Arduino UNO Microcontrollar.docx
Lab Manual Arduino UNO Microcontrollar.docx
 
Autodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptxAutodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptx
 
Low Altitude Air Defense (LAAD) Gunner’s Handbook
Low Altitude Air Defense (LAAD) Gunner’s HandbookLow Altitude Air Defense (LAAD) Gunner’s Handbook
Low Altitude Air Defense (LAAD) Gunner’s Handbook
 
Module-III Varried Flow.pptx GVF Definition, Water Surface Profile Dynamic Eq...
Module-III Varried Flow.pptx GVF Definition, Water Surface Profile Dynamic Eq...Module-III Varried Flow.pptx GVF Definition, Water Surface Profile Dynamic Eq...
Module-III Varried Flow.pptx GVF Definition, Water Surface Profile Dynamic Eq...
 
Raashid final report on Embedded Systems
Raashid final report on Embedded SystemsRaashid final report on Embedded Systems
Raashid final report on Embedded Systems
 
Performance enhancement of machine learning algorithm for breast cancer diagn...
Performance enhancement of machine learning algorithm for breast cancer diagn...Performance enhancement of machine learning algorithm for breast cancer diagn...
Performance enhancement of machine learning algorithm for breast cancer diagn...
 

6.3 Mload.pdf

  • 1. MultiLoad After completing this module, you will be able to: • Describe the capabilities of MultiLoad. • Name the five phases of MultiLoad and state the main function of each. • Create a MultiLoad script. • Run a script to update/load table(s) using MultiLoad. • Explain the advantages of using MultiLoad.
  • 2. What is MultiLoad? • Batch mode utility that runs on the host system. • FastLoad-like technology – TPump-like functionality. • 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; typically with batch inputs from a host file. • Affected data blocks only written once. • Host and LAN support. • Full Restart capability. • Error reporting via error tables. • Support for INMODs. MULTILOAD HOST Teradata DB UPDATEs INSERTs DELETEs TABLE A TABLE B TABLE C TABLE D TABLE E
  • 3. How MultiLoad Works IMPORT TASK MULTILOAD Teradata HOST INSERTS UPDATES DELETES UPSERTS APPLY CONDITIONS INPUT DATA T A B L E 1 T A B L E 2 T A B L E 3 T A B L E 4 T A B L E 5 DELETE TASK MULTILOAD Teradata HOST DELETES only DELETE ROWS DATA VALUE T A B L E 1
  • 4. Advantages of MultiLoad • Minimizes the use of the PEs. • Gets input data to the AMPs as quickly as possible. • Uses multiple-AMP sessions. • Uses the parallelism of the AMPs to apply changes. • Keeps BYNET activity low with AMP-local processing. • Avoids Transient Journaling overhead. • Allows Checkpoint/Restartability even with down AMPs. • Prevents lengthy rollbacks of aborted jobs. • Allows for maximum access to table during processing. • Posts errors to special error tables. • Provides extensive processing statistics.
  • 5. Basic MultiLoad Statements .LOGTABLE [ restartlog_tablename ] ; .LOGON [ tdpid/userid, password ] ; .BEGIN MLOAD TABLES [ tablename1, ... ] ; .LAYOUT [ layout_name ] ; .FIELD ….. ; .FILLER ….. ; .DML LABEL [ label ] ; .IMPORT INFILE [ filename ] [ FROM m ] [ FOR n ] [ THRU k ] [ FORMAT FASTLOAD | BINARY | TEXT | UNFORMAT | VARTEXT 'c' ] LAYOUT [ layout_name ] APPLY [ label ] [ WHERE condition ] ; .END MLOAD ; .LOGOFF ; .FIELD fieldname { startpos datadesc } || fieldexp [ NULLIF nullexpr ] [ DROP {LEADING / TRAILING } { BLANKS / NULLS } [ [ AND ] {TRAILING / LEADING } { NULLS / BLANKS } ] ] ; .FILLER [ fieldname ] startpos datadesc ;
  • 6. Sample MultiLoad IMPORT Task .LOGTABLE Logtable001_mld; .LOGON tdp3/user2,tyler; .BEGIN MLOAD TABLES Employee, Employee_History; .LAYOUT Employee_Trans; .FILLER in_Transcode 1 CHAR(3); .FIELD in_EmpNo * SMALLINT; .FIELD in_DeptNo * SMALLINT; .FIELD in_Salary * DECIMAL (8,2); .DML LABEL Payroll DO INSERT FOR MISSING UPDATE ROWS ; UPDATE Employee SET Salary = :in_Salary WHERE EmpNo = :in_EmpNo; INSERT INTO Employee (EmpNo, Salary) VALUES (:in_EmpNo, :in_Salary); .DML LABEL Terminate ; DELETE FROM Employee WHERE EmpNo = :in_EmpNo; INSERT INTO Employee_History (EmpNo, DeptNo) VALUES (:in_EmpNo, :in_DeptNo); .IMPORT INFILE infile1 LAYOUT Employee_Trans APPLY Payroll WHERE in_Transcode = 'PAY' APPLY Terminate WHERE in_Transcode = 'DEL'; .END MLOAD; .LOGOFF; Definition of input layout. Begin loading. End loading. Definition of an UPSERT. File name to import from.
  • 7. IMPORT Task • INSERTs, DELETEs, UPDATEs and UPSERTs allowed. • Up to a maximum of five tables: – Empty or populated. – NUSIs permitted. • MultiLoad Import task operations are always primary index operations - however, you are not allowed to change the value of a table’s primary index. • Change the value of a column based on its current value. • Permits non-exclusive access to target tables from other users except during Application Phase. • Input error limits may be specified as a number or percentage. • Allows restart and checkpoint during each operating phase. • IMPORT tasks cannot be done on tables with USI’s, Referential Integrity, Join Indexes, Hash Indexes, or Triggers. – With V2R5, IMPORT tasks can be done on tables defined with “Soft Referential Integrity”.
  • 8. 5 Phases of IMPORT Task DML Transaction Acquisition Application Send the input data to the AMPs Apply the input data to appropriate table(s) Basic clean up Basic set up Send the DML steps to the AMPs Preliminary Cleanup Details
  • 9. Phase 1: Preliminary 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 IMPORT Phases
  • 10. Phase 2: DML Transaction Send prototype DML to the Teradata Database Store DML steps in work tables Add a USING modifier to the request Host data to be filled in from input file Add a “Match Tag” to the request Allows link between DML and transaction record IMPORT Phases
  • 11. Phase 3: Acquisition • Get the data from host and apply it to appropriate AMP worktables. – Duplicate “input records” record for each successful APPLY. – Add “Match Tag” information to record. – Make blocks and send “quickpath” to AMPs. – Deblock and resend record to “correct” AMP. • Reblock and store in worktable of target table. – Sort the reblocked records in the work tables. – Sort by hash value and sequence to be applied. • Set up transition to the Application phase. – Upgrade locks on target tables to Write. – Set table headers for Application phase. – This is effectively the “point of no return”. Notes: – Errors that occur in this phase go into the Acquisition Error Table (default name is ET_tablename). – There is no acquisition phase activity for a DELETE Task. IMPORT Phases
  • 12. Phase 3: Acquisition – a Closer Look IMPORT Phases PE AMP 1 SESSION AMP1 SESSION AMP2 SESSION AMP3 SQL/LOG SESSION ALTERNATE SESSION ARRIVAL FROM HOST RECEIVER TASK BLK AMP 2 BLK AMP 3 BLK REBLOCKED AND SORTED BLK BLK BLK BLK BLK BLK BLK WORK TABLE BLK BLK BLK BLK BLK BLK WORK TABLE BLK BLK BLK BLK BLK BLK WT Acquisition steps • Get host data to appropriate AMP worktables. • Sort the reblocked records in the work tables. • Set up transition to the Application phase.
  • 13. Phase 4: Application • 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. Note: – Errors that occur in this phase go into the Application Error Table (default name is UV_tablename). IMPORT Phases
  • 14. Phase 4: Application – a Closer Look IMPORT Phases AMP TARGET BLOCK WORK UNIT DML STEPS READ WRITE A C B TARGET TABLE OLD NEW C A SORTED DATA ROWS TO BE APPLIED WORK SUBTABLE ONE ROW FOR EACH DML WORK SUBTABLE B NUSI CHANGE ROWS WORK SUBTABLE CHECKPOINT SUBTABLE (2 ROWS) WORK SUBTABLE Apply work subtable changes to target subtables: • Affected blocks read/written only once. • Changes applied based on matching row-hash. • Errors written to appropriate error table. • Checkpoint after writing each block. • NUSI subtable changes applied.
  • 15. Phase 5: Cleanup • 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. – Empty Error Tables are dropped. – Log Table is dropped (if Error Code = 0). • MLOAD Session Logoff: – LOGOFF request is sent to each AMP with a session. IMPORT Phases
  • 16. Sample MultiLoad DELETE Tasks .LOGTABLE Logtable002_mld; .LOGON tdp3/user2,tyler; .BEGIN DELETE MLOAD TABLES Employee; DELETE FROM Employee WHERE Term_date > 0; .END MLOAD; .LOGOFF; Hard code the values of rows to be deleted. .LOGTABLE Logtable003_mld; .LOGON tdp3/user2,tyler; .BEGIN DELETE MLOAD TABLES Employee; .LAYOUT Remove; .FIELD in_Termdate * INTEGER; DELETE FROM Employee WHERE Term_date > :in_Termdate; .IMPORT INFILE infile2 LAYOUT Remove; .END MLOAD; .LOGOFF; Pass a single row containing value(s) to be used.
  • 17. DELETE Task Differences from IMPORT Task DELETE tasks operate very similarly to IMPORT tasks with some differences: • Deleting based on a UPI access is not permitted. • A DML DELETE statement is sent to each AMP with a match tag parcel. • No Acquisition phase because no variable input records to apply. • Application phase reads each target block and deletes qualifying rows. • All other aspects similar to IMPORT task. Why use MultiLoad DELETE (versus SQL DELETE)? • MultiLoad DELETE is faster and uses less disk disk (no Transient Journal). • MultiLoad DELETE is restartable. – If SQL DELETE is aborted, Teradata applies Transient Journal rows. SQL DELETE can be resubmitted, but starts from beginning.
  • 18. A Closer Look at DELETE Task Application Phase AMP TARGET BLOCK DML DELETE STEP READ WRITE A TARGET TABLE OLD NEW A ONE ROW FOR DELETE STATEMENT WORK SUBTABLE NUSI CHANGE ROWS WORK SUBTABLE CHECKPOINT SUBTABLE (2 ROWS) WORK SUBTABLE • Note absence of Work Table for Import rows. • Faster than traditional SQL DELETE due to: – Lack of transient journaling – No rollback of work – Restartable from checkpoint
  • 19. MultiLoad Locks Utility locks Utility locks: Placed in table headers to alert other utilities that a MultiLoad is in session for this table. They include: • Acquisition lock DML — allows all DDL — allows DROP only • Application lock DML — allows SELECT with ACCESS only DDL — allows DROP only
  • 20. Restarting MultiLoad Teradata Restart • MLOAD reinitiated automatically after Teradata recovery. • Continue from checkpoint without user interaction. Host restart • Resubmit the original script. • MLOAD determines its stopping point and restarts. Acquisition phase • Checkpointing is performed according to user. • Checkpoint based on time or on number of records. • Default checkpoint interval is fifteen minutes. Application phase • Checkpointing done after each write of data block. • Each block is written at most only one time. Sort phase(s) • Sort operations do their own internal checkpointing. MultiLoad Checkpointing Strategy
  • 21. RELEASE MLOAD Statement • Returns target tables to general availability. • Prevents any attempt to restart MultiLoad. • Cannot be successful in all cases. • Cannot override a target table lock. • IMPORT — possible before Application phase. • DELETE — possible during Preliminary phase. To successfully complete a RELEASE MLOAD: 1. Make sure MLOAD is not running; abort if it is. (If it is past the point of no return, go to step 4.) 2. Enter RELEASE MLOAD. 3. If successful, drop the log, work, and error tables. 4. If not successful: a.) restart MLOAD and let it complete, or b.) drop target, work, and error tables, or c.) handle error as appropriate. RELEASE MLOAD Employee, Job, Department;
  • 22. Invoking MultiLoad Network Attached Systems: mload [PARAMETERS] < scriptname >outfilename Channel-Attached MVS Systems: // EXEC TDSMLOAD MLPARM= [PARAMETERS] Channel-Attached VM Systems: EXEC MLOAD [PARAMETERS] Channel Network Description Parameter Parameter BRIEF -b Reduces print output runtime to the least information required to determine success or failure. CHARSET=charsetname -c charsetname Specify a character set or its code. Examples are EBCDIC, ASCII, or Kanji sets. ERRLOG=filename -e filename Alternate file specification for error messages; produces a duplicate record. "multiload command" -r 'multiload cmd' Signifies the start of a MultiLoad job; usually a RUN FILE command that specifies the script file. MAXSESS=max sessions -M max sessions Maximum number of MultiLoad sessions logged on. MINSESS=min sessions -N min sessions Minimum number of MultiLoad sessions logged on. < scriptname Name of file that contains MultiLoad commands and SQL statements. > outfilename Name of output file for MultiLoad messages.
  • 23. Application Utility Checklist Feature BTEQ FastLoad FastExport MultiLoad TPump DDL Functions ALL LIMITED No ALL DML Functions ALL INSERT SELECT INS/UPD/DEL Multiple DML Yes No Yes Yes Multiple Tables Yes No Yes Yes Multiple Sessions Yes Yes Yes Yes Protocol Used SQL FASTLOAD EXPORT MULTILOAD Conditional Expressions Yes No Yes Yes Arithmetic Calculations Yes No Yes Yes Data Conversion Yes 1 per column Yes Yes Error Files No Yes No Yes Error Limits No Yes No Yes User-written Routines No Yes Yes Yes
  • 24. Summary • Batch mode utility. • 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; typically with batch inputs from a host file. • Affected data blocks only written once. • Full Restart capability. • Error reporting via error files. • Support for INMODs.
  • 25. Review Questions Answer True or False. 1. True or False. With MultiLoad, you can import data from the host into populated tables. 2. True or False. MultiLoad cannot process tables with USIs or Referential Integrity defined. 3. True or False. MultiLoad allows changes to the value of a table’s primary index. 4. True or False. MultiLoad allows you to change the value of a column based on its current value. 5. True or False. MultiLoad permits non-exclusive access to target tables from other users except during Application Phase. Match the MultiLoad Phase in the first column to its corresponding task in the second column. 1. ___ Preliminary A. Acquires or creates Restart Log Table. 2. ___ DML Transaction B. Locks are released. 3. ___ Acquisition C. Applies (loads) data to the work tables. 4. ___ Application D. Execute mload for each target table as a single multi-statement request. 5. ___ Cleanup E. Stores DML steps in work tables
  • 26. Review Question Answers Answer True or False. 1. True or False. With MultiLoad, you can import data from the host into populated tables. 2. True or False. MultiLoad cannot process tables with USIs or Referential Integrity defined. 3. True or False. MultiLoad allows changes to the value of a table’s primary index. 4. True or False. MultiLoad allows you to change the value of a column based on its current value. 5. True or False. MultiLoad permits non-exclusive access to target tables from other users except during Application Phase. Match the MultiLoad Phase in the first column to its corresponding task in the second column. 1. _A_ Preliminary A. Acquires or creates Restart Log Table. 2. _E_ DML Transaction B. Locks are released. 3. _C_ Acquisition C. Applies (loads) data to the work tables. 4. _D_ Application D. Execute mload for each target table as a single multi-statement request. 5. _B_ Cleanup E. Stores DML steps in work tables
  • 27. Lab Exercises Lab Exercise Purpose In this lab, you will use MultiLoad to delete rows from your three tables. An input file will be created which will contain a control letter (A - Accounts, C - Customer, and T - Trans) followed by a primary index value for the appropriate table. What you need Your three tables with two hundred (200) rows in each. Tasks 1. Prepare the data file by executing the macro AU.Lab6_1. Export your data to a file called data6_1. 2. Prepare your tables by doing the following: a. In BTEQ, issue a Delete All command on each of your tables. b. While still in BTEQ, execute the following script which will load the specified 200 rows into each of the tables: INSERT INTO Accounts SELECT * FROM AU.Accounts WHERE Account_Number LT 20024201; INSERT INTO Customer SELECT * FROM AU.Customer WHERE Customer_Number LT 2201; INSERT INTO Trans SELECT * FROM AU.Trans WHERE Account_Number LT 20024201; 3. Prepare your MultiLoad script to Delete Rows from each of the tables depending on the incoming code (A, C, or T) from data6_1. This job should result in deleting 100 rows from each of the three tables. 4. Check your results by doing a SELECT COUNT(*) on each of your tables.
  • 28. Lab Solution for Lab cat lab613.mld .LOGTABLE Restartlog613_mld; .LOGON u4455/tljc30,tljc30 ; .BEGIN MLOAD TABLES Accounts, Customer, Trans ; .LAYOUT Record_Layout_613; .FILLER File_Control * CHAR(1) ; .FIELD PI_Value * INTEGER ; .DML LABEL Del_Acct ; DELETE FROM Accounts WHERE Account_Number = :PI_Value ; .DML LABEL Del_Cust ; DELETE FROM Customer WHERE Customer_Number = :PI_Value ; .DML LABEL Del_Trans ; DELETE FROM Trans WHERE Account_Number = :PI_Value ; .IMPORT INFILE data6_1 LAYOUT Record_Layout_613 APPLY Del_Acct WHERE File_Control = 'A' APPLY Del_Cust WHERE File_Control = 'C' APPLY Del_Trans WHERE File_Control = 'T' ; .END MLOAD ; .LOGOFF ; mload < lab613.mld > lab613.out