-- analyze every object in your entire schema!
-- Gather stats at a given time each day!


declare
jobno number;
 -- variable instno number; 


begin 

dbms_job.submit(jobno, 'dbms_stats.gather_schema_stats(''EDWARD'');',
trunc(sysdate+(1/24/12),'MI'), 'trunc(SYSDATE+(1/24),''MI'')'      );
 -- do this in 5 minutes, then once a day
commit;  -- is this commit necessary? I doubt it, but Oracle does it.
end;
/ 

prompt The job is the number assigned to this task. It can be found in the 
user_jobs view.
prompt  the job:
print jobno
prompt
prompt
prompt  Job queue process
prompt  ~~~~~~~~~~~~~~~~~
prompt Make sure that the parameter job_queue_processes is set to a number 
greater than 0.
show parameter job_queue_processes
prompt
prompt
prompt  Next scheduled run
prompt  ~~~~~~~~~~~~~~~~~~
prompt  The next scheduled run for this job is:
select job, next_date, next_sec from user_jobs where job = :jobno;