Let's say there have a web framework with using ORM approach to handle db transactions (like hibernate)
And my question is there any SQL which can find out all transactions that have already executed/committed in oracle db?
Is it possible? Thanks.
Let's say there have a web framework with using ORM approach to handle db transactions (like hibernate)
And my question is there any SQL which can find out all transactions that have already executed/committed in oracle db?
Is it possible? Thanks.
I don't believe that the Oracle database automatically exposes data about completed transactions. There are various tables that can be queried for in-progress transactions but, once the transaction is complete, the database really doesn't care about it any more.
What you can do is create a trigger that takes effect on a database update. The procedure invoked by the trigger can log to a new database table some outline of the operation that just completed. You can then query that table using ordinary SQL operations. Of course, you will need to purge or trim the log table from time to time.
There is an example of creating an update trigger here:
You can use Redo Logminer to obtain a list of commit and info what was made in transactions.
List of red_log files
SELECT distinct member LOGFILENAME FROM V$LOGFILE where type = 'ONLINE';
Add these files to log_miner. And start log_miner.
declare
begin
for rec in (select distinct member from V$LOGFILE where type = 'ONLINE' ) loop
DBMS_LOGMNR.ADD_LOGFILE(rec.member);
end loop;
DBMS_LOGMNR.START_LOGMNR (options => dbms_logmnr.dict_from_online_catalog);
end;
Now you can start using view v$logmnr_contents
select operation,sql_redo, sql_undo,table_name, x.* from v$logmnr_contents x where username = 'your jdbc user';
At the end. Turn off log miner;
execute DBMS_LOGMNR.END_LOGMNR();