Migrating Connections DB from Oracle to DB2 part 3

In part 3 of the series we will actually attempt to migrate the data.


Migrating Connections DB from Oracle to DB2

In my experience the database migration is always most time consuming, so I always do the database first

Use the text file of Commands that we created in part 2.

  • Back up the exisitng Connections databases
  • Drop database, create database, app grants (for homepage also initdata, and re org and run stats)
  • CR update scripts
  • Pre DB fixer script
  • Run the DBT command
  • Application specific scripts (IBM provided addional fixup scripts for Blogs, Files and Wikis for me)
  • Post DB fixer script
  • Re org script
  • Run stats script

I run the commands one database at a time. This made it much easier for troubleshooting issues and ensuring that each database was in a consistent migrated state before moving onto the next – if I had issues I made notes in the commands text file and moved on to the next DB.

Homepage took a very long time to migrate as there was a LOT of data here, the other DBs I had issues with were Files, Wikis and Blogs which are the ones that IBM expect to cause issues. I will use Blogs as an example on how to troubleshoot later.

I also had some DBs that were already using DB2 like IBM Docs, Surveys app for Communities and ProjectExec – we backed these up also and migrated them across to the server in the sameway that we would do a normal DB migration – Droped, restored and checked the DB roles and permission. These all came across with no issues.



It goes without saying that you should ALWAYS RUN THIS ON A TEST / DEV SERVER FIRST!

If i could have this as scrolling flashing marquee text with it playing a siren I would. I CAN NOT emphasise enough how important it is that you should run this in a test environment – which we did 3 times before actually doing it for real.

The most troubleshooting I did on this project revolved around the dbt transfer script (see example below).

The database schemas are quite different between types and even between OS versions so there will be a lot of tinkering to resolve the problems. Typically its where one DB type expects a NULL and the other expects a NOTNULL

Firstly run the script

java -cp D:\IBM\Connections\ConfigEngine\lib\DBT_HOME\dbt.jar;D:\IBM\Oracle\ojdbc6.jar;D:\IBM\SQLLIB\java\db2jcc.jar com.ibm.wps.config.db.transfer.CmdLineTransfer -logDir D:\IBM\Connections\ConfigEngine\lib\DBT_HOME\logs -xmlfile D:\IBM\Connections\ConfigEngine\lib\DBT_HOME\files\activities.xml -sourcepassword sourcepassword -targetpassword targetpassword

If there are problems it will be shown in the console and written out to a log file.

for example you may see an error like this:

[07/20/16 13:22:56.756 PDT] com.ibm.db2.jcc.am.SqlIntegrityConstraintViolationException: Error for batch element #50: DB2 SQL Error: SQLCODE=-407, SQLSTATE=23502, SQLERRMC=TBSPACEID=3, TABLEID=5, COLNO=1, DRIVER=3.65.110

All of these issues I saw related to the NULL / NOTNULL issue.

The next step is to make a note of the tablespace id, table id and column number as we need those for an sql query.

Fire up your DB client and run the following query



Use the TBSPACEID, TABLEID & COLNO from the error message

The query will report back the DBName (as the TABSCHEMA), the table name (as TABNAME) and the column name (as COLNAME)

 ---------     ---------------     --------

Now you have the name of table and column with the null/not null issue.

The next step is to edit the createDB.sql script to make the change in the example here remove the not null from the username field as below.

