Search code examples
db2db2-luw

Accesing a RESTORED db from Data Studio


I have restored a db from db2 express-c 11.1 version to a db2 developer version. I can access the tables and data from db2 cmd but when I'm getting the following error message when trying to access tables/view/... in IBM DATA Studio.

com.ibm.db2.jcc.am.SqlException: DB2 SQL Error: SQLCODE=-20249, SQLSTATE=     , SQLERRMC=NULLID.SYSSH200, DRIVER=3.69.56
at com.ibm.db2.jcc.am.gd.a(Unknown Source)
at com.ibm.db2.jcc.am.gd.a(Unknown Source)
at com.ibm.db2.jcc.am.gd.a(Unknown Source)
at com.ibm.db2.jcc.am.yo.c(Unknown Source)
at com.ibm.db2.jcc.t4.bb.p(Unknown Source)
at com.ibm.db2.jcc.t4.bb.h(Unknown Source)
at com.ibm.db2.jcc.t4.bb.b(Unknown Source)
at com.ibm.db2.jcc.t4.p.a(Unknown Source)
at com.ibm.db2.jcc.t4.vb.i(Unknown Source)
at com.ibm.db2.jcc.am.yo.ib(Unknown Source)
at com.ibm.db2.jcc.am.yo.a(Unknown Source)
at com.ibm.db2.jcc.am.yo.a(Unknown Source)
at com.ibm.db2.jcc.am.yo.executeQuery(Unknown Source)
at org.eclipse.datatools.connectivity.sqm.internal.core.connection.StatementAdapter.executeQuery(Unknown Source)
at com.ibm.datatools.internal.core.prs.PRSDatabaseLoader.processQuery(Unknown Source)
at com.ibm.datatools.internal.core.prs.PRSDatabaseLoader.initiateQuery(Unknown Source)
at com.ibm.datatools.internal.core.prs.PRSQueryInfo.getSlice(Unknown Source)
at com.ibm.datatools.internal.core.util.PersistentQueryCache.getSlice(Unknown Source)
at com.ibm.datatools.internal.core.util.PersistentResultSet.createSlice(Unknown Source)
at com.ibm.datatools.internal.core.util.PersistentResultSet.isClosed(Unknown Source)
at com.ibm.datatools.internal.core.util.PersistentResultSet.checkNotClosed(Unknown Source)
at com.ibm.datatools.internal.core.util.PersistentResultSet.absolute(Unknown Source)
at com.ibm.datatools.internal.core.util.PersistentResultSet.relative(Unknown Source)
at com.ibm.datatools.internal.core.util.PersistentResultSetAdapter.next(Unknown Source)
at com.ibm.datatools.core.db2.luw.load.catalog.LUWCatalogDatabase.loadSchemas(Unknown Source)
at com.ibm.datatools.core.db2.luw.load.catalog.LUWCatalogDatabase.getSchemas(Unknown Source)
at com.ibm.datatools.uom.internal.content.loadmgr.LoadUtility$9.basicLoad(Unknown Source)
at com.ibm.datatools.uom.internal.content.loadmgr.ChildrenLoader.load(Unknown Source)
at com.ibm.datatools.uom.internal.content.loadmgr.LoadManager$LevelLoader.load(Unknown Source)
at com.ibm.datatools.uom.internal.content.loadmgr.LoadManager$LevelLoader.doWork(Unknown Source)
at com.ibm.datatools.uom.internal.content.loadmgr.LoadManager$LevelLoader.access$0(Unknown Source)
at com.ibm.datatools.uom.internal.content.loadmgr.LoadManager$LevelLoader$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Solution

  • After you successfully restore a Db2-LUW database to a new Db2-instance it is wise to ensure that you rebind all of the IBM supplied bindfiles to the database.

    The CLI bindfiles are part of your Db2-client, and it's wise to ensure that your Db2-client version/fixpack matches that of the Db2-server.

    Rebinding CLI utilities is essential if the Db2-version or Db2-fixpack of the restore-database differs from the original database.

    To rebind CLI utilities, follow IBM's instructions for rebinding the CLI packages here.

    Another useful activity is to revalidate database objects if the Db2 version or fixpack has changed. There's a stored procedure for that, see details here.

    Note: if your database contains SQL PL stored procedures or static-SQL packages then you may also need to rebind those packages to take advantage of any Db2 version differences. There are different ways to do this, but one way is to use db2rbind , and this should only be done on development/testing environments where you can validate the results.