SlideShare a Scribd company logo
IBM Software Group
© 2005 IBM Corporation
DB2 UDB Intermediate
Day5
IBM Software Group
© 2005 IBM Corporation
Topics
 Backup
 Restore
 Load
 Import
2
IBM Software Group
© 2005 IBM Corporation
BACKUP
You can choose to backup entire database or one or more table
spaces from within the database.
You can also choose whether you want the backup to be taken
online or offline.
These options can be combined to give you a very flexible recovery
mechanism for your databases.
3
IBM Software Group
© 2005 IBM Corporation
Online and Offline Backup
 An online backup allows other applications or processes to
connect to the database as well as read modify the data while the
operation is running.
 An offline backup does not allow other applications or processes
to access the database and their objects while the operation is
being performed.
4
IBM Software Group
© 2005 IBM Corporation
Database Backup
5
 A database backup is a complete copy of your database objects. In
addition to the data, a backup copy contains information about the
table spaces, containers, the system catalog,database config file,
the log control file, and the recovery history file.
 Important note is that a backup does not contain the dbm cfg file or
the value of registry variables.
 You must have SYSADM, SYSCTRL, or SYSMAINT authority to
perform a backup.
IBM Software Group
© 2005 IBM Corporation
Commands for Backup
6
 db2 backup db dbname
Db2 backup sample
to /db2backup/dir1, /db2backup/dir2
WITH 4 BUFFERS
BUFFER 4096
PARALLELISM 2
• There is no keyword for OFFLINE in the syntax, as this is the
default mode.
IBM Software Group
© 2005 IBM Corporation
 Db2 BACKUP DATABASE sample ONLINE TO /dev/rdir1, /dev/rdir2
INCLUDE LOGS
 db2 backup db test on all dbpartitionnums
 db2 backup db test on dbpartitionnums (0, 3)
 db2 backup db test on all dbpartitionnums except dbpartitionnums
(1,2)
 db2 backup db test on all dbpartitionnums online INCLUDE LOGS
7
IBM Software Group
© 2005 IBM Corporation
Table Space Backup
8
In a database where only some of your table spaces change
considerably, you may opt not to back up the entire database but
only specific table spaces. To perform a table space backup, you
can use the following syntax.
 Db2 BACKUP DATABASE sample TABLESPACE (syscatspace,
userspace1, userspace2) ONLINE TO /db2tbsp/backup1,
/db2tbsp/backup2
IBM Software Group
© 2005 IBM Corporation
Types of Backup
 An incremental backup is a backup image that contains only pages
that have been updated since the previous backup was taken.
 In delta backups, DB2 backs up only the data that has changed
since the last successfull, cumulative, or delta backup.
 For incremental backups, if there was a crash after the incremental
backup on Friday, you would restore the first Sunday’s full backup,
followed by the incremental backup taken on Friday.
 For delta backups, if there was a crash after the delta backup on
Friday, you would restore the first Sunday’s full backup, followed
by each of the delta backups taken on Monday through Friday
inclusive.
9
IBM Software Group
© 2005 IBM Corporation
Incremental and Delta Backup
10
IBM Software Group
© 2005 IBM Corporation
Trackmod Parameter
 To enable incremental and delta backups, the TRACKMOD
database configuration parameter must be set to YES. This allows
DB2 to track database modifications so that the backup utility can
detect which database pages must be included in the backup
image. After setting this parameter to YES, you must take a full
database backup to have a baseline against which incremental
backups can be taken.
 BACKUP DB sample INCREMENTAL TO /dev/
 BACKUP DB sample INCREMENTAL DELTA TO /dev/rdir1
11
IBM Software Group
© 2005 IBM Corporation
Backup Files
The backup images are stored as files. The name of the backup file
contains the following parts:
• Database alias
• Type of backup (0=Full database, 3=Table space, 4=Copy from
LOAD)
• Instance name
• Database partition (always NODE0000 for a single-partition
database)
• Catalog partition number (always CATN0000 for a single-partition
database)
• Timestamp of the backup
• The image sequence number
12
IBM Software Group
© 2005 IBM Corporation
Backup file sample
13
IBM Software Group
© 2005 IBM Corporation
Restore
 You can restore a database backup image and create a new database or
