databaseoraclejdbctransactionsoracle-rac

Are transactions commited order guaranteed in Oracle RAC?


I have a lot of small transactions. I perform them in some sequence one by one with XA JDBC driver in Oracle RAC. Is there guarantee they are committed in the same order I call them?

Update: All is happening in a single database session.


Solution

  • Yes, they are.

    In a RAC or non-RAC environment, when you get a successful execution of a commit, it means that the database change has been guaranteed recorded on disk (in the REDO log). When the log writer writes to the redo log, it increments the SCN (System Change Number) which is global across all instances in the RAC. You can see the database's current SCN by querying select current_scn from v$database; if you have sufficient privileges.

    There are some non-default options for commit where it doesn't necessarily wait until the redo log write is complete before it returns a success. If you use them, then possibly multiple transactions can be batched within the same SCN. That would permit a commit on a different instance to grab an SCN prior to one being issued for the batch. Avoid those options, and you'll be fine.