locked
SCRM_CONFIG.HardDelete task failed RRS feed

  • Question

  • I got this error recently on the MS CRM database 

    MSCRM_CONFIG.HardDelete task failed:

    Message:
    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 ?

     

    Thanks

     

    Monday, April 11, 2011 12:35 AM

Answers

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.

     

    http://vidmar.net/weblog/archive/2010/04/01/mscrm_config.harddelete-and-mscrm_config.sitewidecleanup-sql-jobs-and-microsoft-dynamics-crm-4.0.aspx


    Jamie Miley
    http://mileyja.blogspot.com
    Linked-In Profile
    Follow Me on Twitter!
    Monday, April 11, 2011 1:32 AM
    Moderator
  • 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