Skip to main content

MarkView Database - Unique constraint (MARKVIEW.MV_SES_MARKVIEW_SESSION_PK) violated

Article # 304103 - Page views: 118



Applies To

  • ERP System: All ERP Systems
  • MarkView Version: All MarkView Versions


  • When trying to log into the MarkView Viewer, the OC4J reports the following error.

    Throw it to client: markview.except.DatabaseErrorException: ORA-00001: unique constraint (MARKVIEW.MV_SES_MARKVIEW_SESSION_PK) violated
    ORA-06512: at "MARKVIEW.MV_VIEWER", line 1217
    ORA-06512: at line 1

Known Causes

  • This error typically occurs following a MarkView database migration.

    In the MarkView schema, the table MV_SESSION_LOG tracks every MarkView session. The MARKVIEW_SESSION_ID column is populated by the database sequence MV_MARKVIEW_SESSION_ID_SEQ. If the sequence value is lower than the highest MV_SESSION_LOG.MARKVIEW_SESSION_ID, then this error will occur.


  • Determine the highest value of MV_SESSION_LOG.MARKVIEW_SESSION_ID
    SQL> select max(markview_session_id) from mv_session_log;
  • Determine the value of MV_MARKVIEW_SESSION_ID_SEQ
    SQL> select last_number from user_sequences where sequence_name = 'MV_MARKVIEW_SESSION_ID_SEQ';
  • Ensure that the sequence value is set to be higher than the highest existing session ID by incrementing it as in this example:
    • SQL> alter sequence MV_MARKVIEW_SESSION_ID_SEQ increment by 100;
    • SQL> select MV_MARKVIEW_SESSION_ID_SEQ.nextval from dual;
    • SQL> alter sequence MV_MARKVIEW_SESSION_ID_SEQ increment by 1;

Keywords: db