Академический Документы
Профессиональный Документы
Культура Документы
and Utilities
1 BTEQ
2
Fast Export
3
Fast Load
4
Multi Load
5
TPump
7
Compare Utilities
8
Overview of other Tools
Generate reports
EXPORT modes :
Data Mode (also called Record mode): .EXPORT DATA
Report Mode (also called Field mode, Default mode):
.EXPORT REPORT
Indicator Mode : .EXPORT INDICDATA
DIF (Data Interchange Format) Mode: .EXPORT DIF
IMPORT modes
Data Mode (also called Record mode): .EXPORT DATA
Report Mode (also called Field mode, Default mode): .EXPORT
REPORT
Indicator Mode : .EXPORT INDICDATA
VARTEXT mode
5. Import data into NEW_EMP table from the EXCEL file. Delete
all rows from NEW_EMP table. Run the script. Observe the
data in NEW_EMP table.
Open the CSV text file and observe the date format and
delimiter.
LOGON
SESSIONS
LOGOFF
QUIT,EXIT
SHOW CONTROLS
SESSION DATEFORM
OS
RUN
IMPORT
REPEAT
QUIT
EXPORT
INDICDATA/RECORDMODE
IF THEN
ELSE
ENDIF
GOTO
.SET QUIET ON
DELETE FROM DEPTSUM;
.IF ERRORCODE = 0 THEN .GOTO TABLEOK;
CREATE TABLE DEPTSUM
(DEPTNO INTEGER,
DEPT_TOT INTEGER);
.LABEL TABLEOK;
INSERT INTO DEPTSUM
SELECT DEPTNO, SUM(SAL)FROM EMP
GROUP BY DEPTNO;
.IF ACTIVITYCOUNT > 0 THEN .GOTO CONTINUE
.QUIT
.LABEL CONTINUE
Commands:
FOOTING
HEADING
RETLIMIT
FOLDLINE
SUPPRESS
QUIET
NULL
WIDTH
UNDERLINE
SEPARATOR
Feature of BTEQ
BTEQ Export and Import capabilities
BTEQ Export modes Data, Indicdata, Report, DIF modes
Prepare and run BTEQ export scripts
BTEQ Import modes Data, Indicdata, Report, VARTEXT
Prepare and run BTEQ import scripts
Writing BTEQ Scripts using Session, File, Sequence and Format
features
.BEGIN EXPORT
SESSIONS max min
TENACITY hours
SLEEP minutes
NOTIFY high | medium | low | ;
.END EXPORT
Delimits a series of commands that define a single EXPORT action
Must be the last directive in a Fast Export script
Causes the utility to send the SELECT to the Teradata Database
SELECT Statement
Defines the data to be returned to the client
Multiple SELECTs are allowed
Applies READ lock
Locks are released when all response rows are moved to AMP spool
Supports the LOCKING FOR ACCESS modifier to request an access
lock
Following are not allowed in SELECT
Non-data tables (ex CURRENT_DATE,)
Equality condition for PI or USI
WITH option to generate total or subtotal response rows
Only one table may be loaded at a time with one fast load job
Tables defined with RI, SI, JI, HI and Triggers cannot be loaded
Duplicate rows cannot be loaded into multiset table
If an AMP goes down, Fast Load cannot be restarted until it is
back online
Phase 1
Establishes the sessions for FastLoad task
Host sends data blocks through the sessions
PEs receive the data blocks and directly send them to AMPs
AMPs redistributes the data rows to their target AMPs
AMPs writes the blocks (unsorted) to the disk
Phase II
Phase 2 start when END LOADING command received
AMPs read their blocks and sort them based on row hash
sequence
Write the sorted data blocks back to the disk
Fallback copy of the data is created
Table is available when phase 2 completes
Err_table_2 :
For non-duplicate rows, captures those rows that cause a UPI violation
Duplicate rows are counted and reported but not captured
Error table are automatically dropped if empty upon completion of
the run
There will be a row in SYSADMIN.FASTLOG table for each Fast
Load job that has not completed in the system
END LOADING
Indicates that all data rows have been transmitted.
Begins Phase 2 processing
Omission implies that the load is incomplete and will be restarted later
6. Write a Fast Load script to load data into NEW_EMP table from
multiple flat files.
Refer Notes Page for Script file to load data from first flat file
Refer Notes Page for Script file to load data from second flat file
Refer Notes Page for Script file to end the fast load job
DELETE task
These are tasks which execute a single DELETE statement on a
single table.
Deleting based on a UPI access is not permitted
No Acquisition phase because no variable input records to apply
Multi Load DELETE is faster and uses less disk space (No transient
Journal)
Multi Load DELETE is restartable
All other aspects similar to IMPORT task
1. Preliminary Phase
Start Multiload sessions
Parses and validates MultiLoad and SQL Statements
Create work tables : one per target table
Create error tables : two per target table
Create Restart log table
Apply utility locks (disallow DDLs) on target tables.
2. DML Transaction Phase
Send DML requests to server.
3. Acquisition Phase (for IMPORT task only)
Client sends data buffers to server
AMPs receives the data blocks and redistributes (by row hash) each
data records to its target AMPs.
Data rows are accumulated in work tables of corresponding target
table.
There is no acquisition phase for DELETE task
Error go to ET_tablename
4. Application Phase
Acquires write locks on the target tables.
For IMPORT task, applies work table changes to target table
For DELETE task, deletes the specified rows from the target
table
Affected blocks read/written only once
NUSI subtable changes applied
Errors go to UV tablename
5. Clean-up Phase
Release locks on the target tables
Forces an automatic rebuild of target table if an AMP went
down and came back online during the application phase
Drop empty error tables, work table and log table
Report load statistics
Logoff sessions
use IN APPLY only when the MultiLoad task was in the application
phase when it was suspended
must be exec from bteq or SQLA
this only releases the lock on target tables - we need to manually drop
the WT_* (worktable),ET_*(aquisition phase err table),UV_*(application
phase errrortable) and Checkponit Restart Log tables.
CHECKPOINT n;
n <=60 n is number of minutes
n > 60 n is number of records
n=0 no checkpoints yet all
default checkpoint is every 15 mins
57 2012 WIPRO LTD | WWW.WIPRO.COM
Multi Load Demos
1. Create a NEW_EMP table with the same structure as EMP
table with no data. UPI EMPNO.
Rerun the previous script file to set sal to its original value
and insert missing records.
Several TPump jobs can run against the same table at the
same time
PACK
SESSIONS (number)
CHECKPOINT (mins)
Checkponit Restart
twbkill JobName
92 2012 WIPRO LTD | WWW.WIPRO.COM
TPT Utility Commands
10
2012 WIPRO LTD | WWW.WIPRO.COM
0
10
2012 WIPRO LTD | WWW.WIPRO.COM
1
Summary
10
2012 WIPRO LTD | WWW.WIPRO.COM
2
Compare Utilities
10
2012 WIPRO LTD | WWW.WIPRO.COM
3
Objectives
10
2012 WIPRO LTD | WWW.WIPRO.COM
4
Strengths and Limitations
10
2012 WIPRO LTD | WWW.WIPRO.COM
5
Choosing Utility
Utility Best for
TPT - All loading needs using single scripting language
- Interfacing with, MultiLoad, FastExport and TPump
10
2012 WIPRO LTD | WWW.WIPRO.COM
6
Summary
10
2012 WIPRO LTD | WWW.WIPRO.COM
7
Overview of other Tools
10
2012 WIPRO LTD | WWW.WIPRO.COM
8
Objectives
10
2012 WIPRO LTD | WWW.WIPRO.COM
9
Teradata Manager
11
2012 WIPRO LTD | WWW.WIPRO.COM
0
Storage Management Tools - ARC
11
2012 WIPRO LTD | WWW.WIPRO.COM
1
ARC, ASF2
With the ARC utility you can copy a table and restore it to
another Teradata Database. It is scalable and parallel, and can
run on a channel-attached client, network-attached client, or a
node.
11
2012 WIPRO LTD | WWW.WIPRO.COM
2
ARC with Mainframe & LAN Client
ARC may be running on the
node or on the channel-
attached client, and will
backup data directly across
the channel into the
mainframe-attached tape
subsystem.
In a network-attached client
environment, ARC is used to
back up data, along with tape
management products:
NetVault (from BakBone
Software Inc.)
Veritas NetBackup from
Symantec Software
11
2012 WIPRO LTD | WWW.WIPRO.COM
3
Sample ARC Scripts
logon localtd/dbc,dbc;
archive data tables (tduser) (exclude tables (salgrade)),
release lock,
file=tduser;
logoff;
logon localtd/dbc,dbc;
copy data tables (tduser.emp2),
release lock,
file= tduser;
logoff;
11
2012 WIPRO LTD | WWW.WIPRO.COM
4
Connectivity Tools
Open Database Connectivity (ODBC) Driver delivers open
access to Teradata from Windows,Windows NT,UNIX,HP-
UX,Solaris-INTEL, Solaris - SPARC and AIX platforms.
11
2012 WIPRO LTD | WWW.WIPRO.COM
5
Interface Tools
11
2012 WIPRO LTD | WWW.WIPRO.COM
6
Summary
11
2012 WIPRO LTD | WWW.WIPRO.COM
7
References
11
2012 WIPRO LTD | WWW.WIPRO.COM
8
Thank You
11
2012 WIPRO LTD | WWW.WIPRO.COM
9