you can restore over top of an existing database. You need SYSADM,
SYSCTRL, or SYSMAINT authority to restore into an existing database,
and SYSADM or SYSCTRL authority restore to a new database.
 RESTORE DATABASE sample FROM C:DBBACKUP
 TAKEN AT 20070428131259
 WITHOUT ROLLING FORWARD
 WITHOUT PROMPTING
14
IBM Software Group
© 2005 IBM Corporation
 If database has archival log enabled .a restore operation puts the
database in to roll forward pending state. Regardless of whether
the backup was online or offline .
 RESTORE DATABASE sample FROM C:DBBACKUP
LOGTARGET C:DB2NODE0000SQL00001SQLOGDIR
Table space Restore :
 RESTORE DATABASE sample (1)
 TABLESPACE ( mytblspace1 ) (2)
 ONLINE (3)
 FROM /db2tbsp/backup1, /db2tbsp/backup2 (4)
15
IBM Software Group
© 2005 IBM Corporation
DB2 IMPORT UTILITY
The import utility inserts data from an input file into a table or a
view. The utility performs inserts as if it was executing INSERT
statements.
 import from employee.ixf of ixf
messages employee.out
insert into employee
Messages option is used to record error, warning messages as
well as the import status.
16
IBM Software Group
© 2005 IBM Corporation
Import Modes
17
IBM Software Group
© 2005 IBM Corporation
Some useful options for Import Utility
 warningcount
 Rowcount
1. import from employee.del of del messages empsalary.out
warningcount 10 replace into empsalary (salary, bonus, comm)
2. import from employee.ixf of ixf messages employee.out
rowcount 1000 replace_create into newemployee
3. import from employee.ixf of ixf messages newemployee.out
create into newemployee in datats index in indexts
18
IBM Software Group
© 2005 IBM Corporation
More Useful options for Import
 allow write access – to allow concurrent read/write access to
tables.
 allow no access- table will be locked exclusively.
 commit count – to enforce a commit after every n records imported.
Example :import from employee.ixf of ixf
commitcount 1000
messages newemp.out
create into newemployee in datats index in indexts
19
IBM Software Group
© 2005 IBM Corporation
Output of log file
20
IBM Software Group
© 2005 IBM Corporation
Restarting failed Import
If you have import failures due to invalid input, for example, you
can use the message file generated from an import command that
uses the commitcount and messages options to identify which
record failed. Then you could issue the same import command with
restartcount n or skipcount n to start the import from record n+1.
This is a very handy
 method to restart a failed import. Here is an example:
import from employee.ixf of ixf commitcount 1000
skipcount 550
messages newemployee.out
create into newemployee in datats index in indexts
21
IBM Software Group
© 2005 IBM Corporation
Load Utility
In db2, Load process completes in 4 phases:
• Load
• Build
• Delete
• Index copy
22
IBM Software Group
© 2005 IBM Corporation
Load Phase
 During the load phase, the load utility scans the input file for any
invalid data rows that do not comply with the table definition; for
example, if a table column is defined as INTEGER but the input data
is stored as “abcd”. Invalid data will not be loaded into thetable.
and index keys are also collected.
23
IBM Software Group
© 2005 IBM Corporation
Build Phase
 During the build phase, indexes are produced
based on the index keys collected during the load
phase. The index keys are sorted during the load
phase, and index statistics are collected (if the
statistics use profile option was specified).
24
IBM Software Group
© 2005 IBM Corporation
Delete Phase
 In the load phase, the utility only rejects rows that do not comply
with the column definitions.
 Rows that violated any unique constraint will be deleted in the
delete phase.
 Note that only unique constraint violated rows are deleted. Other