create table BLOGS.rollerloginname (
    userid             varchar(48) not null,
    username           varchar(255),
    ORG_ID             varchar(36) not null


Once that change has been made the process needs to start again…


  • Drop database, create database, app grants (for homepage also initdata, and re org and run stats)
  • CR update scripts
  • Pre DB fixer script
  • Run the DBT command

Rinse and repeat until the DB transfers all the tables over correctly. This part of the process took the longest. Working out which tables to remove the not nulls from was SO time consuming. I kept a record of all the tables / columns I changed for my records more than anything else, at least the Post DB fixer script puts things back to the way it should be – and if you do hit issues with that you can manually fix them as you have a record.




So hurrah .. after all of that mucking about we have the Connections 5 data from Oracle on AIX in to DB2 on Windows – now what?

Well I backed it ALL up, including the existing V5 DB2 databases Docs, FEB and Projexec and migrated it to Version 5.5.

On the whole this part of the process wasn’t too bad and it was a good test for a real live migration ..


Migrating to Live

The whole migrating to live took about 21 hours in total – including waiting time for the DBs to transfer and the steps were are follows

On the Live5 machines

  • Stop Connections
  • Backup the File system
  • Back up the DB2 databases that need migrating (FEB, Docs, Projexec)

On the Dev5 DB machine (that I had been using for testing)

  • Drop database, create database, app grants (for homepage also initdata, and re org and run stats)
  • CR update scripts
  • Pre DB fixer script
  • Run the DBT command
  • Application specific scripts (IBM provided addional fixup scripts for Blogs, Files and Wikis for me)
  • Post DB fixer script
  • Re org script
  • Run stats script
  • Restore the backed up Live DB2 databases (FEB, Docs, Projexec)
  • Backup the DBs – so we now have a FULL set of V5 DB2 data
  • Copy backups to LIVE 55 DB2 machine

On the Live5.5 machines


  • Stop Connections
  • Drop the DB2 databases
  • Restore the V5 DB2 databases
  • Set numb dbs to at least 25
  • Run the upgrade scripts to update them to V5.5 – ran these manually not using the GUI as the amount of data caused issues
  • Run the CR updates
  • Run the Docs DB2 Fixes
  • Run the FEB DB fixer from the FEB admin GUI
  • Started Connections
  • Cleared the scheduled tasks
  • Post migration steps
  • Restarted Connections

And we were live 🙂

This took WAY longer than it should have done because of all the issues we had with the DBT to begin with .. but hopefully info in these posts will hope anyone who needs to do this pre PINK.

This was a LONG journey – but we all learned a lot in the process of doing this .. the main lesson learnt was don’t attempt this unless you HAVE to 🙂

If you missed the other 2 parts of this series you can find them here:



Migrating Connections DB from Oracle to DB2 part 2

In part 2 of this series we will cover preparing the system and the commands and files required.

There is a fair bit of file creation to do and configuring of the Database Transfer Tool (DBT)


Migrating Connections DB from Oracle to DB2

Step 3 – Prepare a system to recieve the data

As I stated previously do not think you can recycle an existing Connections server if it has been installed with the DB type you are migrating away from as it causes issues with files particually.

In my case I had an existing V5 dev system using the test oracle DB. I backed it all up – Existing DB2 databases, Docs configuration files, file system (connections shared data) and docs/viewer shares – we will need this later.

Blow that system away and rebuild a clean, fresh V5 system – should only take a few hours 🙂

Once you have a clean V5 system – make sure it all works .. then back up the empty DBs and filesystem files.

Its essential that you know the system works before attempting to migrate data.

Step 4 – Prepare files and commands

4.1 Prepare the Database Transfer Tool

Create the DBT_HOME directory

On the db2 server create the DBT_HOME directory under <CONNECTIONS_ROOT>\ConfigEngine\lib

On my system this was D:\IBM\Connections\ConfigEngine\lib\DBT_HOME

Under DBT_HOME create additional directories of files to hold the xml files required for migration and logs for all logs relating to the migration

Locate the dbt.jar from the Connections machine (<CONNECTIONS_ROOT>\ConfigEngine\lib in my case  D:\IBM\Connections\ConfigEngine\lib)  and copy it to the newly created DBT_HOME directory on the DB2 server.


Create the XML files required

Create an XML document for each application DB that is to be copied over and place it in the the DBT_HOME\files folder


Example below of the activites.xml :

<dbTransfer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database role="source"
<database role="target"
<table sourceName="activities.system_lastmod" exclude="true"/>


The source in this example is is oracle the target is db2

Once completed you will have the follwing xml documents in the DBT_HOME\files directory

  • activities.xml
  • blogs.xml
  • dogear.xml
  • files.xml
  • forum.xml
  • homepage.xml
  • metrics.xml
  • mobile.xml
  • people.xml
  • sncom.xml
  • sncomcal.xml
  • wikis.xml

Ensure the DB drivers are accessible

It is essential that the oracle drivers are accessible by the DB2 (target) server.

Oracle driver & DB2 driver paths – we need these later.



V5 & V5.5 Wizards are required

When building the commands to migrate the DB some scripts are missing from the V5 Wizards directory. After speaking with IBM its safe to use the V5.5 wizard files for the missing scripts.


Replace the connections.sql scripts

Replace the SQL scripts given to you by IBM into the relevant directories .. in my case they were for files, wikis and blogs


4.2 Prepare the commands required

Prepare the commands for each DB  they will comprise of the following:

drop database, create database, app grants (for homepage also initdata, and re org and run stats)

CR update scripts

Pre DB fixer script

the DBT command string which has the following syntax

java -cp <path to DBT home>\DBT_HOME\dbt.jar;<Oracle driver>\ojdbc6.jar;<db2 driver>\db2jcc.jar com.ibm.wps.config.db.transfer.CmdLineTransfer -logDir <path to DBT home\logs>\DBT_HOME\logs -xmlfile <path to DBT home\files>\DBT_HOME\files\<application xml>.xml -sourcepassword sourcepassword -targetpassword targetpassword

Application specific scripts (IBM provided addional fixup scripts for Blogs, Files and Wikis for me)

Post DB fixer script

Re org script

Run stats script


== Activities Example==

cd C:\InstallTemp\Connections\V5\Wizards\connections.sql\activities\db2

db2 -td@ -vf dropDb.sql

db2 -td@ -vf createDb.sql

db2 -td@ -vf appGrants.sql

cd C:\InstallTemp\Connections\V5\CR3\50cr3-database-updates\50cr3-database-updates\From-50\db2\

db2 -td@ -vf 50-CR1-activities-db2.sql

cd C:\InstallTemp\Connections\V55\connections.sql\activities\db2

db2 -tvf predbxfer50.sql

cd C:\InstallTemp\Connections\V5\Wizards\jvm\win\jre\bin

java -cp D:\IBM\Connections\ConfigEngine\lib\DBT_HOME\dbt.jar;D:\IBM\Oracle\ojdbc6.jar;D:\IBM\SQLLIB\java\db2jcc.jar com.ibm.wps.config.db.transfer.CmdLineTransfer -logDir D:\IBM\Connections\ConfigEngine\lib\DBT_HOME\logs -xmlfile D:\IBM\Connections\ConfigEngine\lib\DBT_HOME\files\activities.xml -sourcepassword sourcepassword -targetpassword targetpassword

cd C:\InstallTemp\Connections\V55\connections.sql\activities\db2

db2 -tvf postdbxfer50.sql

cd C:\InstallTemp\Connections\V5\Wizards\connections.sql\activities\db2

db2 -td@ -vf reorg.sql
db2 -td@ -vf runstats.sql

note: The RED section of the example script above should be run in a standard command window. The other scripts should be run from a db2cmd window.


I have a long list of commands in a text file that contains one of these blocks for each application a example of this can be downloaded here to use as a template for the syntax – note: that you should use this at your own risk, take advice from IBM and ensure that all the paths and passwords are set correctly before running.

One of the main reasons for dropping and creating manually is that the gui db wizards seem to have real issues – unsure why, but when we ran the db scripts manually they worked no issue – also there is an advantage that if we do see problems the script logs can be piped to a specific file. This was very helpful with all of the troubleshooting we had to do. If you do see issues with any of the commands they can be piped to a log to send to IBM – for example:

db2 -td@ -vf createDb.sql > C:\Install\temp\activities_createDb.txt

This was a lifesaver / timesaver for troubleshooting any db commands – as each command can be output to easily isolate what the issue is.


Step 5 – BACKUP

Before we start to do anything  we are going to make some backups. Stop the existing V5 DEV server now we know its working and back it up. Take a copy of the clean DBs (including additional DBs such as FEB for surveys, CONCORD for Docs and any 3rd party tool DBs such as PROJEXEC etc.)  and the file system (Connections data\shared, docs share, viewer share etc.). In my case I had to prove that it was working prior to the DB migration so this back up was essential.

If you are going to run a test against your live systems data ensure that you also get a good back up of the file system when the system is down, if possible run the test when the live system is down (out of hours / on a weekend etc.) as the DB peice of the migration is very time consuming and you may need to troubleshoot issues.

The basic rule of thumb is treat this test like any normal Connections DB migration or update Stop it all and back it up.


What’s next?

Now we are all prepared .. we can attempt a test at the data migration .. check back in a few days for part 3 of Migrating Connections DB from Oracle to DB2 – where the fun really begins

Migrating Connections DB from Oracle to DB2 part 1

For those of you that follow me on twitter, you will have noticed that I have posted a number of tweets relating to a fun project I am working on.

I have been working with a customer to move them from Connections 5 to Connections 5.5 – Not a massive issue – EXCEPT they are currently using Oracle for the Connections DB and they can not upgrade it to the version required by 5.5 for quite some time, as most of their business systems require the version of Oracle currently running.

This has been a pain .. like you wouldn’t believe .. what should be a simple process has turned into the project from hell!! BUT I am not one to throw the towel in so we have persevered. I must say I was not overly enthused by some of the issues and mistakes that have been made on our side and IBMs but we do have light at the end of the tunnel.

I am going to work through a series of Blog posts to help anyone else who needs to do this ..

Migrating Connections DB from Oracle to DB2


  1. Open a PMR – you will need specific help from IBM as this is an unsupported action – they will help you though. Be VERY specific and clear in exactly what you are trying to achieve as it can lead to confussion.
    • State the version of the DB you are moving from – in this case Oracle 11.2 on AIX
    • State the version of the DB are moving too – DB2 10.1 on Windows
    • State why you are doing this – as this is important for justifying the support time to help. In our case the customer is a current Connections 5 and Docs user, we have a requirement to upgrade Connections to  V5.5 to take advantage of the new features. As Connections 5.5 requires Oracle 12 and the customer can not update the underlying oracle system a move to DB2 is the best course of action. DB2 for Connections will be managed independantly from the rest of the applications.
    • Test the migrated Oracle data with DB2 and Connections 5 to ensure the system is working as expected.
    • Migrate the tested data to Connections 5.5
    • Then do it for real in live
  2. Make sure you have data to test – in our case there is a Connections 5 dev environment pointing to an oracle DB.
  3. Prepare a system to recieve the data – The Connections 5 dev system already had the correct version of DB2 installed as we were using IBM Docs and FEB (for Connections Surveys). We simply created the additional Connections 5 DBs on the dev machine ready to accept the data.
  4. Become familiar with the DBT – The Database Transfer Tool is the only way to get the data out of one system and into another. There are files to prepare and commands to comprise. Have a good text editor, with tabs, you will need it – notepad isn’t going to cut it.
  5. Get good BACKUPS – Backup the clean Connections 5 DBs before attempting to migrate you may need to roll it back, also ensure you back up any existing DBs you have (such as CONCORD for Docs or FEB for Surveys).
  6. Be preapred for multiple attempts – There is a lot of trail and error and fixing issues and trying again. This is not a one time deal.
  7. Logs and SQL queries – There will be a lot of looking at logs and running SQL queries, editing the create db scripts and running again. If you aren’t comfortable with that find someone to help you as you will be by the time we are done.

Things to note

I assumed that becuase I already have a DEV version 5 Connections system I could use that. Create new DBs, migrate the data, switch the datasources to the new database and we should be good – NO – THAT DOESN’T WORK!!

When Connections is installed and you select the type of DB that you are installing against, that is hardcoded somewhere in a config that we couldn’t find .. we WASTED SO MUCH TIME trying to get that sorted and eventually had to give up and reinstall.

If you have an existing system – BACK IT UP, blow it away and reinstall. Don’t waste time and effort trying to fix it .. files will not work.


Step 1 – Open a PMR

You MUST do this. IBM will help you even though they do not officially support moving DB types and OS’s. It is much easier if you are staying on the same OS or same DB type, but moving both isn’t fun. This should theoretically be a once only deal – once moved from Oracle AIX to Windows DB2 there will be no going back.

As I stated in the overview be VERY specific and explain exactly what you are trying to achieve. Give IBM the exact DB versions with fixes so they can give you new versions of any DB create scripts they need. In my case Files, Wikis and Blogs needed significant changes to the database create scripts. IBM also sent additional scripts for the fixup post migration so ensure you have those. Back up the original connections.sql folder under the V5 wizards directory (connections.sql.backup in my case) and add any changes to connections.sql.


Step 2 – Test data

Make sure you have data to test with. Initially I used the Connections 5 DEV system to test but have since moved on to live data, but the test data has to be from a working system so you can compare.

You must have access to read and write to the DBs as this is required to actually migrate the data. Back up the file system to copy the shared data over.

There may also be differences in data between your live and dev systems so be prepared to edit scripts again and keep copies of all the scripts and workings out you have done.. it will help you document it (yes I said the D word .. Write it all down, you will thank me for it later).


Check out Part 2 where we will actually prepare the system and write everything we need to actually get on and do the data migration.

Issues with Oracle with Connections 2.5 RESOLUTION

as posted by me on the Connections Blog earlier today :

IBM have now released new trigger code to resolve this issue.

The steps are simple

* Stop the application
* Backup the DB
* Run through the code to remove the Trigger
* Recreate the Trigger
* Start the primary server and test
* Assuming all is well start the other App Servers in the clusters

As yet IBM are unsure as to how they are going to release the fix as it falls out of the typical iFix scope.
If you are seeing this specific issue please contact the Lotus Connections Support team who will furnish you with the appropriate code to resolve the issue.
As soon as I have confirmation on how this will be distributed I will add what will hopefully be the final update to this on-going saga.

Big thanks to Kieran Reid at IBM and Andrew Frayling and his team at Cardiff Uni for assistance and support in resolving this issue. Great work all round.

Issues with Oracle on Solaris with Connections 2.5 UPDATE

As I posted on the Connections Blog earlier today …

At last it appears there may be a *real* fix for this .. IBM have changed the trigger code which should hopefully fix the mutating trigger issue we see when deleting files ..

I will be testing this today and if it works rolling it out to my live environment over the next week.

I will attempt to get some confirmation if this code will be fixed in all new fix packs and APARS – watch this space and hopefully some great news

Issues with Oracle on Solaris with Connections 2.5 – UPDATE

After some testing with the SPARC version of this fix – which actually did work we were pleased to find out that Oracle had released a version for x86.

We applied this – this morning, and I am sorry to say it doesn’t work. If you try to delete a file from the DB directly or through the connections interface, the DB is still throwing the mutating trigger issue.

Plot thickens – time to go back to oracle 🙂

Issues with Oracle on Solaris with Connections 2.5

There is an issue when running Connections with Oracle on Solaris
Symptoms of the problem are you can not delete certain files and / or the files widget from communities

The error in the logs is – table FILES.MEDIA is mutating

08/02/10 00:01:00:569 GMT] 0000005d Library E EJPVJ9166E: Unable to delete the library with id b855660b-d6bc-4b19-891f-2087aa3d9a0c. [UserImpl@26ce26ce id=64377ea3-e571-4323-922a-dc0723fead36 directoryId=2BE4B3FF-4AB4-48FF-9B83-73689537A16A]
java.sql.SQLException: ORA-04091: table FILES.MEDIA is mutating, trigger/function may not see it
ORA-06512: at “FILES.PKG_MED_DOWNLOAD_UPD”, line 45
ORA-06512: at “FILES.MED_DOWNLOAD_UPD_S”, line 2
ORA-04088: error during execution of trigger ‘FILES.MED_DOWNLOAD_UPD_S’

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)

