Wednesday, November 28, 2012

(PL/SQL) oracle database scheduler jobs - geekzspot


Copy this code and paste it in your HTML

  1. database scheduler jobs

  2. -- Show the times a job ran.

  3. WHERE job_name = :JOB_NAME
  4. ;

  5. -- Show job intervals (time difference between rows)

  6. FROM all_scheduler_job_log
  7. WHERE job_name = :JOB_NAME
  8. ;

  9. ?

  10. ;

  11. ?

  12. ?

  13. ;

  14. ?

  15. ?

  16. -- Job Logs:

  17. -- select * from user_scheduler_jobs;

  18. -- select * from user_scheduler_job_run_details;

  19. ?

  20. l_job_name VARCHAR2(255) := 'metrics_log_job';
  21. dbms_scheduler.stop_job( job_name => l_job_name ); -- This handles ORA-27478: job ".." is running.

  22. dbms_scheduler.drop_job( job_name => l_job_name );

  23. ?

  24. dbms_scheduler.create_job

  25. ( job_name => l_job_name

  26. , job_type => 'PLSQL_BLOCK'

  27. , job_action => 'PROCEDURE_Name;' -- Don't forget the semicolon! Or you'll get ORA-06550: line 1, column 776: PLS-00103: Encountered the symbol "" when expecting one of the following: := . ( @ % ; The symbol ";" was substituted for "" to continue.

  28. , repeat_interval => 'freq=hourly;'

  29. , comments => ''

  30. ); -- ORA-27486: insufficient privileges requires grant create job to <user>

  31. /

  32. ?

  33. ?

  34. /*

  35. -- SMTP setup

  36. ?

  37. CONNECT / AS SYSDBA

  38. ?

  39. begin

  40. ? DBMS_SCHEDULER.set_scheduler_attribute('email_server', 'smtp.mail.server:25');

  41. end;

  42. /

  43. */

  44. ?

  45. ?

  46. dbms_scheduler.add_job_email_notification

  47. ( job_name => 'metrics_log_job'

  48. , events => 'job_failed'

  49. );

  50. /

  51. INSERT INTO release_log (name, description) VALUES ('metrics', 'weekly metrics log');

Source: http://snipplr.com/view/68798/oracle-database-scheduler-jobs/

2012 nfl mock draft iowa caucus lemonade diet steve jobs action figure chris jericho rose bowl johnny weir

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.