Sie sind auf Seite 1von 6

Migrating DB2 from windows to AIX for Build Forge Creating new accounts on AIX Procedure:

1. Create new accounts for AIX Build Forge. 2. Add them to the group associated with the DB2 instance that you are installing (i.e. db2iadm1). 3. Set and Update passwords for Build database by using the following: Use the blue pages Domain and your intranet ID (full email address) and password.

Installing second instances for Build database Procedure:


1. Add the default group for new instance user for db2 (i.e. db2inst2) by using the following commands: Moduser G db2iadm1,db2iadm2 db2inst2 Chmof R g+w g+x /db2 (this changes the rights on the db2 directory and all sub directories). 2. Create blank database on the AIX server for migration using the following parameters: DB name = BUILD with alias of BFT. Issue the following command: o db2 CREATE DATABASE BUILD AUTOMATIC STORAGE YES ON '/db2' DBPATH ON '/db2' USING CODESET UTF-8 TERRITORY US COLLATE USING SYSTEM PAGESIZE 16384; 3. From the existing Windows server hosting db2 Quiecse the Build Forge Database by issuing the following commands from a db2 command prompt: Connect to build (db name). Quiesce database immediate. o Create a directory to export data to. o Mkdir \bfmigrate o Cd \bfmigrate 4. Run the db2 look and db2move for both databases in a separate directory. Db2look d BUILD (database name) a e m -l x f o db2look.sql Db2move BUILD export. On the AIX server create a directory under /db2 (i.e. bfmigrate).

FTP Files from Windows server to AIX server Procedure: Note: Transfer db2look.sql and db2move.lst in ascii mode Transfer *.ixf and *.lob files in binary mode. The FTP will be run from the Window server that hosts the current Build Forge data base.

1. Run the ftp command (using the instructions outline below) to FTP over the files to the AIX box Cd/bfmigrate Launch the FTP utility. Ftp AIX server (host name) and press enter. Logon using administrator id and press enter. Enter password press enter (enter password for administrator id that just entered). Change directory to target folder on the AIX server (i.e. /db2/bfmigrate) press enter. Enter type ascii Enter put db2look.sql Enter put db2move.lst Enter PROMPT N Enter type binary Enter mput *ixf. Enter mput *lob Enter bye and press enter

Changing permissions for the newly created db2 instance on the AIX server Procedure:
1. Issue the following commands as root: cd /db2/bfmigrate chown -R db2inst2 *

Running the Db2move and db2look commands on the AIX server Procedure: Note: There are 2 instances of db2 on the AIX instance 1 db2inst1 and instance 2 db2inst2 for these documents we will use db2inst2.
1. Issue the following commands: su db2inst2 cd /db2/bhmigrate db2 connect to build db2 tvf db2look.sql > db2look.log (this is an output log). db2move Build load > db2move.log more db2move.log (look for error table does not exist if present you will need to modify the db2move.lst file to include only the tables listed in the chart below and rerun the db2move command with import versus load option and outputting it to a different log file i.e. db2move.log2). db2move build import > db2move.log2

SYSTOOLS"."AM_BASE_TASKS SYSTOOLS"."AM_BASE_TASK_RPTS SYSTOOLS"."HMON_ATM_INFO SYSTOOLS"."HMON_COLLECTION SYSTOOLS"."POLICY SYSTOOLS"."STMG_DBSIZE_INFO 2. Now that that the tables are all loaded we can proceed to the next section of checking the integrity of the tables.

Correcting the Integrity Procedure: Note: A file can be built with the required commands in it using the following
script: If you are using this on windows, Sed for Windows and Awk for Windows must be installed on the server.

1. To correct the problem run the following commands: db2 connect to build REMOVED ENTERING DB2 COMMAND AND ADDED QUOTES TO NEXT STATEMENT TO BE ABLE TO RUN FROM COMMAND LINE db2 SELECT tabschema, tabname FROM syscat.tables WHERE OWNERTYPE = 'U' AND TYPE = 'T' AND STATUS = 'C' ORDER BY TABSCHEMA, TABLEID > integrity.out (creates output file). Set integrity for schema.table immediate checked; (need to get list of tables that have integrity errors) 1. Run the following command to build the file to correct the errors this command must be typed it can not be copied and pasted. You can paste this command into notepad and disable word wrap, then you may paste on AIX. db2 "SELECT tabschema, tabname FROM syscat.tables WHERE OWNERTYPE = 'U' AND TYPE = 'T' AND STATUS = 'C' ORDER BY TABSCHEMA, TABLEID" | awk '{print $1"." $2}' | sed '/^TABSCHEMA.TABNAME/d' | sed '/^record(s)./d' | sed 's/^/SET INTEGRITY FOR /g' | sed 's/$/ IMMEDIATE CHECKED;/g' > integritycheck.ddl 2. Run the following command. Db2 tvf integritycheck.ddl > integrity.out1 Check the integrity.out1 output file for errors ending with SQLSTATE=428A8 (means that the table cannot be checked until its parent has been checked). Rerun the command until all 428A8 errors are gone outputting it to a different file each time (i.e. integrity.out2 etc). You will need to run this command atleast 5 times to get all dependent tables checked. Now run Db2 SELECT * FROM syscat.tables WHERE OWNERTYPE = 'U' AND TYPE = 'T' AND STATUS = 'C' ORDER BY TABSCHEMA, TABLEID ADDED QUOTES

Now run Db2 SET INTEGRITY FOR BUILD.BF_ENVOPT, BUILD.BF_BUILDENVENTRY, BUILD.BF_BUILDENVOPT, BUILD.BF_ENVENTRY IMMEDIATE CHECKED; Now run db2 SET INTEGRITY FOR build.bf_logs, build.bf_results, build.bf_projects, build.bf_builds, build.bf_buildenv, build.bf_classes immediate checked; If you get an error regarding build.bf_buildenv, remove it from the previous command and rerun the command. If the previous command fails then rerun Db2 tvf integritycheck.ddl > integrity.out repeat each command following the integrity command until no tables are returned by your SQL. Verify that all tables are checked by running: db2 SELECT tabschema, tabname FROM syscat.tables WHERE OWNERTYPE = 'U' AND TYPE = 'T' AND STATUS = 'C' ORDER BY TABSCHEMA, TABLEID > integrity.out (creates output file). If all table are clean, you will receive, 0 rows selected. If any rows return you need to rerun db2 tvf integritycheck.ddl, then rerun this step.

3. Restart the database by using the following commands: Db2stop Db2Start 4. Update the buidforge.conf file for the Management console to point to the new AIX db2 server and restart the Console. 5. Test the newly created environment. 6. The final step is configuring the db2 configuration and setup the archive log location, failed archive log and the backup locations using the DB2 Control Center.

Appendix A
Supporting Documents: http://www.ibm.com/developerworks/data/library/techarticle/dm-0403melnyk/index.html http://www.dbforums.com/db2/1629965-db2-database-migration-windows-aix.html http://sixtydoses.wordpress.com/2008/09/23/db2-migration-across-different-platforms/

Das könnte Ihnen auch gefallen