Reputation: 15
i have a DB2 db in ubuntu enviroment. The empty database with all the tables already exists. Now I want to import 1000 corresponding *.ixf files into the database. Additionally I have a * .msg file for each file.
Does one know how to do that? Thanks, Jassin
Upvotes: 0
Views: 1009
Reputation: 7693
Do you have a lst file? it you have that, then you can perform a db2move import or db2move load, and then the RDBMS will put all this data into the database.
The ixf files contains the table definition plus the data.
The msg files have information about the time of the export. Once you perform a db2move import you will regenerate these files with the information about the import.
Upvotes: 1
Reputation: 12267
For speed reasons, you don't have to use import, you can instead use the Db2 load utility. Only use import if you already know the files are tiny and there is sufficient transaction logging capacity, or the tables exist but not the indexes and you want the import action to create the indexes also.
The solution depends on your scripting skills, and how often you want to run the job. You will need to know which file populates which table regardless of the technique you use.
Db2 on Linux is very programmable with shell scripting (for example , with bash). This is a skill worth learning.
You can also script this type of stuff in perl, or python, or any scripting language.
Simplest (and slowest) way is to use the Db2 LOAD utility to inject the files in series.
More sophisticated ways include using the Db2 LOAD utility in parallel, depending on the number of cores you have available, and the avaialable I/O bandwidth. For example if you have 32 cores, you might have 20 concurrent load jobs each loading a separate table with subtask having its own connection to the database. There is no benefit to this approach unless your containers are on a SAN with plenty of I/O bandwidth.
Regardless of whether you are loading in series or in parallel, you should have checks on each command exit-code, and an ability to restart from the point of failure, and to verify that the number of rows loaded matches the number of rows in each IXF file (accounting for any rejected rows).
Upvotes: 1