Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Find All failed inserts/updates in Oracle Database

Posted on 2011-03-14
8
Medium Priority
?
497 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 78

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 78

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
Industry Leaders: 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 1500 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

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 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
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

824 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