Error - Referential integrity constraint violation

Symptom


When a customer upgrades to a new version of the Server Backup Manager software from version 5.6, the System Backup task may fail. The following "referential integrity constraint violation" error message may display:

"TASKINSTANCEDATA_TASKINSTANCE_FK: R1DERBYUSER.TASKINSTANCEDATA FOREIGN KEY(TASKINSTANCEIDLEAST, TASKINSTANCEIDMOST)  REFERENCES R1DERBYUSER.TASKINSTANCE(TASKINSTANCEIDLEAST, TASKINSTANCEIDMOST) (-8001333452611837966, 4201996588197431490)" SQL statement: INSERT INTO R1DERBYUSER.TASKINSTANCEDATA (MAPKEY,DATA,TASKINSTANCEIDLEAST,TASKINSTANCEIDMOST) VALUES (?,?,?,?) [23506-17

Fortunately, there are steps that can be taken to easily resolve this issue. 

Resolution


1. Run the server in Maintenance Mode. Access the Configuration screen, click Manager Options in the Configuration menu, and click the Enable maintenance mode button.

By running the server in Maintenance Mode, this ensures that nothing will be written to the internal database when the following steps are taken.



2. Set the Task History retention for one day by entering 1 in the Retain Task History for field.

3. Click the Clean Task History button to run the Task History Cleanup. This will clean any bad task history data contributing to the error message you are receiving.

4. Perform a system backup to create a backup of the current database with the truncated task history information. Click the Perform System Backup button in the Management section.

5. Disable maintenance mode by clicking the Disable maintenance mode button.

6. The next steps must be performed from the command line of the Backup Manager server. First, stop the Backup Manager from running. 

7. While in the command prompt, perform the following commands: 

This removes the corrupt database and restores it using the clean backup created earlier. Please note the directory from which the command is performed (/usr/sbin/r1soft/data).

8. Restart the Backup Manager service using the following command:

This process should resolve the error. If you continue to have issues, please contact Support.