Solved

Find All failed inserts/updates in Oracle Database

Posted on 2011-03-14
8
459 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 31

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.

Join & Write a Comment

Suggested Solutions

This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
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 syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

758 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

18 Experts available now in Live!

Get 1:1 Help Now