Teradata Fastload Utility 是teradata数据库中一个基于命令行的快速load大量数据到一个空表的工具。
数据可以从以下途径被load:
1) Disk 或 tape;
2) 网络服务器上的文件;
 
Teradata Fastload使用多个session来load data,但是每一个job只能load到一个表中。如果要load到多个表中,需要提交多个job。
 
 
1. fastload脚本文件
 
SESSIONS 4;  /* optional ,total number of sessions to be allotted for the script */
ERRLIMIT 1000; /* optional */ LOGON localhost/Teradata_Education,Educate; /* tdpid = vivaldi,caracal... */ DROP TABLE stu_fl; /* final target table */
DROP TABLE error_1; /* error table ,internal to fast load utility needed to be defined */
DROP TABLE error_2; /* error table ,internal to fast load utility needed to be defined */ CREATE TABLE stu_fl /* target table definition */
(
stu_no VARCHAR(5),
stu_name VARCHAR(10),
age VARCHAR(2)
)
PRIMARY INDEX ( stu_no,stu_name,age ); SET RECORD VARTEXT "#"; /* delimiter in the source file */ DEFINE /* define the structure of the source file */
stu_no (VARCHAR(5)),
stu_name (VARCHAR(10)),
age (VARCHAR(2)) File=stu_fl.dat; /* source file location */ SHOW; BEGIN LOADING stu_fl
ERRORFILES error_1, error_2; INSERT INTO stu_fl /* final insert */
(
stu_no ,
stu_name ,
age
)
VALUES
(
:stu_no ,
:stu_name ,
:age
)
; END LOADING;
LOGOFF;
2. fastload数据文件
 
TDExpress14.0.3_Sles10:~/tough/test # cat stu_fl.dat
10000#Tough00001#26
10001#Tough#26
10002#Tough#26
 
 
3. 测试
TDExpress14.0.3_Sles10:~/tough/test # fastload < stu_fl.fastload
===================================================================
= =
= FASTLOAD UTILITY VERSION 14.00.00.07 =
= PLATFORM LINUX =
= =
===================================================================
===================================================================
= =
= Copyright 1984-2012, Teradata Corporation. =
= ALL RIGHTS RESERVED. =
= =
===================================================================
**** 06:55:47 Processing starting at: Sat Jun 28 06:55:47 2014
0001 SESSIONS 4; /* optional ,total number of sessions to be allotted for the s
cript */
**** 06:55:47 FDL4866 SESSIONS command accepted
0002 ERRLIMIT 1000; /* optional */
**** 06:55:47 Error limit set to: 1000 ===================================================================
= =
= Logon/Connection =
= =
===================================================================
0003 LOGON localhost/Teradata_Education,
**** 06:55:49 Teradata Database Release: 14.00.03.02
**** 06:55:49 Teradata Database Version: 14.00.03.02
**** 06:55:49 Number of AMPs available: 2
**** 06:55:49 Current CLI or RDBMS allows maximum row size: 64K
**** 06:55:49 Character set for this job: ASCII 0004 DROP TABLE stu_fl; /* final target table */
**** 06:55:50 Command completed successfully
0005 DROP TABLE error_1; /* error table ,internal to fast load utility needed to
be defined */
**** 06:55:50 RDBMS error 3807: Object 'error_1' does not exist.
0006 DROP TABLE error_2; /* error table ,internal to fast load utility needed to
be defined */
**** 06:55:50 RDBMS error 3807: Object 'error_2' does not exist. 0007 CREATE TABLE stu_fl /* target table definition */
(
stu_no VARCHAR(5),
stu_name VARCHAR(10),
age VARCHAR(2)
)
PRIMARY INDEX ( stu_no,stu_name,age );
**** 06:55:50 Command completed successfully 0008 SET RECORD VARTEXT "#"; /* delimiter in the source file */
**** 06:55:50 Now set to read 'Variable-Length Text' records
**** 06:55:50 Delimiter character(s) is set to '#'
**** 06:55:50 Command completed successfully 0009 DEFINE /* define the structure of the source file */
stu_no (VARCHAR(5)),
stu_name (VARCHAR(10)),
age (VARCHAR(2))
File=stu_fl.dat; /* source file location */
**** 06:55:50 FDL4803 DEFINE statement processed 0010 SHOW;
FILE = stu_fl.dat
STU_NO OFFSET = 0 LEN = 5 VARCHAR
STU_NAME OFFSET = 7 LEN = 10 VARCHAR
AGE OFFSET = 19 LEN = 2 VARCHAR
TOTAL RECORD LENGTH = 23 0011 BEGIN LOADING stu_fl
ERRORFILES error_1, error_2;
**** 06:55:50 Number of FastLoad sessions requested = 4
**** 06:55:50 Number of FastLoad sessions connected = 2
**** 06:55:50 FDL4808 LOGON successful
**** 06:55:50 Number of AMPs available: 2
**** 06:55:50 BEGIN LOADING COMPLETE ===================================================================
= =
= Insert Phase =
= =
===================================================================
0012 INSERT INTO stu_fl /* final insert */
(
stu_no ,
stu_name ,
age
)
VALUES
(
:stu_no ,
:stu_name ,
:age
)
;
**** 06:55:50 Number of recs/msg: 2920
**** 06:55:50 Starting to send to RDBMS with record 1
**** 06:55:50 Sending row 3
**** 06:55:50 Finished sending rows to the RDBMS
**** 06:55:50 Acquisition Phase statistics:
Elapsed time: 00:00:00 (in hh:mm:ss)
CPU time: 0 Seconds
MB/sec: N/A
MB/cpusec: N/A ===================================================================
= =
= End Loading Phase =
= =
===================================================================
0013 END LOADING;
**** 06:55:51 END LOADING COMPLETE
Total Records Read = 3
Total Error Table 1 = 0 ---- Table has been dropped
Total Error Table 2 = 0 ---- Table has been dropped
Total Inserts Applied = 3
Total Duplicate Rows = 0
Start: Sat Jun 28 06:55:50 2014
End : Sat Jun 28 06:55:51 2014
**** 06:55:51 Application Phase statistics:
Elapsed time: 00:00:01 (in hh:mm:ss)
0014 LOGOFF;
===================================================================
= =
= Logoff/Disconnect =
= =
===================================================================
**** 06:55:51 Logging off all sessions
**** 06:55:52 Total processor time used = '0.36 Seconds'
. Start : Sat Jun 28 06:55:47 2014
. End : Sat Jun 28 06:55:52 2014
. Highest return code encountered = ''.
**** 06:55:52 FDL4818 FastLoad Terminated
 
