Sign up now to view this solution! It's quick, easy, and secure to subscribe. We will return you to this solution, unlocked, when you’re done.
Does Oracle have any equivalent to MySQL's feature that allows a transaction to acquire a lock on one or more tables until the lock is either explicitly released or the connection associated with it dies?
I know it's a performance-killer if applied blindly to actively-used tables, which is why I planned to use it in conjunction with a semaphore table that would only be used by threads/transactions actually performing a specific maintenance operation to ensure that only one thread/transaction can be doing maintenance on the main table at any instant in time -- allowing other threads that don't bother to look at the semaphore table to get dirty reads in the meantime without delay or interruption (relying on oracle to release the lock and roll back the transaction if something caused the thread with the lock to die or lose its connection).
My problem is that I have a table with a nested table and date field that needs to enforce uniqueness between the nested table + date pair. Oracle can't attach unique constraints to nested tables, so I need to kludge it myself... with an application that's multithreaded AND likely to be running simultaneously on multiple machines (ie, a race condition eagerly waiting to happen). I kind of came up with a gruesome Rube Goldberg-esque way to achieve it by creating a semaphore table and doing an elaborate dance of inserting, committing, sleeping, and reading until it manages to insert the one and only record in the semaphore table before doing the maintenance on the main table and removing the record from the semaphore table... but even that's vulnerable to a thread dying outright before it deletes its record from the semaphore table (adding more second-guessing into the insert-sleep-select dance).
What I'd LIKE to do is have my Connection ask Oracle, "Please let me have exclusive access to the Semaphore table (allowing me to silently wait up to xx seconds for it to become available, then notifying me that I'm out of luck if it's still not available), but roll back everything I'm about to do in this transaction and release my hold if something causes an automatic transaction rollback".
Sign up now to view this solution! It's quick, easy, and secure to subscribe. We will return you to this solution, unlocked, when you’re done.
Many times a DBA may want to replicate a user from one system to another and migrate that same password,such as refreshing a production system ...
Sometimes you need to get data from a server into your database or from your database into a remote server. Learn how to use FTP to ...
Oracle introduced the UTL_SMTP package with the release of 8i back in 1999, but up through the current version (11.2.0.1) available on OTN...
New Carrier-Grade Blade and Rackmount Servers Deliver Better Performance, Density and Power Efficiency for the Communications Industry ...
Oracle is fixing 21 flaws in its Java SE and Java for Business products in its February critical patch update issued this week ...
Why was he there? Who wasn’t invited and why? What did they talk about? Why was he really there? These are the questions being debated ...
"The Oracle gurus provide answers, solutions and valuable workarounds"
User: schwertner
"Wow! Excellent, valuable explanation. Hats off to you"
User: aseshu70
"Solution worked fantastic and performs excellent! Thanks heaps"
User: klausbrandlhuber
slightwv
2,000
0 points yesterday
Profile
Posted on 2004-12-15 at 10:19:22ID: 28331604
All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.