This forum is currently locked. You can't register or post questions at this time. (read more)

scheduler job didn't get created even it was executed succes

All posts relating to Oracle database administration.

Moderator: Tim...

baseballGuy
Member
Posts: 30
Joined: Thu Mar 22, 2012 7:08 pm

scheduler job didn't get created even it was executed succes

Postby baseballGuy » Mon Nov 18, 2013 2:20 am

below is my code:

both (program and job) were executed without error but when I check dba_scheduler_jobs, I can't see the job at all, what did I do wrong?

Code: Select all

begin
dbms_scheduler.create_program
(
program_name => 'REFRESH_SCRIPT',
program_type => 'EXECUTABLE',
program_action => '/usr1/oracle/scripts/refresh.sh',
enabled => TRUE,
comments => 'calling shell script');
end;
/


Code: Select all

begin
dbms_scheduler.create_job
(
job_name => 'REFRESH',
program_name => 'REFRESH_SCRIPT',
comments => 'job to start refresh',
enabled => TRUE);
end;
/

Tim...
Site Admin
Posts: 18437
Joined: Mon Nov 01, 2004 5:56 pm
Location: England, UK
Contact:

Re: scheduler job didn't get created even it was executed su

Postby Tim... » Mon Nov 18, 2013 8:50 am

Hi.

You've not included a schedule (inline or as a separate object), so it will run as a one-off job and then be removed. You can see that it executed in the DBA_SCHEDULER_JOB_RUN_DETAILS view.

Code: Select all

sys@db11g> select count(*) from dba_scheduler_job_run_details where job_name = 'REFRESH';

  COUNT(*)
----------
         1

1 row selected.

sys@db11g>


Cheers

Tim...
Tim...
Oracle ACE Director
Oracle ACE of the Year 2006 - Oracle Magazine Editors Choice Awards
OakTable Member
OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
OCP Advanced PL/SQL Developer
Oracle Database: SQL Certified Expert
My website: http://www.oracle-base.com
My blog: http://www.oracle-base.com/blog

baseballGuy
Member
Posts: 30
Joined: Thu Mar 22, 2012 7:08 pm

Re: scheduler job didn't get created even it was executed su

Postby baseballGuy » Mon Nov 18, 2013 3:01 pm

Thanks Tim,


to create the schedule, I looked at your example and I need to clarify one thing:

BEGIN
DBMS_SCHEDULER.create_schedule (
schedule_name => 'test_hourly_schedule',
start_date => SYSTIMESTAMP,
repeat_interval => 'freq=hourly; byminute=0',
end_date => NULL,
comments => 'Repeats hourly, on the hour, for ever.');
END;
/



"repeat_interval": does it mean that the job will repeat hourly? I don't want it to be schedule, basically I just want to create the job and run manually when required.

thx again Tim

Tim...
Site Admin
Posts: 18437
Joined: Mon Nov 01, 2004 5:56 pm
Location: England, UK
Contact:

Re: scheduler job didn't get created even it was executed su

Postby Tim... » Mon Nov 18, 2013 3:50 pm

Hi.

That's not what jobs are. They are either scheduled, or one-off. If you don't want to do that, why not connect to the database and run the procedure?

Cheers

Tim...
Tim...
Oracle ACE Director
Oracle ACE of the Year 2006 - Oracle Magazine Editors Choice Awards
OakTable Member
OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
OCP Advanced PL/SQL Developer
Oracle Database: SQL Certified Expert
My website: http://www.oracle-base.com
My blog: http://www.oracle-base.com/blog

baseballGuy
Member
Posts: 30
Joined: Thu Mar 22, 2012 7:08 pm

Re: scheduler job didn't get created even it was executed su

Postby baseballGuy » Thu Nov 21, 2013 2:37 pm

Hi Tim,

Thanks so much I added the schedule and now job is there; however, I ran into different problem. it said no such directory or file? file is there and permission is set. What caused this issue?

Thanks,

Tim...
Site Admin
Posts: 18437
Joined: Mon Nov 01, 2004 5:56 pm
Location: England, UK
Contact:

Re: scheduler job didn't get created even it was executed su