constraints are not checked during this phase or during any load
phase. You have to manually check it after the load operation is
complete.
25
IBM Software Group
© 2005 IBM Corporation
Index Copy Phase
 During the index copy phase, index data is copied
from a system temporary table space to the
original table space. This will only occur if a
system temporary table space was specified for
index creation during a load operation with the
read access option
26
IBM Software Group
© 2005 IBM Corporation
Messages , Savecount and Warning count Option
 messages option is used to record warnings and errors
encountered during the load operation.
 The savecount option establishes consistency points after every
1,000 rows are loaded.
 Warningcount option will stop when the threshold of warnings is
encountered.
 load from stock.del of del
savecount 1000
warningcount 10 messages stock.out
insert into stock(itemid, itemdesc, cost, inventory)
27
IBM Software Group
© 2005 IBM Corporation
Restart and Termination of Load Utility
 Consistency points are established during the load phase. You can
use them to restart a failed or terminated load operation. By
specifying the same load command but replacing insert with the
restart option, the load operation will automatically continue from
the last consistency point.
 To terminate a load, issue the same load command but use the
terminate option in place of insert;
load from stock.del of del
savecount 1000
warningcount 10
messages stock.out terminate
28
IBM Software Group
© 2005 IBM Corporation
Modified by dumpfile option
 load from stock.ixf of ixf
 modified by dumpfile=stockdump.dmp
 messages stock.out
 replace into stock
29
IBM Software Group
© 2005 IBM Corporation
 As mentioned earlier, the load process goes through four phases.
During the load phase, data that does not comply with the column
definition will not be loaded. Rejected records can be saved in
 a dump file by using the modified by dumpfile modifier. If dumpfile
is not specified,
 rejected records are not saved. Since the load utility will not stop
unless it reaches the warning
 threshold if one is specified, it is not easy to identify the rejected
records. Hence, it is always a good practice to use the modifier and
validate the message file after a load is completed.
30
IBM Software Group
© 2005 IBM Corporation
Important Point
 The load utility checks for invalid data and unique constraints
during the load process. However, other constraints such as
referential integrity and check constraints are not validated. DB2
therefore puts target tables defined with these constraints in check
pending state. This forces you to manually validate the data before
the tables are available for further processing
31
IBM Software Group
© 2005 IBM Corporation
The COPY YES/NO Options
 Recall that changes made to the target tables during the load are
not logged. This is one of the characteristics of the load utility that
improves performance. However, it also takes away the ability to
perform roll forward recovery for the load operation. DB2 puts the
table space where the target table resides in backup pending state
when the load operation begins.
 After the load completes, you must back up the table space or
database. This ensures that the table space can be restored to the
point where logging is resumed . This is the behavior of the load
option copy no.
 You can also specify copy yes if archival logging is enabled. With copy yes,
a copy of the loaded data will be saved and the table space will not be in
backup pending state upon load completion.
32
IBM Software Group
© 2005 IBM Corporation
Thank You
33

More Related Content

PPT
DB2UDB_the_Basics Day 3
PPT
DB2UDB_the_Basics Day 6
PPT
DB2UDB_the_Basics Day2
PPT
DB2UDB_the_Basics Day 4
PPT
DB2UDB_the_Basics Day 7
PPT
DB2UDB_the_Basics
PDF
DB2 LUW - Backup and Recovery
PPSX
Solving the DB2 LUW Administration Dilemma
DB2UDB_the_Basics Day 3
DB2UDB_the_Basics Day 6
DB2UDB_the_Basics Day2
DB2UDB_the_Basics Day 4
DB2UDB_the_Basics Day 7
DB2UDB_the_Basics
DB2 LUW - Backup and Recovery
Solving the DB2 LUW Administration Dilemma

What's hot (20)

PPTX
Understanding DB2 Optimizer
PDF
IBM DB2 for z/OS Administration Basics
 
