Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Stuck with filewatcher

Nag AswadhatiOct 1 2013 — edited Oct 2 2013

Hi Experts,

I have created a job which has to run on a file arrival. But the job is not giving any response.

I am able to run the same job manually by using run_job procedure.

Please help me to fix this. Do I miss any steps to follow, suggest me.

version details

----------------------------------------------------------

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

PL/SQL Release 11.2.0.3.0 - Production

"CORE 11.2.0.3.0 Production"

TNS for Linux: Version 11.2.0.3.0 - Production

NLSRTL Version 11.2.0.3.0 - Production

-------------------------------------------------------------------------------------------

code

------------------------------------------------------------------------

BEGIN

    SYS.DBMS_SCHEDULER.CREATE_JOB (

            job_name => '"UPN_COMMON"."WATCHJOB"',

            job_type => 'STORED_PROCEDURE',

            job_action => '"UPN_COMMON"."INS_EMP"',

            number_of_arguments => 0,

            start_date => SYSTIMESTAMP,

            event_condition => '(1=1)',

            queue_spec => '"UPN_COMMON"."FILE_WATCHER"',

            end_date => SYSTIMESTAMP+0.1,

            job_class => '"SYS"."DEFAULT_JOB_CLASS"',

            enabled => FALSE,

            auto_drop => FALSE,

            comments => 'TESTING A PROCEDURE',

            credential_name => NULL,

            destination_name => NULL);

    SYS.DBMS_SCHEDULER.SET_ATTRIBUTE(

             name => '"UPN_COMMON"."WATCHJOB"',

             attribute => 'logging_level', value => DBMS_SCHEDULER.LOGGING_OFF);

    

    SYS.DBMS_SCHEDULER.SET_ATTRIBUTE(

             name => '"UPN_COMMON"."WATCHJOB"',

             attribute => 'max_run_duration', value => INTERVAL '1' MINUTE);

    SYS.DBMS_SCHEDULER.SET_ATTRIBUTE(

             name => '"UPN_COMMON"."WATCHJOB"',

             attribute => 'schedule_limit', value => INTERVAL '1' MINUTE);  

    SYS.DBMS_SCHEDULER.enable(

             name => '"UPN_COMMON"."WATCHJOB"');

END;

/

declare

  filtyp utl_file.file_type;

begin

  filtyp := utl_file.fopen('UPNCOMMON_DIR', 'file.txt', 'W', NULL);

  utl_file.put_line(filtyp, 'File has arrived '||SYSTIMESTAMP, TRUE);

  utl_file.fclose(filtyp);

end;

/

exec dbms_scheduler.run_job('WATCHJOB');

----------------------------------------------------------------------------------------------------

It would be great appreciation if you give me an example with solution.

Thanks all.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 30 2013
Added on Oct 1 2013
1 comment
1,649 views