SCRM_CONFIG.HardDelete task failed RRS feed

  • Question

  • I got this error recently on the MS CRM database 

    MSCRM_CONFIG.HardDelete task failed:

    JOB RUN: 'MSCRM_CONFIG.HardDelete' was run on 8/04/2011 at 11:00:00 AM
    DURATION: 0 hours, 0 minutes, 2 seconds
    STATUS: Failed

    MESSAGES: The job failed. The Job was invoked by Schedule 9 (Schedule). The last step to run was step 1 (Step).


    Can I know what is the purpose of the stored proc and how to rectify the reason for the failure . Is this failing result in any threat for the system ?




    Monday, April 11, 2011 12:35 AM


All replies

  • I would try to restart the SQL Server and the CRM app server, also make sure that SQL Agent is running properly after the reboot. This stored procedure is part of a cleanup routine run against the CRM config database.  Your biggest threat is that over time if the cleanup routine continues to fail you could run into performance issues in CRM.



    Jamie Miley
    Linked-In Profile
    Follow Me on Twitter!
    Monday, April 11, 2011 1:32 AM
  • I've had same problem yesterday after my admin changed login name and associated last name in AD. That login was used in CRM so I've updated it in there using CRM webapp. After update I've got same error. The step error message was "The DELETE statement conflicted with the REFERENCE constraint "FK__SystemUse__UserI__3FD07829". The conflict occurred in database "MSCRM_CONFIG", table "dbo.SystemUserAuthentication", column 'UserId'". The reason was that stored procedure 'p_HardDelete' that was invoked by job contains following code fragment:


    DELETE FROM SystemUser WHERE IsDeleted = 1
    DELETE FROM SystemUserAuthenticationProperties WHERE Id IN (SELECT Id FROM SystemUserAuthentication WHERE IsDeleted = 1)
    DELETE FROM SystemUserAuthentication WHERE IsDeleted = 1

    The problem is in order of sql statements. We can see SystemUserAuthentication is cleared after SystemUser table but SystemUserAuthenticationcontains foreign key referenced to SystemUser. Good thing was that procedure was not in any transaction so first run of that procedure throw error but also deleted rows in SystemUserAuthenticationcontainstable and in next run of 'p_HardDelete' it deleted rows in SystemUser and didn't throw any error so I hope that everything is back to normal.



    everything is a matter of probability...
    Thursday, September 15, 2011 7:29 AM