PPT
IBM DB2 LUW UDB DBA Online Training by Etraining.guru
PPT
Les 10 fl1
PPT
Les 18 space
PDF
The Top 12 Features new to Oracle 12c
DOCX
Db2 Important questions to read
DOC
DB2 utilities
PPT
Les 12 fl_db
PPT
Les 04 config_bu
PDF
DB2 LUW Access Plan Stability
PPT
Les 00 intro
PPT
Les 16 resource
PDF
Dbvisit replicate: logical replication made easy
DOCX
All types of backups and restore
PPT
Les 05 create_bu
PPT
db2dart and inspect
DOCX
IBM Utilities
PPT
Les 06 rec
PPT
Xpp c user_rec
Understanding DB2 Optimizer
IBM DB2 for z/OS Administration Basics
 
IBM DB2 LUW UDB DBA Online Training by Etraining.guru
Les 10 fl1
Les 18 space
The Top 12 Features new to Oracle 12c
Db2 Important questions to read
DB2 utilities
Les 12 fl_db
Les 04 config_bu
DB2 LUW Access Plan Stability
Les 00 intro
Les 16 resource
Dbvisit replicate: logical replication made easy
All types of backups and restore
Les 05 create_bu
db2dart and inspect
IBM Utilities
Les 06 rec
Xpp c user_rec
Ad

Viewers also liked (16)

PDF
201512 132 e-portafolio
PDF
5° básico a semana 26 al 30 de septiembre
PDF
2° basico b semana del 05 al 09 de agosto
PDF
Benamor.belgacemبرهان دويكات 0
PDF
4° básico b semana del lunes 26 al 30 de septiembre
PDF
ملاحم و ازهار Benamor.belgacem
PDF
Trad lazzarato biopoderbiopolitica
DOCX
Roteiro O Sol a Lua e a Terra
PDF
4º básico a semana 26 de septiembre al 30 de septiembre
ODP
Maneira de amar
PDF
23 de abril lectura
PPTX
PPTX
Auroras polares
PDF
Benamor.belgacemمصر 2013 دراسة تحليلية لعملية التحول السياسي في مصر
PDF
Entrevista dirigida
DOC
3 lecciones-aprendidas
201512 132 e-portafolio
5° básico a semana 26 al 30 de septiembre
2° basico b semana del 05 al 09 de agosto
Benamor.belgacemبرهان دويكات 0
4° básico b semana del lunes 26 al 30 de septiembre
ملاحم و ازهار Benamor.belgacem
Trad lazzarato biopoderbiopolitica
Roteiro O Sol a Lua e a Terra
4º básico a semana 26 de septiembre al 30 de septiembre
Maneira de amar
23 de abril lectura
Auroras polares
Benamor.belgacemمصر 2013 دراسة تحليلية لعملية التحول السياسي في مصر
Entrevista dirigida
3 lecciones-aprendidas
Ad

Similar to DB2UDB_the_Basics Day 5 (20)

