IBM Support

How Oracle export and import commands affect database schema upgrade

Troubleshooting


Problem

When a Business Process Choreographer database running on Oracle is backed up and restored using the export and import commands the predefined primary keys might not be restored correctly. Instead any other matching index might be used to implement the primary key constraint.

Symptom

When upgrading the Business Process Choreographer database using one of the upgradeSchema<nn>.sql scripts that have been generated with the database design tool (DbDesignGenerator) an error message like the following might be displayed:
DROP INDEX TI_TI_TT_KND_ST
ORA-02429: cannot drop index used for enforcement of unique/primary key

Cause

When upgrading the Business Process Choreographer database to the current version new indexes need to be created and others to be deleted. In case that the database has been backed up and restored using Oracle export/import, some of the predefined primary key constraints might not have been restored in exactly the same way as they have been defined. Instead of an automatically created index Oracle import takes a user defined index to enforce the primary key constraint. If the upgradeSchema<nn.>sql script tries to delete one of these indexes the ORA-0249 error message is displayed.

Resolving The Problem

After restoring the Oracle database you need to recreate all predefined primary keys that do not use a default index.

First determine primary key columns for tables which do not have a default primary key index with a SQL command like the following:


SQL>select col.table_name, col.position, col.column_name, col.constraint_name, con.index_name from user_cons_columns col, user_constraints con where col.constraint_name like ('SYS_%') and col.constraint_name=con.constraint_name and con.constraint_type='P' and con.index_name not like ('SYS_%') order by col.table_name, col.position;

The result might look like this:

TABLE_NAMEPOSITIONCOLUMN_NAMECONSTRAINT_NAMEINDEX_NAME
...



TASK_INSTANCE_T1TKIIDSYS_C0013920TI_TI_TT_KND_ST
...



The query result shows the primary key columns along with the corresponding table, and the index which is used to enforce the constraint. In the example above the index TI_TI_TT_KND_ST enforces the constraint on table TASK_INSTANCE_T.

Next check existing indexes for a given table, for example for table TASK_INSTANCE_T, with the following SQL command:

SQL> select index_name, column_position, column_name from user_ind_columns where table_name='TASK_INSTANCE_T' order by index_name, column_position;

The result will show all indexed columns for the specified table, e.g.:

INDEX_NAMECOLUMN_POSITIONCOLUMN_NAME
TI_ACOID1APPLICATION_DEFAULTS_ID
TI_CCID1CONTAINMENT_CONTEXT_ID
TI_NAME1NAME
TI_PARENT1PARENT_CONTEXT_ID
TI_SERVICET1SERVICE_TICKET
TI_STATE1STATE
TI_ST_KND_TI_NAME1STATE
TI_ST_KND_TI_NAME2KIND
TI_ST_KND_TI_NAME3TKIID
TI_ST_KND_TI_NAME4NAME
TI_TI_TT_KND_ST1TKIID
TI_TI_TT_KND_ST2TKTID
TI_TI_TT_KND_ST3KIND
TI_TI_TT_KND_ST4STATE
TI_TK_TOPTK1TKTID
TI_TK_TOPTK2TKIID
TI_TK_TOPTK3TOP_TKIID
TI_TOPTKIID1TOP_TKIID
TI_TT_KND1TKTID
TI_TT_KND2KIND
               

You can see that for example the index TI_TI_TT_KND_ST contains four columns in the following order : TKIID - TKTID - KIND - STATE.
Note that there is no index that contains only the column TKIID as that would fit the primary key constraint SYS_C0013920 from above.

Finally, you can modify the primary key constraint by either creating a new index on the primary key column if a dedicated index does not exist, e.g.

SQL> alter table task_instance_t modify primary key using index ( create index ti_pk on task_instance_t (tkiid) );

or by assigning an existing index if the dedicated index exists:

SQL> alter table task_instance_t modify primary key using index ti_tkiid;

The sample queries were run by the owner of the Business Process Choreographer database tables using Oracle SQL*Plus. If you connect as the owner of the Business Process Choreographer database tables, no additional database privileges are required. The results of the queries may be different from the results of the same queries running in another environment.
[{"Product":{"code":"SSQH9M","label":"WebSphere Process Server"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Business Process Choreographer","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"7.0","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

More support for:
WebSphere Process Server

Software version:
7.0

Operating system(s):
AIX, HP-UX, Linux, Solaris, Windows

Document number:
130447

Modified date:
23 June 2018

UID

swg21409202

Manage My Notification Subscriptions