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_NAME | POSITION | COLUMN_NAME | CONSTRAINT_NAME | INDEX_NAME |
... | ||||
TASK_INSTANCE_T | 1 | TKIID | SYS_C0013920 | TI_TI_TT_KND_ST |
... |
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_NAME | COLUMN_POSITION | COLUMN_NAME |
TI_ACOID | 1 | APPLICATION_DEFAULTS_ID |
TI_CCID | 1 | CONTAINMENT_CONTEXT_ID |
TI_NAME | 1 | NAME |
TI_PARENT | 1 | PARENT_CONTEXT_ID |
TI_SERVICET | 1 | SERVICE_TICKET |
TI_STATE | 1 | STATE |
TI_ST_KND_TI_NAME | 1 | STATE |
TI_ST_KND_TI_NAME | 2 | KIND |
TI_ST_KND_TI_NAME | 3 | TKIID |
TI_ST_KND_TI_NAME | 4 | NAME |
TI_TI_TT_KND_ST | 1 | TKIID |
TI_TI_TT_KND_ST | 2 | TKTID |
TI_TI_TT_KND_ST | 3 | KIND |
TI_TI_TT_KND_ST | 4 | STATE |
TI_TK_TOPTK | 1 | TKTID |
TI_TK_TOPTK | 2 | TKIID |
TI_TK_TOPTK | 3 | TOP_TKIID |
TI_TOPTKIID | 1 | TOP_TKIID |
TI_TT_KND | 1 | TKTID |
TI_TT_KND | 2 | KIND |
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.
Was this topic helpful?
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