PDF
Ibm db2 10.5 for linux, unix, and windows data movement utilities guide and...
PDF
Exam 1z0 062 Oracle Database 12c: Installation and Administration
PPTX
patchVantage Cloud Starter Pack
PDF
SMP / Extended orientation for IBM mainframes
PDF
RMAN in 12c: The Next Generation (WP)
PPTX
IBM Db2 11.5 External Tables
PDF
MySQL Enterprise Backup - BnR Scenarios
RTF
Readme
PDF
HTG-SQL Server 2005 - Backup & Recovery.pdf
PDF
EDBT 2013 - Near Realtime Analytics with IBM DB2 Analytics Accelerator
PPTX
database backup and recovery
PDF
DB2 Upgrade instructions
PPTX
Power point oracle db 12c
PPT
Upgrading 11i E-business Suite to R12 E-business Suite
PDF
Forms Playback: Unlocking Oracle's Hidden Tool for Fast Dataloads
PDF
Upgrading to z_OS V2R4 Part 02 of 02.pdf
DOC
Oracle applications 11i hot backup cloning with rapid clone
PDF
CICS-COBOL to J2EE Migration – White Paper
DOC
White Paper, System Z Dataset Naming Standards
PPTX
Oracle Database 19c New Features for DBAs and Developers.pptx
Ibm db2 10.5 for linux, unix, and windows data movement utilities guide and...
Exam 1z0 062 Oracle Database 12c: Installation and Administration
patchVantage Cloud Starter Pack
SMP / Extended orientation for IBM mainframes
RMAN in 12c: The Next Generation (WP)
IBM Db2 11.5 External Tables
MySQL Enterprise Backup - BnR Scenarios
Readme
HTG-SQL Server 2005 - Backup & Recovery.pdf
EDBT 2013 - Near Realtime Analytics with IBM DB2 Analytics Accelerator
database backup and recovery
DB2 Upgrade instructions
Power point oracle db 12c
Upgrading 11i E-business Suite to R12 E-business Suite
Forms Playback: Unlocking Oracle's Hidden Tool for Fast Dataloads
Upgrading to z_OS V2R4 Part 02 of 02.pdf
Oracle applications 11i hot backup cloning with rapid clone
CICS-COBOL to J2EE Migration – White Paper
White Paper, System Z Dataset Naming Standards
Oracle Database 19c New Features for DBAs and Developers.pptx

