tags:

views:

412

answers:

2

I've got a lot of similar oracle jobs I need to create, and I'd like to do it programatically.

Where does the Oracle store the job library (schema/table)?

(yes, I know I might be running with scissors)

A: 

Views: USER_JOBS, DBA_JOBS or ALL_JOBS

Joseph Bui
+5  A: 

For DBMS_JOBS you can use...

dbms_job.submit(
JOB       OUT BINARY_INTEGER,
WHAT      IN  VARCHAR2,
NEXT_DATE IN  DATE           DEFAULT SYSDATE,
INTERVAL  IN  VARCHAR2       DEFAULT 'NULL',
NO_PARSE  IN  BOOLEAN        DEFAULT FALSE,
INSTANCE  IN  BINARY_INTEGER DEFAULT 0,
FORCE     IN  BOOLEAN        DEFAULT FALSE);

For the newer DBMS_SCHEDULER jobs you can use...

dbms_scheduler.create_job(
job_name            IN VARCHAR2,
job_type            IN VARCHAR2,
job_action          IN VARCHAR2,
number_of_arguments IN PLS_INTEGER DEFAULT 0,
start_date          IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
repeat_interval     IN VARCHAR2    DEFAULT NULL,
end_date            IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
job_class           IN VARCHAR2    DEFAULT 'DEFAULT_JOB_CLASS',
enabled             IN BOOLEAN     DEFAULT FALSE,
auto_drop           IN BOOLEAN     DEFAULT TRUE,
comments            IN VARCHAR2    DEFAULT NULL);

I haven't found a way to add a Grid Control job using SQL. I may ask that as a separate question if the answer doesn't show up here.

Leigh Riffel