You are on page 1of 10

My new moving vehicle DB2MOVE

“With more POWER and less gas”

Db2udb LUW version 10.x onwards DB2’s got Talent Finals

3/19/2013

DB2's Got Talent Finals

By Renu Sharma of ACE DBA CONSULTING Inc

1

When to use db2move W • • OS independent backup • Duplicate the schema •

When to use db2move

W

OS independent backup

Duplicate the schema

Database size is small

• DBA’s are too busy to take backup for me

Shop has not got online backup

Data of single schema is required

Application deployment had to be done yesterday

Restoring earlier backup image will take time

Moving Bulk Data without intervention and without creating individual export and import/load scripts

3/19/2013

DB2's Got Talent Finals

By Renu Sharma of ACE DBA CONSULTING Inc

2

What is db2move and Its Authorizations

Bulk data movement tool

Mode

1. Export , Import or Load

2. Copy Mode

Format

1. PC/IXF

Import or Load 2. Copy Mode • Format 1. PC/IXF • Same authorization as these API’s

• Same authorization as these API’s

1. Export

2. Import

3. Load

3/19/2013

DB2's Got Talent Finals

By Renu Sharma of ACE DBA CONSULTING Inc

3

db2move Command Syntax

db2move dbname --action

Export

Import

Load

Copy

Source
Source
Target
Target
– dbname --action Export Import Load Copy Source Target – options -tc--table-definers -tn--table-names
– dbname --action Export Import Load Copy Source Target – options -tc--table-definers -tn--table-names

options

-tc--table-definers

-tn--table-names

-sn--schema-names

-ts--tablespace-names

-io--import-option

-lo--load-option

-co--copy-option

-l--lobpaths

-u--userid

-p--password

--aw

3/19/2013

DB2's Got Talent Finals

By Renu Sharma of ACE DBA CONSULTING Inc

4

db2move Actions

EXPORT

1.

Exports data depending on filteration criteria

2.

No options means - exports all the tables

3.

Internal information is stored in db2move.lst file

IMPORT / LOAD

1.

Imports/Loads all tables of db2move.lst

2.

Uses -io option for IMPORT

3.

Uses

-lo option for Load

COPY

for IMPORT 3. Uses -lo option for Load • COPY 1. Duplicates the schema 2. SYSTOOLSPACE

1.

Duplicates the schema

2.

SYSTOOLSPACE table space has to exist

3/19/2013

DB2's Got Talent Finals

By Renu Sharma of ACE DBA CONSULTING Inc

5

Db2move with copy

options -co

Mode

1.

DDL_AND_LOAD : Default

2.

DDL_ONLY

3.

LOAD_ONLY

Mandatory Options

1. Target database

has to be local

Optional Options

1. Target database has to be local • Optional Options 1. SCHEMA_MAP : Maps source schema
1. Target database has to be local • Optional Options 1. SCHEMA_MAP : Maps source schema

1. SCHEMA_MAP : Maps source schema to target schema

2. NONRECOVERABLE : Tablespace will not put in backup pending state

3. TABLESPACE_MAP : Maps source tablespace to target tablespace

4. PARALLEL : Load spreads over number of threads

5. OWNER : Change owner at target database

3/19/2013

DB2's Got Talent Finals

By Renu Sharma of ACE DBA CONSULTING Inc

6

db2move Trick or Treat

oh no its

db2move Tips and Tricks

db2move Trick or Treat oh no its db2move Tips and Tricks • Delete or comment the

• Delete or comment the files in db2move.lst if you don’t want to load all tables

Create individual load scripts for GENERATED ALWAYS identity columns

Use Parallel parameter from 0 -16 Threads

Timings of db2move with Parallel 16 threads

Load without Parallel

Load With 16 Threads

real

403m6.468s

real

369m58.965s

user

0m0.315s

user

0m0.303s

sys

0m0.144s

sys

0m0.077s

Almost 10 % load time improvement with parallel option

3/19/2013

DB2's Got Talent Finals

By Renu Sharma of ACE DBA CONSULTING Inc

7

Restarting db2move with copy option

Error Types :

1. DDL : Recreate Objects

2. Load : Reload data

Error Type Files :

1. COPYSCHEMA_timestamp.ERR

Reload data Error Type Files : 1. COPYSCHEMA_ timestamp .ERR 2. COPYSCHEMA_ timestamp .MSG 3. LOADTABLE.timestamp.MSG

2. COPYSCHEMA_timestamp.MSG

3. LOADTABLE.timestamp.MSG

4. LOADTABLE.timestamp.ERR

Check Load Error States, e.g., Load Pending :

Use Load Query table tablename or List utilities show details

Restart LOAD

Run load from /dev/null of ixf into table name or run load Terminate

Remove the error files and restart Load

3/19/2013

DB2's Got Talent Finals

By Renu Sharma of ACE DBA CONSULTING Inc

8

Restrictions and Performance Parameters For db2move

Restrictions and Performance Parameters For db2move • Tables having GENERATED ALWAYS identity column cannot be imported

Tables having GENERATED ALWAYS identity column cannot be

imported /loaded

LOAD command has to be run locally where the database and the data file resides

Loading data into tables containing XML columns is only supported for

the LOAD , Import but not for the COPY action

db2move performance parameters

1. sortheap

2. util_heap_sz

3. logfilsiz

4. logprimary parameters

5. Adding pages to bufferpool sizes

4. logprimary parameters 5. Adding pages to bufferpool sizes 3/19/2013 DB2's Got Talent Finals By Renu

3/19/2013

DB2's Got Talent Finals

By Renu Sharma of ACE DBA CONSULTING Inc

9

Links and Resources • The db2move command now supports parallel processing •

Links and Resources

The db2move command now supports parallel processing

db2move - Database movement tool command

Restarting a failed copy schema operation

My contact and my

Renu Sharma ACE DBA Consulting Inc

blog info

www.db2dbas.com

renusharma@db2dbas.com, renusharma@aol.com 732-342-7630, 732-995-9963,732-374-3601

3/19/2013

DB2's Got Talent Finals

By Renu Sharma of ACE DBA CONSULTING Inc

10