Vous êtes sur la page 1sur 4

Restarting Fastload

Author: Geeta Ranbhor Project Details: Project Name: SBCSMSMF H/W Platform: OS/390 S/W Environment: MVS Operating System Project Type: Maintenance Target Readers: Teradata users Keywords: AMP, Checkpoints

Fastload: In many applications, it is required to load data from files to the tables in the database. The Fastload utility is used to load large amount of data into tables. Fastload works at very high speed. The restriction with fast load is that the table in which the data is to be loaded should be empty. Fastload can load data from multiple files into a single table. The document will talk about loading data from multiple files into a single table using fastload and the restarting fastload. Fastload can run in the Unix, Windows and Mainframe environments. Fastload works in 2 phases: First is the data acquisition phase and the second is the data writing phase. Phase 1: Data Acquisition Phase In the data acquisition phase, data is written from the file to the AMP. AMP is a logical storage unit in Teradata architecture. Data is not written to the disk in this phase. So to load data from multiple source files into 1 target table, this phase can be carried out multiple times. After collecting data from all the files, phase 2 should be executed. This will write the data to the disk. Phase 2: Data Loading Phase Phase 2 writes data to the disk. It releases the locks acquired in phase 1 and deletes the empty error tables.

FASTLOAD
LOGON <USERNAME>,<PASSWORD>;

BEGIN LOADING TABLENAME

THIS IS THE EMPTY TABLE

ERRORFILES TABLEERR1,TABLEERR2;

START OF PHASE 1

DEFINE A (INTEGER) B (INTEGER) FILE= <INPUTFILE .DAT>;

DEFINITION OF INPUT RECORD

INSERT INTO <TABLENAME> VALUES( :A ,:B);

INSERT STATEMENT TO INSERT DATA FROM FILE TO TABLE

END LOADING;

START OF PHASE 2

LOGOFF;

Restarting Fastload:Scenarios are mentioned in which you might require to restart the fastload along with the steps to be taken for restarting. There might be a case in which an abend occurs in first phase, i.e the data acquisition phase. This abend indicates that the data acquisition is incomplete. Solution: Resubmit the fastload script. Fastload will begin from record 1 or the first record after the last checkpoint. (Checkpoint is used to verify that the rows are transmitted and processed.) If Abend occurs in second phase. This indicates that the data acquisition is complete. Solution: This indicates that phase 1, i.e the data acquisition phase is complete. So only phase 2 needs to be resubmitted. Submit only BEGIN and END LOADING statements. In this case there is no need to resubmit the entire fastload script. Normal end of Phase 1. More data to acquire, thus there is no end loading statement in the script. Solution: Such a case indicates that more data needs to be acquired. So resubmit the script. Fastload should be positioned to first record or the first record after the last checkpoint. Normal end of Phase 1. No more data to acquire, thus there is no end loading statement in the script. Solution: If phase 1 is complete and there is no need to acquire more data, then restart only step 2 i.e. the phase in which data is loaded to the table. Submit BEGIN and END LOADING statements.

Vous aimerez peut-être aussi