Recently we had upgraade a db2 8.1 database running on Windows to db2 9 running on a Linux based server. From the IBM documentation it appeared that it was possible to upgrade the database and change platforms but it was quiet difficult to find out exactly how.
Backup db2 on Windows and restore on Linux?
Firstly db2 supports the restoring of backups from one platform to another as long as they are in the same "platform family". This means that a backup on a linux platform will restore to another linux distribution like from Redhat to Debian, or from Windows 2003 to Vista, but unfortunately not from Windows to Linux.
How to upgrade db2 versions
Upgrading from one version to another, in db2 terminology is called migration. There is a "MIGRATE" command to migrate databases to later version. The step to migrate databases are to:
- backup the current database,
- upgrade db2 server,
- restore the backup (read documentation to see if this is ok. For 8->9 it works)
- run the MIGRATE command on the restored database
The only catch here is that this seem only to work as long as you are in the same platform family. ie windows, linux or aix.
Upgrade and change platforms at the same time?
After scouring the net and the, difficult to search, IBM site I found a command called "dbmove". This command is the recommended way to move a database between platforms. This will essentially dump the database out to a folder which can then be imported into db2 on the new platform with the same command.
- "db2move <database name> EXPORT
- by default this will dump all the files out to the current working folder. Move this folder to the new platform,
- "db2move <database name> IMPORT"
- This command needs to be run from inside the exported folder. The database should exist before running the import.
I ran this on an export from db2 8.1 and imported it on db2 9 and all appears to be working fine so far.