DB2UDB_the_Basics Day 5

  • 1. IBM Software Group © 2005 IBM Corporation DB2 UDB Intermediate Day5
  • 2. IBM Software Group © 2005 IBM Corporation Topics  Backup  Restore  Load  Import 2
  • 3. IBM Software Group © 2005 IBM Corporation BACKUP You can choose to backup entire database or one or more table spaces from within the database. You can also choose whether you want the backup to be taken online or offline. These options can be combined to give you a very flexible recovery mechanism for your databases. 3
  • 4. IBM Software Group © 2005 IBM Corporation Online and Offline Backup  An online backup allows other applications or processes to connect to the database as well as read modify the data while the operation is running.  An offline backup does not allow other applications or processes to access the database and their objects while the operation is being performed. 4
  • 5. IBM Software Group © 2005 IBM Corporation Database Backup 5  A database backup is a complete copy of your database objects. In addition to the data, a backup copy contains information about the table spaces, containers, the system catalog,database config file, the log control file, and the recovery history file.  Important note is that a backup does not contain the dbm cfg file or the value of registry variables.  You must have SYSADM, SYSCTRL, or SYSMAINT authority to perform a backup.
  • 6. IBM Software Group © 2005 IBM Corporation Commands for Backup 6  db2 backup db dbname Db2 backup sample to /db2backup/dir1, /db2backup/dir2 WITH 4 BUFFERS BUFFER 4096 PARALLELISM 2 • There is no keyword for OFFLINE in the syntax, as this is the default mode.
  • 7. IBM Software Group © 2005 IBM Corporation  Db2 BACKUP DATABASE sample ONLINE TO /dev/rdir1, /dev/rdir2 INCLUDE LOGS  db2 backup db test on all dbpartitionnums  db2 backup db test on dbpartitionnums (0, 3)  db2 backup db test on all dbpartitionnums except dbpartitionnums (1,2)  db2 backup db test on all dbpartitionnums online INCLUDE LOGS 7
  • 8. IBM Software Group © 2005 IBM Corporation Table Space Backup 8 In a database where only some of your table spaces change considerably, you may opt not to back up the entire database but only specific table spaces. To perform a table space backup, you can use the following syntax.  Db2 BACKUP DATABASE sample TABLESPACE (syscatspace, userspace1, userspace2) ONLINE TO /db2tbsp/backup1, /db2tbsp/backup2
  • 9. IBM Software Group © 2005 IBM Corporation Types of Backup  An incremental backup is a backup image that contains only pages that have been updated since the previous backup was taken.  In delta backups, DB2 backs up only the data that has changed since the last successfull, cumulative, or delta backup.  For incremental backups, if there was a crash after the incremental backup on Friday, you would restore the first Sunday’s full backup, followed by the incremental backup taken on Friday.  For delta backups, if there was a crash after the delta backup on Friday, you would restore the first Sunday’s full backup, followed by each of the delta backups taken on Monday through Friday inclusive. 9
  • 10. IBM Software Group © 2005 IBM Corporation Incremental and Delta Backup 10
  • 11. IBM Software Group © 2005 IBM Corporation Trackmod Parameter  To enable incremental and delta backups, the TRACKMOD database configuration parameter must be set to YES. This allows DB2 to track database modifications so that the backup utility can detect which database pages must be included in the backup image. After setting this parameter to YES, you must take a full database backup to have a baseline against which incremental backups can be taken.  BACKUP DB sample INCREMENTAL TO /dev/  BACKUP DB sample INCREMENTAL DELTA TO /dev/rdir1 11
  • 12. IBM Software Group © 2005 IBM Corporation Backup Files The backup images are stored as files. The name of the backup file contains the following parts: • Database alias • Type of backup (0=Full database, 3=Table space, 4=Copy from LOAD) • Instance name • Database partition (always NODE0000 for a single-partition database) • Catalog partition number (always CATN0000 for a single-partition database) • Timestamp of the backup • The image sequence number 12
  • 13. IBM Software Group © 2005 IBM Corporation Backup file sample 13
  • 14. IBM Software Group © 2005 IBM Corporation Restore  You can restore a database backup image and create a new database or you can restore over top of an existing database. You need SYSADM, SYSCTRL, or SYSMAINT authority to restore into an existing database, and SYSADM or SYSCTRL authority restore to a new database.  RESTORE DATABASE sample FROM C:DBBACKUP  TAKEN AT 20070428131259  WITHOUT ROLLING FORWARD  WITHOUT PROMPTING 14
  • 15. IBM Software Group © 2005 IBM Corporation  If database has archival log enabled .a restore operation puts the database in to roll forward pending state. Regardless of whether the backup was online or offline .  RESTORE DATABASE sample FROM C:DBBACKUP LOGTARGET C:DB2NODE0000SQL00001SQLOGDIR Table space Restore :  RESTORE DATABASE sample (1)  TABLESPACE ( mytblspace1 ) (2)  ONLINE (3)  FROM /db2tbsp/backup1, /db2tbsp/backup2 (4) 15
  • 16. IBM Software Group © 2005 IBM Corporation DB2 IMPORT UTILITY The import utility inserts data from an input file into a table or a view. The utility performs inserts as if it was executing INSERT statements.  import from employee.ixf of ixf messages employee.out insert into employee Messages option is used to record error, warning messages as well as the import status. 16
  • 17. IBM Software Group © 2005 IBM Corporation Import Modes 17
  • 18. IBM Software Group © 2005 IBM Corporation Some useful options for Import Utility  warningcount  Rowcount 1. import from employee.del of del messages empsalary.out warningcount 10 replace into empsalary (salary, bonus, comm) 2. import from employee.ixf of ixf messages employee.out rowcount 1000 replace_create into newemployee 3. import from employee.ixf of ixf messages newemployee.out create into newemployee in datats index in indexts 18
  • 19. IBM Software Group © 2005 IBM Corporation More Useful options for Import  allow write access – to allow concurrent read/write access to tables.  allow no access- table will be locked exclusively.  commit count – to enforce a commit after every n records imported. Example :import from employee.ixf of ixf commitcount 1000 messages newemp.out create into newemployee in datats index in indexts 19
  • 20. IBM Software Group © 2005 IBM Corporation Output of log file 20
  • 21. IBM Software Group © 2005 IBM Corporation Restarting failed Import If you have import failures due to invalid input, for example, you can use the message file generated from an import command that uses the commitcount and messages options to identify which record failed. Then you could issue the same import command with restartcount n or skipcount n to start the import from record n+1. This is a very handy  method to restart a failed import. Here is an example: import from employee.ixf of ixf commitcount 1000 skipcount 550 messages newemployee.out create into newemployee in datats index in indexts 21
  • 22. IBM Software Group © 2005 IBM Corporation Load Utility In db2, Load process completes in 4 phases: • Load • Build • Delete • Index copy 22
  • 23. IBM Software Group © 2005 IBM Corporation Load Phase  During the load phase, the load utility scans the input file for any invalid data rows that do not comply with the table definition; for example, if a table column is defined as INTEGER but the input data is stored as “abcd”. Invalid data will not be loaded into thetable. and index keys are also collected. 23
  • 24. IBM Software Group © 2005 IBM Corporation Build Phase  During the build phase, indexes are produced based on the index keys collected during the load phase. The index keys are sorted during the load phase, and index statistics are collected (if the statistics use profile option was specified). 24
  • 25. IBM Software Group © 2005 IBM Corporation Delete Phase  In the load phase, the utility only rejects rows that do not comply with the column definitions.  Rows that violated any unique constraint will be deleted in the delete phase.  Note that only unique constraint violated rows are deleted. Other constraints are not checked during this phase or during any load phase. You have to manually check it after the load operation is complete. 25
  • 26. IBM Software Group © 2005 IBM Corporation Index Copy Phase  During the index copy phase, index data is copied from a system temporary table space to the original table space. This will only occur if a system temporary table space was specified for index creation during a load operation with the read access option 26
  • 27. IBM Software Group © 2005 IBM Corporation Messages , Savecount and Warning count Option  messages option is used to record warnings and errors encountered during the load operation.  The savecount option establishes consistency points after every 1,000 rows are loaded.  Warningcount option will stop when the threshold of warnings is encountered.  load from stock.del of del savecount 1000 warningcount 10 messages stock.out insert into stock(itemid, itemdesc, cost, inventory) 27
  • 28. IBM Software Group © 2005 IBM Corporation Restart and Termination of Load Utility  Consistency points are established during the load phase. You can use them to restart a failed or terminated load operation. By specifying the same load command but replacing insert with the restart option, the load operation will automatically continue from the last consistency point.  To terminate a load, issue the same load command but use the terminate option in place of insert; load from stock.del of del savecount 1000 warningcount 10 messages stock.out terminate 28
  • 29. IBM Software Group © 2005 IBM Corporation Modified by dumpfile option  load from stock.ixf of ixf  modified by dumpfile=stockdump.dmp  messages stock.out  replace into stock 29
  • 30. IBM Software Group © 2005 IBM Corporation  As mentioned earlier, the load process goes through four phases. During the load phase, data that does not comply with the column definition will not be loaded. Rejected records can be saved in  a dump file by using the modified by dumpfile modifier. If dumpfile is not specified,  rejected records are not saved. Since the load utility will not stop unless it reaches the warning  threshold if one is specified, it is not easy to identify the rejected records. Hence, it is always a good practice to use the modifier and validate the message file after a load is completed. 30
  • 31. IBM Software Group © 2005 IBM Corporation Important Point  The load utility checks for invalid data and unique constraints during the load process. However, other constraints such as referential integrity and check constraints are not validated. DB2 therefore puts target tables defined with these constraints in check pending state. This forces you to manually validate the data before the tables are available for further processing 31
  • 32. IBM Software Group © 2005 IBM Corporation The COPY YES/NO Options  Recall that changes made to the target tables during the load are not logged. This is one of the characteristics of the load utility that improves performance. However, it also takes away the ability to perform roll forward recovery for the load operation. DB2 puts the table space where the target table resides in backup pending state when the load operation begins.  After the load completes, you must back up the table space or database. This ensures that the table space can be restored to the point where logging is resumed . This is the behavior of the load option copy no.  You can also specify copy yes if archival logging is enabled. With copy yes, a copy of the loaded data will be saved and the table space will not be in backup pending state upon load completion. 32
  • 33. IBM Software Group © 2005 IBM Corporation Thank You 33

Editor's Notes

  • #2: This presentation will discuss DB2 UDB Fundamentals.