OS command from Oracle database

I can’t get an OS script to execute on the server machine from Oracle 11.2 dbms_scheduler (which I should be able to do).  Thanks!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

HDatabase AdministratorCommented:
When the job type is executable, the job action is supposed to point to an executable without any arguments. So what is happening here is that the scheduler is looking for the file called "/NAS/ESG/apps/as/.bin/remove_as.sh' and not finding it.

Instead you should set the job action to just "/usr/bin/ksh", set number_of_arguments to 1, enabled to FALSE, then call set_job_argument_value with "/NAS/ESG/apps/as/.bin/remove_as.sh'" then enable the job.
wscott30Author Commented:
I figured out the problem.

As a database user my program "remove_as.sh" has to exist
on the database server, not on the app server.

Directory /NAS/ESG/apps/as/.bin exists on <app server>
but not <database server>,  therefore dbms_scheduler did not find it.  See below.

$ cd /NAS/ESG/apps/as/.bin
-ksh: cd: /NAS/ESG/apps/as/.bin: [No such file or directory]
This is the error that I was getting.

The directory /NAS/db_output/pars/erds/as, where the files are
that I wanted to delete is mounted on both <database server> and <app server>,  so that is not the problem.

My successful runs until now have been from <app server>

I put the executable "remove_as.sh" in directory /NAS/db_output/pars/erds on the database server (same place where the files to be deleted are) and it worked fine.

Thanks anyway.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HDatabase AdministratorCommented:
Cool, glad you figured it out.  Thanks
wscott30Author Commented:
I figured it out after discussing with our DBAs. This problem can occur when using NAS mounts to different servers and you try to invoke code that is not mounted to the database server. The code must reside on the database server or DBMS_SCHEDULER cannot find it.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.