4. 查看数据是否load成功
 
SELECT * FROM TERADATA_EDUCATION. stu_fl ;
 
数据已经成功load到表中了。

Teradata中fastload使用的更多相关文章

  1. Teradata SQL tips

    Question: Insert into table_name  (1),(2),.... Teradata 貌似不能同时插入,只能一条一条插入,报错. 后来改为: Insert into tabl ...

  2. TERADATA数据库操作

    1.创建一个数据库的命令举例: ,spool; 注释:该命令创建了一个测试数据库testbase,其永久表空间为200mb,spool空间不能超过100mb.在teradata数据库系统的缺省方式下, ...

  3. SQL-Teradata基础

    1.创建一个和表 pnr_1 结构一样的表 Create table pnr_2 as pnr_1 with no data  不含数据 Create table pnr_2 as pnr_1 wit ...

  4. 采用ETL with RDBMS模式来实现ETL

    目前Teradata数据仓库的ETL作业采用ELT方式, 因为loading太重了, 需要将ETL压力转移到专门的ETL Server上. 对于ETL工具, 市场上已有很成熟的商业/开源工具, 比如I ...

  5. SQL基础-创建新的输出字段

    一.创建新的输出字段 1.建表.插数据 ### CREATE TABLE `t_stock_trans_dtl` ( `trans_id` varchar(100) NOT NULL COMMENT ...

  6. Python开源框架

    info:更多Django信息url:https://www.oschina.net/p/djangodetail: Django 是 Python 编程语言驱动的一个开源模型-视图-控制器(MVC) ...

  7. 使用tdload工具将本地数据导入到Teradata数据库中

    想把本地的数据文件(比如txt.csv)中的数据导入到Teradata虚拟机中的表中.既可以使用Teradata Assistant中的import功能,也可以使用fastload导入,前者的缺点是一 ...

  8. Teradata基础教程中的数据库试验环境脚本

    Teradata基础教程中的数据库表: Customer:  客户信息表 Location:  位置信息表 Employee:  雇员信息表 Job:  工作信息表 Department:  部门表 ...

  9. 【Teradata SQL】从中文数字字母混合字符串中只提取数字regexp_substr

    目标:从中文数字字母的字符串中只提取数字 sel regexp_substr('mint choc中文11国1','\d+')

随机推荐

  1. CentOS7,Firewalld防火墙使用方法

    查看防火墙状态 systemctl status firewalld.service 启动firewall systemctl stop firewalld.service 停止firewall sy ...

  2. nodejs5-package.json

    name:包名,唯一,由小写字符.数字和下划线组成,不能有空格 preferglobal:是否支持全局安装,true表示支持 descrition:描述 version:版本号 author:作者信息 ...

  3. JS测试浏览器类型的代码

    function getOs(url,title) { var OsObject = ""; if(navigator.userAgent.indexOf("MSIE&q ...

  4. HTML5游戏开发,剪刀石头布小游戏案例

    剪刀石头布,非常可爱的小游戏,相信大家都非常的怀念这款小游戏,小时候也玩过很多次,陪伴着我的童年的成长,现在是不是还会玩一下,剪刀石头布游戏的规则我们都知道是:剪刀剪布,石头砸剪刀,布包石头.跟朋友. ...

  5. Part 1 What is AngularJS

    What is AngularJS ? AngularJS is a JavaScirpt framework that helps build web application. AngularJS ...

  6. Exchange之准备AD及域

    1.         若有旧版本的Exchange 2003,则需要执行以下命令: setup.com /PrepareLegacyExchangePermissions 2.         准备架 ...

  7. SQLServer Ansi_Padding的用法

    关于Ansi_Padding的用法 1.当设置为ON时,不剪裁字符值中插入到varchar列的尾随空格和二进制值中插入到varbinary列的尾随零.不将值按列的长度进行填充. 2.当设置为OFF时, ...

  8. Cocos2d-JS动画

    与动作密不可分的还有动画,动画又可以分为场景过渡动画和帧动画.场景过渡动画我们在以往介绍过,这一个我们只介绍帧动画.帧动画帧动画就是按一定时间间隔.一定的顺序.一帧一帧地显示帧图片.我们的美工要为精灵 ...

  9. ReactiveCocoa比较区分replay, replayLast和replayLazily

    一直搞不清楚replayLazily和replay的区别可以直接跳到最后看. 原文:http://spin.atomicobject.com/2014/06/29/replay-replaylast- ...

  10. 8个web前端的精美HTML5 & CSS3效果及源码下载

    作为一个前沿的 Web 开发者,对于 HTML5 和 CSS3 技术或多或少都有掌握.前几年这些新技术刚萌芽的时候,开发者们已经使用它们来小试牛刀了,如今这些先进技术已经遍地开发,特别是在移动端大显身 ...