How to copy an entire schema between AIX and Windows:
A few months ago I had the need to setup a standalone environment in my laptop in order to have independency while testing and develop a new system architecture.
The problem was the dB2 schema that I needed was on a AIX machine. So I had to copy it all and move to my Windows machine.
Here’s the step-by-step of how to do it:
- On your AIX machine, export data of schema MY_SCHEMA
db2move DBNAME export -sn MY_SCHEMAThe output of this produced is:
- EXPORT.out-Contains a summary of the completed action (ASCII).
- db2move.lst -Contains a list of original table names, their corresponding PC/IXF file names, and message file names (ASCII).
- tabn.ixf -Contains exported data from a user table, identified by n (binary).
- tabn.msg -Contains messages about the requested action against a user table, identified by n (ASCII).
- tabna.nnn -Contains exported large object (LOB) data for a user table, identified by n. The file name extension is a number ranging from 001 to 999, and a is an alphabetic character.These LOB files, which are created only if the table being exported contains LOB data, are placed in the LOB path directories system.msg
db2look -d MY_SCHEMA -o db2look_sch.sql -e -z MY_SCHEMA -l
tar cf - * | gzip > /big/schdb2.tar.gzThis rec funtion is intended to downdload the file from the remote aix machine through scp tool
rec aixmachinename /big/schdb2.tar.gz
sed -i 's_/pfdata/db2ipf2/DBNAME/db2ipf2/_C:\\DB2\\_' db2look_sch.sql
sed -i 's_/pfdata/db2ipf2/MY_SCHEMA/_C:\\DB2\\NODE0000\\SAMPLE\\_' db2look_sch.sql
sed -i 's_/pfdata/db2ipf2/datatmp\_tbs/_C:\\DB2\\NODE0000\\_' db2look_sch.sql
sed -i -r 's/(USING *\(FILE .* )([0-9]*)\)/\11 M\)/' db2look_sch.sql
sed -i 's_MY_SCHEMA_SAMPLE_' db2look_sch.sql
sed -i 's/AIXDBOWNER /WINDBOWNER/' db2look_sch.sql
db2 -tvf db2look_sch.sql > db2look_sch.log
db2move SAMPLE load
GRANT ALL ON SECURITY_MANAGER.T_SECURITY_MAINTENANCE TO DB2USER