Call an OS shell
Hi,
In a PL/SQL loop procedure, I need to call a AIX system command, to create dynamically a file (name depends of fetch cursor perform in a loop), and next open it (UTL_FILE.FOPEN don't create the file). Can somebody help me ?
thanks for your help
best regards
Christophe
Christophe,
see following link for how to call a shell script using java: http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:952229840241
however, I find it strange that you say that utl_fil.fopen does not create the file. Can you give me some information about the oracle version you have, the security settings on the directory in which you want to create the file.
can you try to run the following code and tell me if it works?
DECLARE
l_dir varchar2(100) := 'a valid directory';
l_filename varchar2(100) := 'new_file.txt';
l_output utl_file.file_type;
BEGIN
l_output := utl_file.fopen(l_dir, l_filename, 'w', 32000);
utl_file.put(l_output, 'bla bla bla');
utl_file.fclose(l_output);
END;
greetings
Freek
Similar Messages
-
Calling a dos shell with a servlet
I am using the code below to call a dos shell using a servlet. will you please tell what is wrong with my code. thank you.
public class ResponseServlet extends HttpServlet {
public void doGet (HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
PrintWriter out = response.getWriter();
// then write the data of the response
String username = request.getParameter("username");
if ( username != null && username.length() > 0 ) {
Runtime rt = Runtime.getRuntime();
rt.exec("C:\\WINNT\\system32\\CMD.EXE");
public String getServletInfo() {
return "The Response servlet says hello.";Response code 503. "Service unavailable". Sounds like a server configuration issue.
-
Calling sqlplus from shell script
Hi ,
I am calling sqlplus from a shell script. After running sql commands successfully, it fails to continue executing commands from the shell script.
There is no EXIT statement at the end of the sql.
The error i get is,
SP2-0734: unknown command beginning "echo "FFFF..." - rest of line ignored.
Can someone please help.how does your shell script looks like? did you check my other post today on this forum
sqlplus called from a shell script -
Calling linux / unix shell scripts from APEX
Hi -- I'm doing some prototyping, and would like to try calling a unix shell script on the server from within APEX.
Is this possible? Maybe thru Javascript? Other ways? Not sure if it's possible thru pl/sql.
FYI, I'm attempting to check username/password specified at login to see if it's a valid login
to another database (also specified at login). If there's an easier way to do this, I'd love to hear it!
We're highly motivated to have a single apex app work on multiple databases -- largely because of a lack of
administration resources on the other databases. All databases are accessible via database links from
the apex server (the links are necessary to implement other business rules), and I know I can get
the DML working. Powers that be prefer that Database Account authentication (or a facsimile thereof)
be used. I suspect I'm opening myself up to lots of criticism by disclosing this ... :)
Thanks for any ideas,
CarolR -- If I understand you correctly, a pl/sql process in APEX could invoke a java program on the server. Is that correct?
If so, is there any reason it couldn't just call a unix shell script? Seems they're both just executables recognized by the OS....
I know I called unix scripts from embedded sql a billion years ago, but don't recall the method for doing that. What is
the syntax I'd use in apex / pl/sql?
thanks,
Carol -
Calling an external shell-script?
Hello everybody,
I only have a short question: How can I easily call an external shell-script in PL/SQL? I need this to make new directories ...
thx for helpRe: is ADF free??
We have a problem when we want to create a portlet base on WebClipping Port
How to customize login page in 11.5.10.2? -
Calling an external shell script program from ABAP.
Hi,
Can i call an external shell script program from abap which is there on application server.
The FM WS_EXECUTE i know can be used for calling this purpose.
But i am getting a doubt that how can i call the external program from there.
Please clear my doubts.
Thanks in advance.
Vikashsearch in SCN for sm49 and sm69 Tr. you will surely find solutions for it, with a simple search.
-
Call a UNIX shell script from an oracle stored procedure
We need to call a UNIX shell script from an oracle stored procedure
i.e. the control should come back to the procedure once the script completes. Can any body help to achieve this ?There are various ways in achieving this.
For Example, you can call a PRO*C-Library residing on the database server.
This requires a PL/SQL library to be generated and some changes to the Listener configuration.
It is also possible to implement a java procedure on the database being invoked by a PL/SQL wrapper class.
In this way (and if used right) there is also granularity regarding the filestructure permissions given and it may be called during a Forms or other PL/SQL session.
The article below explains a more generic approach how to invoke shell commands from within an Oracle Instance.
Be careful with this, because it really works ;)
Refer to :
http://www.oracle-base.com/articles/8i/ShellCommandsFromPLSQL.php
Message was edited by:
user434854 -
Debugging a program being called from a shell script
hi All,
i want to know how debug a C program being called from A Shell Script,
my script looks like the following :
ecReqProcMain $Cfg/ecReq.g $TotCnt 2>> $ErrFilei also have to pass some arguments to the script itsellft, which in trun going to pass it to the program,
also in some cases i may be required to Pipe some data to the program, like the folowing
cat DataFile | myProgramThanks ,You can also use ss_attach with the scheme that Anton
suggested above. Instead of inserting "dbx" into your
script, insert "ss_attach" into your script.
It's also possible to change your script to something like this:
cat DataFile | ${DEBUG} myProgram
Then you can run your script like this:
setenv DEBUG ss_attach
ecReqProcMain $Cfg/ecReq.g $TotCnt 2>> $ErrFile
--chris -
Getting an exit value from a program called thru a shell script
how do i get the correct exit value always from a program called thru a shell script
the getExitValue of the process works fine someitmes but not always ...
Ex: write a pgm which sleeps for 5 secs & returns with exit(100).try to invoke this thru a script & try to run this script from Runtime.getRuntime.exec(..)
...the exit value is not same as 100.(it works if the sleep is not given though !!)
can nebody help??ive done that ...see the sample code for ex..
public void execute()
try{
Process program=Runtime.getRuntime().exec(cmd);
printOutput(program.getInputStream());
try
program.waitFor();
catch(InterruptedException e)
System.out.println("Command Interrupted: " + e);
System.out.println("Error status : "+program.exitValue());
catch(SecurityException e)
System.out.println("Error executing program "+e);
catch(IOException e)
System.out.println("Error executing program "+e);
.... -
How to call a dos shell from a servlet
How could I call a dos shell using a servlet so that java files could be compiled and the results be seen without having to call the browser each time? thanks for your kind attention. amaral
I guess this might help....
In one of your servlet classses create a runtime process and execute a command( the path to javac and the file to be compiled) wait for the process to finish a get the result and send it to the client.
- XL -
Problem while calling concsub from shell script
Hi All,
I am facing problem when I am trying to run CONCSUB utility from shell script.The same works well when I try it from command line.The only prob I am facing from shell script is assigning values to temporary variables.
This is how my script looks
#!/bin/bash
export PARM5="$5"
export PARM6="$6"
export PARM7="$7"
echo "INTPARM5=\"$PARM5\""
echo "INTPARM6=\"$PARM6\""
echo "INTPARM7=\"$PARM7\""
echo $FND_TOP/bin/CONCSUB $1 ONT 'Order Management Super User, Vision Operations (USA)' $3 WAIT=Y CONCURRENT ONT $PROGRAM "$INTPARM5" "$INTPARM6" "$INTPARM7"When I try to run the above shell based concurrent program it doesn't pass the parameters as expected and it errors out saying "Wrong number of arguments to call the procedure"
I tried my luck from some of the previous posts ({thread:id=2360776} ),but to vain
If anyone has any ideas,please suggest!!
Thanks in advance!!
Edited by: sandy on May 4, 2013 12:54 PMHere are your proofs
Proocedure
PROCEDURE abc(--p_errbuf OUT VARCHAR2,
--p_errcode OUT VARCHAR2,
p_order_no IN NUMBER DEFAULT NULL,
p_customer_id IN NUMBER DEFAULT NULL,
p_name IN VARCHAR2 DEFAULT NULL
IS
v_cname VARCHAR2(200);
v_ordered_date DATE;
v_order_number NUMBER;
v_order_type VARCHAR2(200);
BEGIN
fnd_file.put_line(fnd_file.output, 'Begin Execution');
SELECT DISTINCT ac.customer_name,
d.ordered_date ordered_date,
d.order_number order_number,
x.NAME order_type
INTO v_cname
,v_ordered_date
,v_order_number
,v_order_type
FROM oe_order_headers_all d,
oe_transaction_types_tl x,
wsh_delivery_details b,
wsh_delivery_assignments c
,ar_customers ac
WHERE 1 = 1
AND ac.customer_id = b.customer_id
AND d.order_type_id = x.transaction_type_id
AND x.LANGUAGE = 'US'
AND b.released_status = 'B'
AND b.source_header_id = d.header_id
AND c.delivery_detail_id = b.delivery_detail_id
AND d.order_number=NVL(p_order_no,d.order_number)
AND ac.customer_id = NVL(p_customer_id,ac.customer_id)
AND x.name=NVL(p_name,x.name)
AND NOT EXISTS (SELECT 1
FROM wsh_delivery_details b
WHERE 1 = 1
AND b.released_status != 'B'
AND b.source_header_id = d.header_id)
--BETWEEN ('1213794') and ('1213797'))
AND rownum<2;
INSERT INTO xxc_temp(customer_name,ordered_date,order_number,order_type) VALUES(v_cname,v_ordered_date,v_order_number,v_order_type);
COMMIT;
fnd_file.put_line(fnd_file.output, 'Order Number is' || v_order_number);
fnd_file.put_line(fnd_file.output, 'Order Type is' || v_order_type);
END;Script
#!/bin/bash
set -x
export PARM5="$5"
export PARM6="$6"
export PARM7="$7"
sqlplus -s $1 <<EOF
set head off feed off serverout on size 1000000
exec abc('$PARM5','$PARM6','$PARM7');
exit
EOFNow when I run the 'XX Order Detail CSV Report' I get the below log and no Output
+---------------------------------------------------------------------------+
Application Object Library: Version : 12.0.0
Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
XXKES_PDF_TRANSFER module: XX Order Detail CSV Report
+---------------------------------------------------------------------------+
Current system time is 06-MAY-2013 05:05:56
+---------------------------------------------------------------------------+
+ export PARM5=66432
+ PARM5=66432
+ export PARM6=
+ PARM6=
+ export PARM7=Mixed
+ PARM7=Mixed
+ sqlplus -s APPS/APPS
+---------------------------------------------------------------------------+
Executing request completion options...
Output file size:
0
+------------- 1) PRINT -------------+
Disabling requested Output Post Processing. Nothing to process. The output of the request is zero byte.
+--------------------------------------+
Finished executing request completion options.
+---------------------------------------------------------------------------+
Concurrent request completed successfully
Current system time is 06-MAY-2013 05:05:56
+---------------------------------------------------------------------------+After the concurrent program executed I queried the table xxc_temp and here you see the data
SQL> select * from xxc_temp;
CUSTOMER_NAME
ORDERED_D ORDER_NUMBER ORDER_TYPE
A. C. Networks
18-FEB-13 66432 MixedMy procedure fetches the data fro given set of i/p parameters but it doesn't give o/p coz it's a host based conc program.Please advise if there's a way to get the o/p in a host based conc program
Thanks!! -
Passing contents of file as an argument while calling class from shell scri
I am calling a class from shell script. One fo arguments which i want to pass to this class is the content of a text file. like:
/opt/java/bin/javac CLASS_NAME "FILE_CONTENTS"
if i give "cat FILE_NAME" it will take literally
and if i dont use quotes then it will be considered as seperate arguments, how do i slve this?double-post http://forum.java.sun.com/thread.jspa?threadID=684422
-
Calling AIX (.sh) shell script from scheduler
Hi, these are my env.
Oracle DB = 10.2.0
OS = AIX
I hit the following error when executing an user's procedure of calling scheduler to run a .sh script.
ORA-27369: job of type EXECUTABLE failed with exit code: 255
STANDARD_ERROR="execve: Exec format error"
Can scheduler works on AIX .sh script? If yes, what is the env i need to set such as path, security setting... in order to get this work. Thanks.Do you use ksh?
if yes -> set the job_action to the shell executable
metalink:555160.1
1.
begin
dbms_scheduler.create_job
job_name => 'My_job',
job_type => 'EXECUTABLE',
job_action => '/usr/bin/ksh',
start_date =>sysdate+ 1/288 , /* this to postponed the start date 5
minutes until enabling the job at last step .*/
number_of_arguments => 1,
repeat_interval => 'FREQ=MINUTELY; INTERVAL=2',
enabled => false,
comments => 'test as per ANUJ95 '
end;
2.
SQL> exec dbms_scheduler.set_job_argument_value(job_name=>'My_job',
argument_position=>1,
argument_value=>'/tmp/test.sh') ;
3.
exec dbms_scheduler.enable(name=>'My_job') -
Need Example on calling a unix shell script from oracle stored procedure
Hi
Can anybody give example on how to call unix shell script from an Oracle stored procedure. Please give a small example on how to do this .I need this urgently please.
Have a nice time.
Thanks & Regards
JogeshIf you are on 10g you can also use DBMS_SCHEDULER. See Re: Excute Unix command Using PL SQL
-
Calling sql through shell script
How do i call a sql file through shell script in unix ?
Rahul India wrote:
export ORACLE_HOME=$ORACLE_BASE/product/10g
cd $ORACLE_HOME
set `sqlplus -s <SCHEMA_NAME>/<SCHEMA_PASSWORD> <<EOF
@r_100.sql
exit;
EOF`THIS SCRIPT IS OK?You'll also need to set ORACLE_SID
And I don't know why everyone is putting the reference to sqlplus inside a "set" valuation, nor why they are putting the reference to the script in a redirected input stream. All you need is
sqlplus -s user/password @r_100.sqlAnd to insure the invironment is correctly set:
export ORACLE_SID=whatever
export ORAENV_ASK=NO
. oraenv
unset ORAENV_ASK=NO
sqlplus -s user/password @r_100.sql
Maybe you are looking for
-
How to share the same QUERY among report, chart on the same page? and more
Dear HTMLDB experts, I am absolute rookie to this tool, so I have some questions need you all's help. (1) When I build a page with a spread sheet and a chart on the same page, they all use the same query to get the data. However, I have to type in th
-
How to clone data with in Table with dynamic 'n' number of columns
Hi All, I've a table with syntax, create table Temp (id number primary key, name varchar2(10), partner varchar2(10), info varchar2(20)); And with data like insert itno temp values (sequence.nextval, 'test', 'p1', 'info for p1'); insert into temp valu
-
Remove dependencies from running processes
We have openSSH running on a number of Solaris 10 servers. I want to upgrade the SSH version, however in running "svcs -p", there are a number of dependent processes. Running "svcadm disable ossh" will stop these dependencies. How do I disable openSS
-
Hi All, I am having a issue one of the Look up keys while i am looking to populate a date key into my fact table using a day_dt = calender_date lookup join for lot of records i am getting gud results except for some of the records i am getting NULL v
-
Dashboard Sticky recovery in Mavericks?
I don't have a Library file in my user folder, and i cannot find the database file for my dashboard stickies. What can i do to restore these?