Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

An application INSERTS a parent record then child objects. Both these procedure call different stored procedures. Parent can have many child objects. Typically both parent and child would be inserted in milliseconds.

I am finding the parent record is created ok but the child objects arent. The inserts are not bound by a transaction , they are also done individually - no batch inserting.

This problem manifests itself as a parent with no child rows or a parent with a single child row or a parent with no end row (or i guess missing child in the middle but this would be hard/impossible to identify).

To the end user they see the parent with no end/closing row generally i.e the first CHILD that arrives creates a new PARENT object based on its status.

I am using SQL profiler to examine/alert on deadlocks. There are a few but fall far short of the missing child objects.

I have reduced SQL cpu pressure , was bouncing off 100% , not rarely gets near 100%.

Using SPOTLIGHT i can monitor lock/waits but see nothing unusual , infact look better than normal. LATCHES are relatively low too.

Today our application logs are not showing any timeouts but they have appears in small quantities in the past particular when sql server cpu at 100% or during out of hours maintenance.

"Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."

I monitor disk read/write speed. Not problems.

QUESTIONS

1)In regards to the TIMEOUT which timeout value should be amended on the connection string to potentially counter this error above ?

2)Regards failure to INSERT , can you suggest any processes i should be monitoring to quantify the problem ?

Thank you , I hope the above is clear enough. (SQL 2005 Standard) (Parent table 200m records) (Child table 1bn records)

share|improve this question
    
what kind if code does the inserts? SQL Store Procedures? or C#/VB.Net etc? You should be getting errors from that code if a record cannot be inserted for whatever reason. –  Max Vernon Sep 27 '12 at 15:38
    
Thanks for the reply. VB code , .net 4.0 framework used to create/support WCF service exe. –  scott_lotus Sep 28 '12 at 7:21

1 Answer 1

up vote 2 down vote accepted

Just to extend on Max Vermon's comment...

INSERT failures should be monitored at the data access layer.

An exception is raised by SQL with information regarding the error for failed INSERTs. If you are accessing data through a Stored Procedure (SP) you can handle the error with the SP using the BEGIN TRY...END TRY...BEGIN CATCH...END CATCH exception handling blocks.

You can easily write code to store the exception information into a generic table.

You can use exception handling in other programming environments such as C#, VB.NET etc...

Here is a good example of handling exceptions in T-SQL: http://www.codeproject.com/Articles/38211/Exception-Handling-in-SQL-Server

share|improve this answer
    
Thanks for the reply. VB code , .net 4.0 framework used to create/support WCF service exe. We have a service log and an object log but even getting the coder to examine these has provided no clues. Will examine your BEGIN CATCH suggestion thank you. –  scott_lotus Sep 28 '12 at 7:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.