View Source

{kb-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:
{code}
"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

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

{kb-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.


!Enable maintenance mode button.png|border=1!

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



!Retain task history.png|border=1!

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.



!Perform System Backup button.png|border=1!

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



!Disable maintenance mode button.png|border=1!

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



!stop backup manager.png|border=1!

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



!remove corrupt database.png|border=1!

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:



!restart backup manager.png|border=1!

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

{kb-related-articles}