Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...'The DELETE statement conflicted with the REFERENCE constraint' error littering our logs'The DELETE statement conflicted with the REFERENCE constraint' error littering our logs
Previous
 
Next
New Post
8/9/2016 3:09 PM
 
We're getting a lot of the following error in the event log for one of our hosts:
   
The DELETE statement conflicted with the REFERENCE constraint "FK_ExceptionEvents_EventLog". The conflict occurred in database "DBNAME", table "dbo.ExceptionEvents", column 'LogEventID'.
The statement has been terminated.

We run a sql job regularly to purge our event logs and other logs to prevent them from getting too large.  We're using Sebastian's script (http://dnnscript.codeplex.com/releases/view/612643) to truncate the event logs and it works great. It allows us to manage log truncation from the database instead of the interface.  

If I run the SQL job to purge all the logs, this error goes away but then it reappears within a matter of hours or days.  It is most prolific on one specific host.  Please advise ... how can this be fixed in such a way where it doesn't return?

 
New Post
8/9/2016 3:49 PM
 
The Event Log was revamped in DNN 7.4 (I think), so a simple delete on the EventLog table doesn't work.

http://www.dnnsoftware.com/community-blog/cid/155180/howto-truncate-your-eventlog-in-dnn-740



Joe Craig
Patapsco Research Group, Ellicott City, MD
DotNetNuke Development and Services (http://patapscorg.com)
 
New Post
8/9/2016 3:55 PM
 
Thanks Joseph. That's correct, that's why we're using Sebastian's script to truncate the logs. It drops the constraints, truncates the table, and then recreates the constraints. We run this script on a schedule in a SQL job on our server. It gets the job done.

This error is a headache though as it is inundating our logs. Also we can't even view our Event log through the interface because the page throws this same error. We can only see the errors logged in there by going directly to the database. I am not a DBA but have been googling this ... would it just be a simple thing of dropping and recreating the constraint again? I can do that but would this prevent the issue from resurfacing the next time the truncate log job runs or is there more that needs to be done to kill the error completely?

 
New Post
8/11/2016 10:08 AM
 
it looks like for some strange reasons either Constraint FK_ExceptionEvents_EventLog is not created properly - my script recreates it with cascading delete (Line 82: "ON DELETE CASCADE"), i.e. once a record in Eventlog is deleted, all associated ExceptionEvents with same EventID will be deleted automatically as well to avoid a violation of referential integrity. are the logevents complaining about FK violation around the same time you are running my script every night?

Cheers from Germany,
Sebastian Leupold (Microsoft MVP)

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
8/15/2016 2:19 PM
 
When you said the cascade delete was on line 82 I went to check and noticed that it was on line 89 in our script. Apparently we were running an old version of your script. We had Version 0.9.8 (2015-03-19) but looks like the latest is Version 0.9.8 (2015-07-25) ... I've just updated it and will keep an eye out for anymore of these errors.

Thank you for creating this script by the way. Its come in so handy. Its nice to be able to schedule it and not worry about our database becoming obese ...
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...'The DELETE statement conflicted with the REFERENCE constraint' error littering our logs'The DELETE statement conflicted with the REFERENCE constraint' error littering our logs


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.

Content Layout

Subscribe to DNN Digest

DNN Digest is our monthly email newsletter. It highlights news and content from around the DNN ecosystem, such as new modules and themes, messages from leadership, blog posts and notable tweets. Keep your finger on the pulse of the ecosystem by subscribing.  


Copyright 2017 by DNN Corp Terms of Use Privacy
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out