Db2v8 data migration and db2v8 migration
Db2 data migration
Version: v8.1
Task: get data from production to test environment
Problems encountered during handling:
1. Character Set problems. The source database code page is gbk, and the target database code page is uft-8
Solution: format conversion during export or import
Note: In the gbk library, a Chinese character occupies two bytes, while in the uft-8, a Chinese character Station Three bytes, when importing the target library, there is an alarm error that the field exceeds the length
Export:
Db2 "export to xxx. ixf of ixf select * from xxx"
Db2 "export to xxx. ixf of ixf modified by codepage = 1208 select * from xxx" -- the length of fields with the field type char and varchar In the table structure is automatically doubled.
Db2 "export to xxx. del of del modified by codepage = 1208 select * from xxx"
Import:
Db2 "load from xxx. ixf of ixf replace into xxx nonrecoverable"
Db2 "load from xxx. del of del replace into xxx nonrecoverable"
Note: During load import, if the length field is too long, it will take a lot of time to print every long record. In this case, the length of the table field is expanded and then the data is imported. You can use db2 list utilities show detail to view detailed information during load import.
2. Field Type Change
Db2v8 does not seem to be able to be directly modified. You can only delete a field and add a field. If you are helpless, there will be an index on the field... you can only make a big move to recreate the table.
To ensure security, first back up the table structure in the original environment
Method 1: db2 "export to tbname. ixf of ixf select * from tbnamewhere 1 = 2"
Method 2: db2look-d dbname-e-t tbname-o tbname. SQL
Modify the SQL statement exported in method 2, increase the length of the field, and run db2-tvf tbname. SQL to recreate the table.
In addition, I wanted to delete the database in the test environment and directly retrieve all the ddl objects of the production database. I restored the database in the test environment. Due to time constraints, I have never done any more, I am afraid that it will be broken down. I will try again next time. There are no related scripts, and I hope that experienced comrades will give me some advice and provide more guidance.
A temporary empty database is created.
Db2 create dbname using codepage = 1208 territory cn
Create a buffer pool
Db2 create bufferpool bp16k size 2000 pagesize 16384
Create a tablespace
Db2 create tablespace tpname pagesize 16384 managed by database using (file, '/dd/ddd', size) bufferpool bp16k
Summary: during the migration process, other problems, such as log overflow and deadlocks, were encountered. After all, the test environment and production were not comparable, and the parameter configurations were also different. But in general, most problems can still be solved.
Thank you for your guidance. TIPS: plan what to do, consider the existing problems, and take every step to handle the problems encountered.
QQ data migration
QQ data migration refers to saving all the data in your original QQ when you want to change the QQ version. For example, if you want to download qq 2010, but want to save the original chat record, you need QQ data.
How to migrate data?
If you do not have any professional staff, find an outsourcing company.
At that time, we were working with Beijing boxunniko. It was pretty good.
Recommended for you: 400 | 008 | 2008. Call to learn more.