Postby Tim... » Thu Nov 21, 2013 5:22 pm

Hi.

Does the user associated with the scheduler have the permission to run the script? The default user:group for external jobs not running as SYS is nobody:nobody unless you configure it.

https://support.oracle.com/epmos/faces/ ... d=979186.1

If you are using 11g onward, you should really use explicit credentials.

http://www.oracle-base.com/articles/11g ... redentials

Cheers

Tim...
Tim...
Oracle ACE Director
Oracle ACE of the Year 2006 - Oracle Magazine Editors Choice Awards
OakTable Member
OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
OCP Advanced PL/SQL Developer
Oracle Database: SQL Certified Expert
My website: http://www.oracle-base.com
My blog: http://www.oracle-base.com/blog

baseballGuy
Member
Posts: 30
Joined: Thu Mar 22, 2012 7:08 pm

Re: scheduler job didn't get created even it was executed su

Postby baseballGuy » Mon Nov 25, 2013 2:56 am

Thanks Tim for the doc 979186.1

Below is the program and job

Code: Select all

begin
DBMS_SCHEDULER.create_program (
program_name => 'START_SCRIPT',
program_type => 'EXECUTABLE',
program_action => 'script_path',
number_of_arguments => 0,
enabled => TRUE,
comments => 'COMMENTS ABOUT THE SCRIPT ROLE');
dbms_scheduler.create_job
(job_name => 'START_SERVICE',
program_name=> 'START_SCRIPT',
enabled=>true,
auto_drop=>false,
comments=>'Job used to run the program START_SCRIPT');
end;
/


follow doc,I have changed the following

- rdbms/admin/externaljob.ora file must must be owned by root:oraclegroup and be writable only by the owner i.e. 644 (rw-r--r--) It must contain at least two lines: one specifying the run-user and one specifying the run-group.

- bin/extjob file must be also owned by root:oraclegroup but must be setuid i.e. 4750 (-rwsr-x---)

- bin/extjobo should have normal 755 (rwxr-xr-x) permissions and be owned by oracle:oraclegroup

- bin/jssu exist with root setuid permissions i.e. owned by root:oraclegroup with 4750 (-rwsr-x---)

I still got error ""ORA-27369: job of type EXECUTABLE failed with exit code: No such file or directory"

What am I missing here, thanks Tim

Tim...
Site Admin
Posts: 18437
Joined: Mon Nov 01, 2004 5:56 pm
Location: England, UK
Contact:

Re: scheduler job didn't get created even it was executed su

Postby Tim... » Mon Nov 25, 2013 8:55 am

Hi.

First, are you using 11g? If so you should use credentials, not configure that file!

Cheers

Tim...
Tim...
Oracle ACE Director
Oracle ACE of the Year 2006 - Oracle Magazine Editors Choice Awards
OakTable Member
OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
OCP Advanced PL/SQL Developer
Oracle Database: SQL Certified Expert
My website: http://www.oracle-base.com
My blog: http://www.oracle-base.com/blog

baseballGuy
Member
Posts: 30
Joined: Thu Mar 22, 2012 7:08 pm

Re: scheduler job didn't get created even it was executed su

Postby baseballGuy » Mon Nov 25, 2013 2:20 pm

Hi Tim,

In the shop if they used SSO (single sign on/without using password) and sudo to Oracle, I am affraid that it won't have credentials, have you ran into situation like that?

Thanks,

Tim...
Site Admin
Posts: 18437
Joined: Mon Nov 01, 2004 5:56 pm
Location: England, UK
Contact:

Re: scheduler job didn't get created even it was executed su

Postby Tim... » Mon Nov 25, 2013 5:35 pm

Hi.

You can still have a password on the local user, but block SSH access...

Cheers

Tim...
Tim...
Oracle ACE Director
Oracle ACE of the Year 2006 - Oracle Magazine Editors Choice Awards
OakTable Member
OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
OCP Advanced PL/SQL Developer
Oracle Database: SQL Certified Expert
My website: http://www.oracle-base.com
My blog: http://www.oracle-base.com/blog


Return to “Oracle Database Administration”

Who is online

Users browsing this forum: No registered users and 9 guests