Skip to Main Content
  • Questions
  • Updated data is not seen in database

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, Priyanka.

Asked: January 08, 2020 - 9:46 am UTC

Last updated: January 08, 2020 - 11:22 am UTC

Version: Oracle 11g

Viewed 1000+ times

You Asked

I am new to oracle. I have developed an application in java which extracts the records from database, user update few fields and update query is run through java application to make the changes in database. This application is working from past 6 months and no issue was encountered.
Yesterday around 8000 records were processed by various users in this way. In evening, i was able to see the updated records using my application .. But today morning, data of only around 1000 records were shown to be updated.. For remaining records(around 7000), value in specific fields are showing null. Yesterday these fields were having some value in around 7000 records...
Can you please help me how should i start troubleshooting this.. How can i find how these records were modified..

and Chris said...

If the columns had non-null values yesterday and they're null now, SOMETHING updated them back.

If you're really lucky, you may be able to spot when the changes happened using flashback query:

select t.*,
       versions_xid,
       versions_starttime,
       versions_endtime
from   <your table>
  versions between timestamp 
  sysdate - 1 and sysdate t
where  versions_operation = 'U';


But chances are this information has aged out of undo by now. So this will error.

Failing this, look at any auditing you've enabled (either Oracle Database auditing or any custom auditing you've created using triggers or whatever).

Failing this, you may be able to use LogMiner to analyze your redo logs to see when the update back happened

https://docs.oracle.com/en/database/oracle/oracle-database/19/sutil/oracle-logminer-utility.html#GUID-3417B738-374C-4EE3-B15C-3A66E01AE2B5
https://oracle-base.com/articles/8i/logminer

If none of the above help... start checking your code for updates with missing/wrong where clauses & asking your users to see if you can find the culprit

Is this answer out of date? If it is, please let us know via a Comment

More to Explore

SQL

The Oracle documentation contains a complete SQL reference.