Solved

Find All failed inserts/updates in Oracle Database

Posted on 2011-03-14
8
470 Views
Last Modified: 2012-05-11
Hello all,

I need to find all failed inserts/updates for a certain user in the database.

I was not able to find this infomation using auditing or tracing ( maybe i was doing it wrong).

Thanks for the help..

0
Comment
Question by:Waqasulhaq
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 35130025
What are you thinking here?

An insert that 'failed' never made it into the database.  The error would be returned to the calling program.  It is up to that program to track or audit that error.
0
 

Author Comment

by:Waqasulhaq
ID: 35130079
We are getting an error in the program (IBM Websphere). But we cannot find the exact insert that fails. Is there a way to find track all failed inserts in the oracle database?
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 35130276
To be honest, I'm not sure.  I'm thinking it would depend on the error/failure.  If the SQL parse is failing, I'm not sure.

You might turn on session tracing but on a high throughput database this can be dangerous.

There are a lot of examples of tracing sessions out there:
http://www.dba-oracle.com/plsql/t_plsql_trace.htm

You might also look at turning on client side tracing in the sqlnet.ora and/or tnsnames.ora files (depending on the Oracle client version).
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Waqasulhaq
ID: 35131946
I think Oracle is able to parse the query, it is just not able to insert because of the error.

I have implemented the tracing in the link you provided. Hopefully that will give me something to work with.

thanks for you help
0
 
LVL 11

Accepted Solution

by:
Akenathon earned 500 total points
ID: 35132721
Some options:

- If the error is serious enough (whatever that means to Oracle), you already have the SQL in your alert.log
- Turn on sql_trace for a session (or the whole instance) and run the thing from there. Use DBMS_MONITOR or DBMS_SUPPORT
- If you know the error number returned, set it as an event and the next time you'll get a trace file with the SQL. AUDIT INSERT ON table_name BY ACCESS WHENEVER NOT SUCCESSFUL will give you the error code on the next occurrence
- Use Fine-grained auditing (FGA), it will record the SQL on its trail
- Create a trigger ON SERVERERROR that confesses the errorstack, or does anything you need to get to your piece of code (simplest - look here for an example)
- Change the app so that it doesn't mask errors, optionally when some debug flag is set (best!)
0
 
LVL 15

Expert Comment

by:Devinder Singh Virdi
ID: 35134181
Based on error, we can try few option of failing statement.
ie, In case of dead lock, it will be saved in alert log.
In case of soft lock or blocking locks, ex select ... for update nowait, we can try to get sql.
In case of DDL etc
So what is the error you are getting?
0
 
LVL 32

Expert Comment

by:awking00
ID: 35138882
You may want to consider error logging if you are using 10gR2 or later. See this link -
http://www.orafaq.com/node/76
0
 

Author Closing Comment

by:Waqasulhaq
ID: 35365690
Expert pointed me the right direction.

Thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
This video shows how to recover a database from a user managed backup
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question