05 - Data Movement
05 - Data Movement
Data Movement
Unit objectives
• The SQL INSERT statement can insert one or more rows of data into tables, nicknames, or views:
• SQL overhead is imposed, such as obeying RI, or Check Constraints, or Uniqueness, or executing triggers.
• As INSERTs occur, the activity is also stored in logs
• The SQL INSERT might not be the best or fastest method to load massive amounts of data into a
database
• Example inserts:
• insert into artists (artno, name, classification) values (100, 'Patti & Cart Wheels', 'S');
• Insert into emptemp select * from employee ;
EXPORT/IMPORT overview
IMPORT LOAD
Slow when moving large amounts Faster for large amounts of data
of data
Creation of table/index supported Tables and indexes must exist
with IXF format
Import into tables, views, aliases Load into tables only
Option to ALLOW WRITE ACCESS Existing data can still be seen by
read applications
All rows logged Minimal logging; can make copy
Triggers fired, constraints Triggers not fired; unique
enforced constraints enforced, RI and
check constraints via SET
INTEGRITY
Four phases of Load
LOAD: Load phase
• During the LOAD phase, data is stored in a table and index keys are
collected
• Save points are established at intervals
• Messages indicate the number of input rows successfullyloaded
• If a failure occurs in this phase, use the RESTART option for LOAD to
restart from the last successful consistency point
LOAD: Build phase
• During the DELETE phase, all rows that have violated a unique
constraint are deleted
• If a failure occurs, LOAD restarts from the DELETE phase
• Once the database indexes are rebuilt, information about the rows
containing the invalid keys is contained in an exception table,WHICH
SHOULD BE CREATED BEFORE LOAD
• Finally, any duplicate keys found are deleted
LOAD: Index Copy phase
• ALLOW NO ACCESS