Quantcast
Channel: Gokhan Atil’s Technology Blog
Viewing all articles
Browse latest Browse all 163

OMS Upgrade Fails At Repository Configuration With Error ORA-20251

$
0
0

Yesterday, one of my blog readers asked me how I didn’t encounter ORA-20251 error when upgrading my EM12c to EM13c. He also pointed My Oracle Support document (Doc ID 2095025.1). The document says a new record will be inserted into EM_COST_CENTERS table (in fact the table name is EM_COST_CENTERS_E but it’s not relevant) for all users whose department value is not blank during the upgrade. If there are more than one records with blank cost center then the second record will be considered as duplicate, resulting in the above error during the repository configuration.

Here’s the sample output:

INFO: oracle.sysman.top.oms:Failure…
INFO: oracle.sysman.top.oms:1 error(s) happened in performing the action:
INFO: oracle.sysman.top.oms:1):
ORA-20251: Cost Center already Exists : :
ORA-06512: at “SYSMAN.EM_COST_CENTER”, line 147
ORA-06512: at “SYSMAN.EM_COST_CENTER”, line 209
ORA-06512: at “SYSMAN.EM_COST_CENTER”, line 266
ORA-06512: at “SYSMAN.EM_COST_CENTER”, line 436
ORA-06512: at line 64
File:…/cost_center/cost_center_data_upgrade.sql

I asked my reader to examine the EM users and he said there are not any EM users whose department value is not blank. So today, I examined the upgrade script and see that it’s not just about the department value. The upgrade scrip also tries to insert new “cost center” records for the users whose Line of business value is not blank.

Here’s the list of my EM users:

emcli list -resource="Administrators" \
 -columns="USER_NAME,DEPARTMENT,LINE_OF_BUSINESS,COST_CENTER"
USER_NAME             DEPARTMENT            LINE_OF_BUSINESS      COST_CENTER
SYSMAN
GOKHAN                                                            COSTCENTER1
CLOUD_SWLIB_USER
VEYSEL                DENEME1               DENEME2
NURFIDAN                                                          COSTCENTER2
SUPPORT
Rows:6

As you can see, there’s only one user whose department and line of business values are not blank. The upgrade script (cost_center_data_upgrade.sql) will create a new cost center for the department of this user, and there won’t be any error. On the other hand, if there were another user whose cost center value is blank but department or line of business value is not blank, the script would try to create another cost center and it would cause a duplicate record violating unique constraint (COST_CENTER_NAME, TENANT_ID) on EM_COST_CENTERS_E table.

So before you upgrade the EM13c, you better check your users with the following command (I break the line so it can fit to the page, you can write it as one-line):

emcli list -resource="Administrators" \
-columns="USER_NAME,DEPARTMENT,LINE_OF_BUSINESS,COST_CENTER"

If there are multiple users with department or line of business value but not assigned to a cost center, you will hit the bug. Unfortunately, the My Oracle Support document doesn’t provide clear instructions to fix the problem. I recommend you to contact support and ask them to update the document (Doc ID 2095025.1). Meanwhile, if you feel adventurous, you may use a script similar to the below one, to set department value (or line of business value) to cost center value:

login()

em_users = list( resource="Administrators",
columns="USER_NAME,DEPARTMENT,LINE_OF_BUSINESS,COST_CENTER",
search="COST_CENTER IS NULL")

for em_user in em_users.out()['data']:
  if em_user['DEPARTMENT'] is not None:
    modify_user( name=em_user['USER_NAME'], cost_center=em_user['DEPARTMENT'] )
  elif em_user['LINE_OF_BUSINESS'] is not None:
    modify_user( name=em_user['USER_NAME'], cost_center=em_user['LINE_OF_BUSINESS'] )

Before executing the script:

emcli list -resource="Administrators" \
-columns="USER_NAME,DEPARTMENT,LINE_OF_BUSINESS,COST_CENTER"
USER_NAME             DEPARTMENT            LINE_OF_BUSINESS      COST_CENTER
SYSMAN
GOKHAN                DENEME1
CLOUD_SWLIB_USER
VEYSEL                                      DENEME2
NURFIDAN              DENEME3
SUPPORT
Rows:6

After the executing the script:

emcli list -resource="Administrators" \
-columns="USER_NAME,DEPARTMENT,LINE_OF_BUSINESS,COST_CENTER"
USER_NAME             DEPARTMENT            LINE_OF_BUSINESS      COST_CENTER
SYSMAN
GOKHAN                DENEME1                                     DENEME1
CLOUD_SWLIB_USER
VEYSEL                                      DENEME2               DENEME2
NURFIDAN              DENEME3                                     DENEME3
SUPPORT
Rows:6

After assigning cost centers to the users, the upgrade script will work without getting any error.


Viewing all articles
Browse latest Browse all 163

Trending Articles