0
We have a process that currently uses the Oracle DBMS_SCHEDULER to execute. The process runs every time the backend receives data from an external device. The Oracle scheduler is set up such that a job is created on reception of external data, the job executes immediately, and the job is destroyed automatically when complete.
The issue here is that multiple devices could be sending up data at the same time. Because the process involves obtaining exclusive locks at different points throughout execution, occasionally one job will step on another that is already executing (it gets rejected with ORA-20000).
I would like to somehow use the Oracle AQ (advanced queueing) mechansim in order to solve this issue. I envision a queue of jobs that are executed FIFO. Even if external device B sends up data while the process is currently processing data from external device A, the queue prevents processing of data from device B until processing for device A is complete.
There doesn't seem to be a specific section on this type of AQ processing in the Oracle documentation, but it seems like it would be a pretty common scenario. Has anyone else solved this type of issue with Oracle AQ?
Can you provide an example (pseudo-code or similar) of how this might work with the never-ending scheduled job that you mention? e.g. how would the AQ mechanism be set up, and how would you prevent more than one process from running concurrently? Would that be a limitation defined in the job, or in the AQ mechansim? – mlehmeher – 2015-06-17T19:33:07.370