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
Solved

Find All failed inserts/updates in Oracle Database

Posted on 2011-03-14
8
469 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
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.

 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

809 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