SQL 12
Upd_job_queue_procs.sql By allan on 7th April 2026 10:53:13 AM
  1. -- Define variables to hold the values
  2. VARIABLE old_jqp NUMBER;
  3. VARIABLE new_jqp NUMBER;
  4. VARIABLE sleep_time NUMBER;
  5.  
  6. -- Store the current value in the variable and set sleep_time and new_jqp
  7. BEGIN
  8.   :sleep_time := 5;
  9.   :new_jqp := 0;
  10.   SELECT TO_NUMBER(VALUE) INTO :old_jqp FROM v$parameter WHERE name = 'job_queue_processes';
  11. END;
  12. /
  13.  
  14. prompt CURRENT job_queue_processes VALUE:
  15. PRINT old_jqp
  16.  
  17. prompt Setting job_queue_processes TO:
  18. PRINT new_jqp
  19.  
  20. BEGIN
  21.   -- Set job_queue_processes to 0 using bind variable
  22.   EXECUTE IMMEDIATE 'ALTER SYSTEM SET job_queue_processes='||:new_jqp||' SCOPE=BOTH';
  23.   -- Wait :sleep_time seconds to ensure the change is applied
  24.   DBMS_LOCK.sleep(:sleep_time);
  25.   -- Use the variable to restore the original value using bind variable
  26.   EXECUTE IMMEDIATE 'ALTER SYSTEM SET job_queue_processes='||:old_jqp||' SCOPE=BOTH';
  27. END;
  28. /

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.