We have since discovered (thanks to Kieran Reid in Connections Support for doing the leg work) that this is an issue with Oracle on Solaris – the triggers have an issue which is fixed in – which is a big no no as far as connections go. There is a fix that you can apply to that will resolve the problem.

From support.oracle.com search the knowledge base for 4574851
You should get three results, select the third match
Click on the link for Patch.4574851
Select the release for the Solaris platform
Download, install and test.

*NOTE* this fix is only available for SPARC not x86

So far this appears to have fixed the issue on the backup of the Prod database (I have put a stand-alone LC25 in front of it to test which involved all sorts of DB hacking to get it to work – not recommended unless you are desperate for a quick test). I am hoping to schedule moving our prod DB from x86 to SPARC applying the patch and then plugging my LC25 cluster into it.

Futher to the Portal 6.1.5 set up

Futher to the Portal 6.1.5 set up – these steps were required from an ORACLE DB point of view to get the DB configured :

Grant create session to community
Create likeminds user
Grant create table to community
Grant create view to jcr
Grant unlimited tablespace to community

and also these

grant select on sys.dba_pending_transactions to public;
grant select on sys.pending_trans$ to public;
grant select on sys.dba_2pc_pending to public;
grant execute on sys.dbms_system to public;

if you don’t do this then it just doesn’t work 🙂