DBMS_SCHEDULER.CREATE_JOB executing a shell script
Hi ,
Shell script :- TEST.ksh
#!/bin/ksh
dhxmlfile=`date +"%Y-%j-%R"`
dhoriginfile= /A/XMLFirstTest.xml
dhdestinationfile=/A/B
cp $dhoriginfile $dhdestinationfile/$dhxmlfile
rm $dhoriginfile
BEGIN
DBMS_SCHEDULER.CREATE_JOB
(job_name=>'TEST.ksh',
job_type=>'EXECUTABLE',
JOB_ACTION=>'/A/TEST.ksh',
Start_date=> SYSDATE,
job_class=> 'DEFAULT_JOB_CLASS',
Enabled=> TRUE,
auto_drop=> TRUE,
Comments=> 'Run shell-script Test.ksh');
Exception
WHEN others then
DBMS_OUTPUT.PUT_LINE
(SQLCODE||SQLERRM);
end;
Getting an error :-
ORA-27369: job of type EXECUTABLE failed with exit code: 274662
STANDARD_ERROR="Oracle Scheduler error: Config file is not owned by root or is writable by group or other or extjob is not setuid and owned by root"
Can anyone help me with this
Can anyone help me with this
No - not in this forum. This forum, as the title says, is for Sql developer questions.
Please mark the question ANSWERED and repost it in the SQL and PL/SQL forum
https://community.oracle.com/community/developer/english/oracle_database/sql_and_pl_sql
Similar Messages
-
Privilege problem on DBMS_SCHEDULER execute linux shell script
Hello, everybody,
I'm a beginner on oracle development , recently , I use DBMS_SCHEDULER to execute linux shell script so that I can transmit files to another ftp server . The problem is , I can't use ordinary user to execute this shell ,but must use sys user , or the procedure will show error : Permission Denied;
I can't change the files' privillege that need to transmit.
I had tried these method,but no use:
1. grant all privillege to user;
2. change the privillege of shell and it's direcotry;
3. use full path in shell;
I hope someone could help me solve this problem , thank you!
the error code :
STANDARD_ERROR="ftp: local: test20121221173852: Permission denied
ftp: local: test20121221173953: Permission denied
ftp: local: test20121221174052: Permission denied
ftp: local: test20121221174153: Permission denied"My /tmp/test.ksh trying to find database status.
. ~oracle/.profile > /dev/null
db_status=`eval sqlplus -s 'system/passwd@DEV' << EOF
set pagesize 0 feedback off verify off heading off echo off
select status from v\\$instance;
exit
EOF`
echo $db_status > /tmp/db_status_out -
Executing a shell script with DBMS_SCHEDULER
Hi,
when I execute a shell script with DBMS_SCHEDULER this doesn't works correctly
BEGIN
DBMS_SCHEDULER.create_job
job_name => 'job_AR',
job_type => 'EXECUTABLE',
job_action => '/home/crm/crmdw/AR/start_execution.sh',
enabled => TRUE,
start_date => systimestamp,
repeat_interval => 'FREQ=MINUTELY;INTERVAL=15',
comments => 'Test Job AR'
END;Inside the shell script there is a code who call a Hierarchy of process,
if I executed it manually or with a cron, it works perfectly
but when I execute it with the job that I've described before it's executes
all process at same time and it doesn't work.
What can I do to fix the issue,
any Ideas?
Thanks in advanced...#!/usr/bin/ksh
#test_dbms_scheduler.ksh
echo $1
echo "I am in Unix"
exit 0
chmod 755 test_dbms_scheduler.ksh
Create or replace procedure test_dbms_scheduler
as
v_text varchar2(255) := 'Parameter passed from Oracle to Unix';
Begin
dbms_output.put_line("I am in Procedure");
dbms_scheduler.create_job
(job_name=>'test_dbms_scheduler',
job_action=>'/usr/bin/test_dbms_scheduler.ksh',
number_of_arguments=>1,
job_type=>'executable',
start_date => SYSDATE,
repeat_interval => 'FREQ=SECONDLY; INTERVAL=1',
enabled=>false,
auto_drop => TRUE,
comments=> 'Run shell-script test_dbms_scheduler.ksh');
dbms_scheduler.set_job_argument_value(job_name =>'test_dbms_scheduler', argument_position => 1, argument_value => v_text);
dbms_scheduler.enable('test_dbms_scheduler');
dbms_output.put_line("I am back in Procedure");
Exception
when others then
dbms_output.put_line(sqlcode||sqlerrm);
end;
set serveroutput on
exec test_dbms_scheduler; -
Executing Unix shell scripts with DBMS_SCHEDULER
I have the following Unix shell script create_backup_file.sh:
#!/usr/bin/ksh
/usr/bin/ssh [email protected] /usr/bin/touch/app_home/home/trotestbat/scripts/TRO_batch_complete_`date +%d-%m-%Y-%H%M`
If I execute this from the command prompt it creates the file on the remote server.
I've used dbms_scheduler to try and execute this from Oracle:
BEGIN
SYS.DBMS_SCHEDULER.CREATE_PROGRAM
program_name => 'CREATE_TRO_BACKUP_FILE'
,program_type => 'EXECUTABLE'
,program_action => '/APP/TORPEDO/DTE/SCRIPTS/create_backup_file_tro.sh'
,number_of_arguments => 0
,enabled => TRUE
,comments => NULL
SYS.DBMS_SCHEDULER.CREATE_JOB
job_name => 'DTE.TESTAGAIN'
,start_date => TO_TIMESTAMP_TZ('2010/05/17 16:09:24.710789 +01:00','yyyy/mm/dd
hh24:mi:ss.ff tzh:tzm')
,repeat_interval => NULL
,end_date => NULL
,program_name => 'DTE.CREATE_TRO_BACKUP_FILE'
,comments => NULL
END;
The problem I have is that scheduler executes the shell script and creates the file but it never completes the job. The status of the job is permanently 'RUNNING'. Why is the scheduler not returning a completed status?the "infinite" script is usually caused by a prompt (script pauses for a user input).
Please keep in mind that executing script via scheduler is not the same as manually via prompt.
1. the script runs as ORACLE user ID (or whatever you specified using DBMS_SCHEDULER.create_credential or/and "$ORACLE_HOME/rdbms/admin/externaljob.ora")
2. the environment variables are probably not the same.
My wild guess is that you never ran SSH using "oracle" UID and thus it prompts for permission to add the remote computer’s fingerprint to the user’s ~/.ssh/known_hosts file - since it is a script, it just hangs and waits for input.
Did you try to login to unix box as oracle uid and run the script manually? -
Executing a shell script from a java program
Hi,
I'm facing a problem while executing a shell script from a jsp page.
I'm using exec() function.
It's working fine for single statement scripts.But if the script consists of any database processing and some other processing statements,it's not returning the correct exit status of the process.
Will u please help me in this.
If there is any other ways to execute a shell script from a jsp page other than Runtime.exec().If so let me know.
Thanks in advance.I think this shud workMaybe - but it is wrong! Why do you create aReader
and then read bytes which are turned into a String
without worrying about whether or not the bytes area
String and without worrying about the character
encoding if the bytes do represent characters and
without worrying about how many bytes wereactually
read.
Also, both you and the OP should read, digest and
follow the advice given in
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-
traps.htmlI dont care if it is wrong. This code works for me.
We are here to solve problems not to find which post
is wrong.It is wrong! You are posting bad advice that is very wrong! It may work for you but it is wrong in general! WRONG WRONG WRONG.
If you have a solution then post it I did post a solution! The reference I gave will explain to you and the OP exactly how it should be done.
rather then
posting rude comments.I was not rude! I was explaining just some of what was wrong! -
Executing a shell script from a jsp page
Hi,
I'm facing a problem while executing a shell script from a jsp page.
I'm using Runtime.exec() function.
It's working fine for single statement scripts.But if the script consists of any database processing and some other processing statements,it's not returning the correct exit status of the process.
Will u please help me in this.
If there is any other ways to execute a shell script from a jsp page other than Runtime.exec() like RMI etc,.If so let me know.
Thanks in advance.Hello,
It's hard to help you but what you can do is listening to the outputs of your script, you should read the output stream and error stream and send them to the default console.
Check this excellent article : http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=4
Best regards,
Olivier. -
Error while executing unix shell script from java program
Hi All,
I am trying to execute unix shell script from a java program using Runtime.execute() method by passing script name and additional arguments.
Code snippet :
Java Class :
try{
String fileName ="test.ksh";
String argValue ="satish"; // value passed to the script
String exeParam = "/usr/bin/ksh "+fileName+" "+argValue;
Process proc = Runtime.getRuntime().exec(exeParam);
int exitValue = proc.waitFor();
sop("Exit Value is : "+exitValue);
catch(Exception e)
e.printStackTrace();
}Test.ksh
export -- application realated paths..
nohup abc.exe 1> test.log 2>&1;
$1
exit.By running the above java class , i am getting exit Value: 139 and log file test.log of 0 bytes.
when i am running the same command (/usr/bin/ksh test.ksh satish) manually, it's calling abc.exe file successfully
and able generate the logs properly.
Pls let us know where exactly i am stuck..
Thanks in advance,
Regards,
SatishHi Sabre,
As per the guidelines provided by the article, i had done below changes..
InputStream is = null;
InputStreamReader iStreamReader = null;
BufferedReader bReader = null;
String line = null;
try{
String fileName ="test.ksh";
String argValue ="satish"; // value passed to the script
String exeParam = "/usr/bin/ksh "+fileName+" "+argValue;
Process proc = Runtime.getRuntime().exec(exeParam);
is = proc.getErrorStream();
iStreamReader = new InputStreamReader(is);
bReader = new BufferedReader(iStreamReader);
System.out.println("<ERROR>");
while((line = bReader.readLine()) != null)
System.out.println("Error is : "+line);
System.out.println("</ERROR>");
int exitValue = proc.waitFor();
sop("Exit Value is : "+exitValue);
catch(Exception e)
e.printStackTrace();
Now , it's showing something like..
<ERROR>
</ERROR> -
How to execute unix shell script from Java ...
Hi,
Anyone know how to execute unix shell script from Java?
Suppose I have several shell scripts written in perl or tcl or bash.
I just want to catch the output of that script.
Is there any ready to use module/object for this?
Please let me know, this is quite urgent for my study assigment.
Thanks in advance,
Regards,
meLook up Runtime.exec()
-
How to execute unix shell script in webdynpro?
hi all,
We have some iquirement of executing script in unix.If anyone know How to execute unix shell script in webdynpro?
best regard
reefishRee,
1. Find SSH client for windows, then execute SSH with Runtime.exec() on local host with arguments like remote host, auth, command to execute etc.
2. Get SSH client in Java and execute SSH commands on remote host using pure Java API.
Don't ask me for links, Google works today, I checked this
Valery Silaev
SaM Solutions
http://www.sam-solutions.net -
How to execute a shell script?
Hi,
could someone please tell me the correct way to execute a shell script? For example run.sh located in my resources?
Thanx in advance!Odds are good that Apple doesn't want you running shell scripts on an iPhone, but somebody else might have information to the contrary.
-
Terminal is trying to auto-execute a shell script
I can no longer use Terminal because every time I try to start it, it automatically runs a shell script I used to have on my desktop and then immediately says "[Process Completed]." I'm not sure how exactly I got it to do this... as far as I know all I did was execute the shell script by associating it with Terminal and double clicking it... but now I can't create a new shell without it automatically attempting to execute it. Please help!
Thanks,
Michaelnevermind... found this http://www.starglider.net/MacOS_X/Terminal-ExecutionString.html
Apparently I'm not the only one who's made this incredibly aggravating mistake -
CSS 11500 - Keepalive script to remotely execute a shell script on a server
Hi!
I've been trying to connect the dots but so far I've got nothing close to what I need - based on Cisco's documentation.
I was wondering if it was possible for the CSS switch to connect to a server in order to execute a shell script such as "/opt/whatever/script.sh", which would return a specific value like "OK". Anything different than OK would mean a dead service, and the affected service would be taken out of business (no load balancing play).
Could someone confirm whether it can be done?
Many thanks!!
LeoLeo,
you could try to use CSS script to telnet to the server, and execute the command.
But that would be ugly.
What you should do, is put your script inside a cgi webpage and let the CSS call the webpage.
Your webserver will then run the script that you want and return to result inside and HTML page to the CSS which can then decide on the status of the server.
If you do not have a web server, you should create a small tcp server to listen to CSS request and again send the result of the script back to css.
Gilles. -
How we can call or execute a SHELL script through Oracle forms or Reports
How we can call or execute a SHELL script through Oracle forms or Reports.Its urgent.......
Use HOST command.
-
Executing a shell script from a form (client / server)
From a form in a client server environment, I would like to execute a shell script on the server.
Environment:
Server: SunOS 5.6
DB : 8.0.5
Forms : Developer 6 w/patch 6A
Forms - 6.0.5.34.0Jim,
Yes. Use the host command from forms and call the command rexec.
Raymond
null -
Execute process (shell script) under different user
Hi,
is it possible to use the ProcessBuilder oder .exec()-method to execute a shell script under a JVM-different user? I need to start shell scripts for different system users and I don't want to use SUDO or a wrapper script to switch to the required user. I would like to define the user at java level. Is this possible?
Best regards,
Thomaslooking for something like this too.
currently i am relying on a script in which i have to set the user as:
"su username -c java_program"
the problem with this approach is that if youre not running as root, then su asks for a password, thereby halting execution. (tried input redirects and here-docs, (some popular linux tricks), they did not work)
so you have to be root for the script option to work.
if anyone can suggest a more "java based" way of executing a process as a different user , thatll be awesome.
Maybe you are looking for
-
I have used SSRS a lot years ago with Sql Server 2000 and Sql Server 2005. I have written external assemblies, ... But now I have to do this with Sql Server 2008 (R2 -- which I realize I am way behind the times already but ...) in sql server 2000 an
-
Why is the Finder so BAD in copying files....
Hi, I regularly manage a fairly large network... With 5 users and a total of 25 hard drives... This is proving to be a real pain in the neck. OS X - the self proclaimed "Most Advanced Operative System On The Planet" cant handle the load... Or better
-
Transferring APO scheduling agreeement through CIF
When we transfer scheduling agreement through CIF to APO, they automatically get created as type "OLTP". APO however, does not recognize vendors if the scheduling agreement is not of the type "APO". We would appreciate it if anyone knows a setting in
-
When I downloadded firefox, I lost adobe acrobat program, but still have the plug-in
and I can't figure out how to get it back!
-
How do I connect my ipad to my car stereo without the ipad screen message 'Accessory connected'
How do I connect my ipad to a car stereo without the screen message showing, 'Accessory connected', which prevents me being able to select the music I want from ipad screen.