01_07 Data Movement

Embed Size (px)

Citation preview

  • 8/17/2019 01_07 Data Movement

    1/23

    ®

    IBM Software Group

    © 2005 IBM Corporation

    Lesson 7: Data Movement(DB2 on Campus Lecture Series)

    Raul F. Chong

    IBM Toronto Laboratory

  • 8/17/2019 01_07 Data Movement

    2/23

    IBM Software Group | DB2 Information Management Software

    2

     Agenda

    Data movement overview

    Export

    Import

    Load & Set Integrity

    db2move

    db2look

  • 8/17/2019 01_07 Data Movement

    3/23

    IBM Software Group | DB2 Information Management Software

    3

     Agenda

    Data movement overview

    Export

    Import

    Load & Set Integrity

    db2move

    db2look

  • 8/17/2019 01_07 Data Movement

    4/23

    IBM Software Group | DB2 Information Management Software

    4

    Data Movement Tools

    File

     ASC

    DELWSFIXF

    Database A Database B

    Export Import

    LoadSet Integrity

  • 8/17/2019 01_07 Data Movement

    5/23

    IBM Software Group | DB2 Information Management Software

    5

    EXPORT, IMPORT, LOAD

    ƒIXF, DEL, ASC

    db2move

    Easily export/import/load/copy set of tables & data (IXF)

    db2look

    Extracts:

    ƒDDL

    ƒ

    permissionsƒdatabase statistics

    ƒTablespace characteristics

    Data Movement Tools

  • 8/17/2019 01_07 Data Movement

    6/23

    IBM Software Group | DB2 Information Management Software

    6

     Agenda

    Data movement overview

    Export

    Import

    Load & Set Integrity

    db2move

    db2look

  • 8/17/2019 01_07 Data Movement

    7/23

    IBM Software Group | DB2 Information Management Software

    7

    Export data based on SQL Statement

    EXPORT TO employee.ixf of IXF

    SELECT * FROM employee

    FETCH FIRST 10 ROWS ONLY

    EXPORT

  • 8/17/2019 01_07 Data Movement

    8/23

    IBM Software Group | DB2 Information Management Software

    8

    Launching the EXPORT Table Dialog

    Control Center > (expand) All Databases folder > (select) Tables Folder > (right-click) Table > Export

  • 8/17/2019 01_07 Data Movement

    9/23

    IBM Software Group | DB2 Information Management Software

    9

     Agenda

    Data movement overview

    Export

    Import

    Load & Set Integrity db2move

    db2look

  • 8/17/2019 01_07 Data Movement

    10/23

    IBM Software Group | DB2 Information Management Software

    10

    High-speed SQL INSERT

    ƒ Activates triggers

    ƒ All Constraints enforced immediately

    ƒUses BUFFERPOOL

    IMPORT FROM employee.ixf OF IXF

    REPLACE_CREATE

    INTO employee_copy

    IMPORT

  • 8/17/2019 01_07 Data Movement

    11/23

    IBM Software Group | DB2 Information Management Software

    11

    Launching the IMPORT Dialog

    Control Center > (expand) All Databases folder > (select) Tables Folder > (right-click) Table > Import

  • 8/17/2019 01_07 Data Movement

    12/23

    IBM Software Group | DB2 Information Management Software

    12

     Agenda

    Data movement overview

    Export

    Import

    Load & Set Integrity db2move

    db2look

  • 8/17/2019 01_07 Data Movement

    13/23

    IBM Software Group | DB2 Information Management Software

    13

    Very High Speed, low level data loader 

    ƒseparate LOAD, BUILD, DELETE phases

    Uses utility heap (UTIL_HEAP_SZ)

    Does NOT use bufferpool and does NOT activate triggers

    Constraints enforced as separate step, may define

    EXCEPTION tables

    online LOAD supported

    LOAD FROM employee.ixf OF IXF

    REPLACE INTO employee_copy

    SET INTEGRITY FOR employee_copy

     ALL IMMEDIATE UNCHECKED

    LOAD

  • 8/17/2019 01_07 Data Movement

    14/23

    IBM Software Group | DB2 Information Management Software

    14

    Launching the LOAD Wizard

    Control Center > (expand) All Databases folder > (select) Tables Folder > (right-click) Table > Load

  • 8/17/2019 01_07 Data Movement

    15/23

    IBM Software Group | DB2 Information Management Software

    15

    Launching the SET INTEGRITY Dialog

    Control Center > (expand) All Databases folder > (select) Tables Folder > (right-click) Table > Set Integrity

  • 8/17/2019 01_07 Data Movement

    16/23

    IBM Software Group | DB2 Information Management Software

    16

     Agenda

    Data movement overview

    Export

    Import

    Load & Set Integrity db2move

    db2look

  • 8/17/2019 01_07 Data Movement

    17/23

    IBM Software Group | DB2 Information Management Software

    17

    db2move sample export

    db2move

  • 8/17/2019 01_07 Data Movement

    18/23

    IBM Software Group | DB2 Information Management Software

    18

     Agenda

    Data movement overview

    Export

    Import

    Load & Set Integrity db2move

    db2look

  • 8/17/2019 01_07 Data Movement

    19/23

    IBM Software Group | DB2 Information Management Software

    19

    Extract DDL, tablespace info, and statistics to script

    Too many options to describe, see db2look -h for

    details Example:

    db2look -d sample -l -e -o sample.ddl

    database name layout(tablespaces

    & bufferpools)

    extract DDL

    output file

    db2look

  • 8/17/2019 01_07 Data Movement

    20/23

    IBM Software Group | DB2 Information Management Software

    20

    db2look: Extracting DDL From Control Center 

    Control Center > (expand) All Databases folder > (right-click) Database > (select) Generate DDL

  • 8/17/2019 01_07 Data Movement

    21/23

    IBM Software Group | DB2 Information Management Software

    21

    Extraction Options

  • 8/17/2019 01_07 Data Movement

    22/23

    IBM Software Group | DB2 Information Management Software

    22

    QuickLab #8 – Extracting DDL

    In this QuickLab, you will use Control Center and

    Development Center to extract database objectDDL for the EXPRESS database

    Refer to the handout for the QuickLab #8instructions

  • 8/17/2019 01_07 Data Movement

    23/23

    IBM Software Group | DB2 Information Management Software

    23

    What’s Next?

    MaintenanceLesson 10

    Backup & recoveryLesson 9

    SecurityLesson 8

    Data movementLesson 7

    Working with data objectsLesson 6

    Client connectivityLesson 5

    The DB2 architectureLesson 4

    Tools & scriptingLesson 3

    The DB2 EnvironmentLesson 2

    Installation & the DB2 editionsLesson 1

    COMPLETED!