Solved

Find All failed inserts/updates in Oracle Database

Posted on 2011-03-14
8
463 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
8 Comments
 
LVL 76

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 76

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
 

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Oracle Finace 3 67
SQL Query 34 82
oracle 11g 23 51
'G_F01' is not a procedure or is undefined 3 13
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…
Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines

863 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

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now