KB Article #186700

Configure B2Bi to reconnect the Oracle database automatically during Oracle DataGuard Failover

Problem

B2Bi configured with below connection string to connect the Oracle database configured in Oracle DataGuard setup which includes Primary and Standby Host Databases.

Oracle DataGuard setup includes Primary and Standby Host Databases but installation of B2Bi or ConfigureB2Bi script allows only one database host to be specified to connect either Oracle or any type of database as shown below in below example.

jdbc:oracle:thin:@(description=(address=(host={Host})(protocol=tcp) (port={Port}))(connect_data=({ConnectionMode}={DatabaseName})))

During Oracle Dataguard failover, B2Bi tries to reconnect the Oracle database but fails with below FATAL error.

FATAL [Startup] (ConnectionManagerImpl) - Error while getting a database connection
java.sql.SQLRecoverableException: ORA-01033: ORACLE initialization or shutdown in progress

Why B2Bi receives the above error from Oracle Database and how to address this error?

Resolution

B2Bi is tested with Oracle Dataguard. During the Oracle Dataguard failover, when the Primary database host goes down, Standby database host will become primary database host and Primary database host will turn into Standby database host.

After failover, B2Bi will fail to connect the Oracle database since the database host defined in datastoreconfig.xml turned into Standby database host and no longer a Primary/Active database host. B2Bi will automatically recycle and will repeat this cycle until it can connect to a Primary database host.

In order to address the above issue, follow the below steps.

- Modify the <B2Bi_Install_Dir>/Interchange/conf/datastoreconfig.xml with Connect descriptors for both primary and standby database as shown below.

jdbc:oracle:thin:@(DESCRIPTION_LIST=(LOAD_BALANCE=off)(FAILOVER=on)(DESCRIPTION=(CONNECT_TIMEOUT=5)(TRANSPORT_CONNECT_TIMEOUT=3)(RETRY_COUNT=3)(ADDRESS_LIST=(LOAD_BALANCE=off)(ADDRESS=(PROTOCOL=TCP)(HOST=<Primary Host>)(PORT=1521)))(CONNECT_DATA=({ConnectionMode}={DatabaseName})))(DESCRIPTION=(CONNECT_TIMEOUT=5)(TRANSPORT_CONNECT_TIMEOUT=3)(RETRY_COUNT=3)(ADDRESS_LIST=(LOAD_BALANCE=off)(ADDRESS=(PROTOCOL=TCP)(HOST=<Standby Host>)(PORT=1521)))(CONNECT_DATA=({ConnectionMode}={DatabaseName}))))

- After Oracle Dataguard failover, make sure the Oracle TNS listener is stopped on Standby database which will allow B2Bi to connect Primary database upon automatic reconnection attempt from B2Bi

- Moreover, Proper solution to handle B2Bi connection with Oracle DataGuard would be to use one SCAN address for both Primary and Standby hosts in ConnectionURL under datastoreconfig.xml instead of using separate hostnames for Primary and Standby databases.