Parameter transfer to tmloadcf from Unix shell script.
Hi.
I am using Tuxedo global transaction with database password encryption, so I replaced by ***** the database password in OPENINFO string of the TMS in the UBBCONFIG GROUP section.
As a result the password should be inserted manually when running tmloadcf.
Do you know how this password can be inserted from a Unix shell scripts?
I tried to use << or named pipe (mkfifo) but in both cases the tmloadcf remained stuck.
Thanks in advance for your help.
Amnon Katz.
Amnon,
The C library function isatty() is used to determine if tmloadcf is
associated with a terminal. If isatty(0) returns 0, then the tmloadcf code
to prompt for a password will fail.
In some places in Tuxedo, there is functionality to allow reading a password
from an environment variable if the process requiring the password is not
associated with a terminal. However, this functionality is not available
for tmloadcf. If you have an active Tuxedo maintenance contract and the
functionalty of reading a database password from an environment variable
when tmloadcf is not run from a terminal is important to you, you may want
to file a support case and request that this functionality be added to
tmloadcf. Otherwise, you will have to run tmloadcf from a terminal.
Regards,
Ed
<Amnon Katz> wrote in message news:[email protected]..
Thanks Ed for your reply.
Do you know how tmloadcf identify that descriptor 0 is associated with a
terminal?
Is it possible to write some code that can emulates this situation?
Regards,
Amnon
Similar Messages
-
Calling a report from unix shell script
Hi,
I had to call a report from unix shell script.
May i know the procedure to accomplish this
Thanks in Advance
A.GopalFirst you should not include the whole path to your report in the call ...
Use like this:
/ora/u01/oracle/v101/as2/bin/rwrun.sh report=an_stati destype=file desname=/ora/u01/oracle/v101/as2/test.pdf desformat=pdf
In $ORACLE_HOME/bin/reports.sh:
1) Verify that you have updated the REPORTS_PATH variable to include your folder where you have the report in question
REPORTS_PATH=/ora/u20/app/qits/env1/run:$ORACLE_HOME/reports/templates:$ORACLE_HOME/reports/samples/demo: ....
2) Verify that the REPORTS_TMP variable is pointing to a valid location and that the oracle user has access to write on it.
After that, post the content of the tracefile located at $ORACLE_HOME/reports/logs/{in-process report server name folder}/rwserver.trc
If no file is present then it means that you need to enable trace in your reports's conf file.... go to the $ORACLE_HOME/reports/conf folder and and locate the .conf file that correspond to your in-process reports server name (as specified in the rwservelet.properties file)... open/edit the file to enable trace logs ..
i.e.
Change the following line:
<!--trace traceOpts="trace_all"/-->
to <trace traceOpts="trace_all"/>
Bounce the reports server and try to run the report again, this time the .trc file should be generated, post the content so that we can take a look. -
Calling stored procedure from unix shell script
Hello,
I am facing a problem while calling a stored procedure from UNIX shell script. I want to return a output variable from the stored procedure to the UNIX environment.
Here is the code-
#!/bin/sh
OUTPUT=`sqlplus cmag/magnum@dw <<ENDOFSQL
set serveroutput on;
var prd_out varchar2(100);
exec create_pm_window(:prd_out);
exit;
ENDOFSQL`
echo " output is - $OUTPUT"
The problem is :prd_out is not getting copied to shell variable OUTPUT.
I have a dbms_output.put_line in the stored proc create_pm_window and I can see that prd_out is getting populated.
Any help is really appreciated.
Thanks'
RakheeFirst step :
make sure the PL/SQL works as expected.
Does the following display the expected output executed from SQL*Plus ?
set serverout on
declare
prd_out varchar2(100);
begin
create_pm_window(prd_out);
dbms_output.put_line('output is '||prd_out);
end;
I don't have your procedure, but using a dummy procedure like :
Scott@my10g SQL>create procedure foo(p_out in out varchar2)
2 is
3 begin
4 select 'Hello '||instance_name into p_out from v$instance;
5 end;
6 /
Procedure created. and a toto.sh script as :OUTPUT=`sqlplus -s scott/tiger <<EOF
set pages 0 lines 120 trimout on trimspool on tab off echo off verify off feed off serverout on
var mavar varchar2(100);
exec foo(:mavar);
print mavar;
exit;
EOF`
echo "OUT = ${OUTPUT}"
exitIt works fine :[oracle@Nicosa-oel ~]$ ./toto.sh
OUT = Hello my10g -
Return codes from sqlldr command from unix shell script
I am trying to capture error code from sql loader from unix shell script and display proper messages.
sqlldr parfile=sdb.par control=$cntlfile data=$infile bad=$badFile log=$logFile rows=10000
rows=10000
retcode=`echo $?`
case "$retcode" in
0) echo "SQL*Loader execution successful" ;;
1) echo "SQL*Loader execution exited with EX_FAIL, see logfile" ;;
2) echo "SQL*Loader execution exited with EX_WARN, see logfile" ;;
3) echo "SQL*Loader execution encountered a fatal error" ;;
*) echo "unknown return code";;
esac
Eventhough, there are errors while executing sqlldr, it is always returing recode zero. What could be the possible reason
Please adviceIs there a typo in your code ?
sqlldr parfile=sdb.par control=$cntlfile data=$infile bad=$badFile log=$logFile rows=10000
rows=10000
retcode=`echo $?` In this code, you get the return code of the statement in bold which is not the sqlldr statement ... -
Unable to pass parameter in oracle procedure through unix shell script
Hi Experts,
I have oracle procedure where in I have to pass the value of procedure parameter through unix script.
Follwoing is the sample procedure which i tried to exceute from the unix.
Procedure:
create or replace procedure OWNER.PRC_TESTING_OWNER(OWNER IN VARCHAR2) AS
sql_stmt varchar2(1000) := NULL;
v_count number := 0;
v_owner varchar2(100) := owner;
begin
sql_stmt:='select count(1) from '||v_owner||'.EMP@infodb where rownum<=10';
execute immediate sql_stmt into v_count;
DBMS_OUTPUT.PUT_LINE(sql_stmt);
DBMS_OUTPUT.PUT_LINE(v_count);
END;The script which I used is:
Unix
#!/bin/ksh
parm=$1
echo start
sqlplus -s scott@DEV/tiger <<EOF >>result_1.txt
set serveroutput on;
select '$parm' from dual;
exec owner.PRC_TESTING_OWNER('$parm');
EOFThe script is working fine that is i am able to pass to parameter value through unix shell script. :)
But if I want to pass the value of the owner in cursor , I am unable to pass this value through unix.
Following the procedure which i am trying to implement.
create or replace procedure OWNER.PRC_TESTING_OWNER(OWNER IN VARCHAR2) IS
v_owner varchar2(100) := owner;
CURSOR main_cur IS
select
i.ROWID rid ,
emp_name,
deptid
from v_owner.employee;
CURSOR subset_cur(c_deptid NUMBER ) IS
SELECT *
FROM v_owner.DEPT d
where d.dept_id=c_deptid;
--##main loop
FOR i IN main_cur LOOP
FOR j IN subset_cur(i.deptid) LOOP
BEGIN
insert into v_owner.RESULT_TABLE
END;
END LOOP;
END LOOP;How can i pass parameter value of the stored procedure through unix script(that is "owner" in this case), when these parameter value is
used in cursor? :(
Can anybody help me regarding the same?
Thanks in Advance !! :DIt's not the parameter in the cursor that is the problem, it's that you are trying to use static SQL for something that won't be known until run time (the owner of the table).
You would need to use something like ...
declare
l_owner varchar2(30) := 'SCOTT';
l_ref_cursor sys_refcursor;
type l_ename_tab is table of scott.emp.ename%type;
l_ename_array l_ename_tab;
begin
open l_ref_cursor for
'select ename
from ' || l_owner || '.emp';
loop
fetch l_ref_cursor bulk collect into l_ename_array limit 10;
exit when l_ename_array.COUNT = 0;
for x in 1 .. l_ename_array.count
loop
dbms_output.put_line(l_ename_array(x));
end loop;
end loop;
close l_ref_cursor;
end;
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
JAMES
FORD
MILLER
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.01 -
Executing java from unix shell script
Hi, I am trying to execute java program from a unix shell script and the program has a command line parameter. I have tried in ways like
/opt/java1.4/bin/java CollExtractLoadProcess /home/inbox/archive/file_name
/opt/java1.4/bin/java CollExtractLoadProcess "/home/inbox/archive/file_name"
/opt/java1.4/bin/java CollExtractLoadProcess '/home/inbox/archive/file_name'
/opt/java1.4/bin/java CollExtractLoadProcess file_name
No matter how I execute it gives me the following error
Exception in thread "main" java.lang.ClassFormatError: CollExtractLoadProcess (C
ode segment has wrong length)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
3)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
Could someone please let me know what is the correct way of doing this?
Thanks.Sounds like you either have a corrupt class file or you're using an older version of the JVM to try to execute classe that were compiled for a newer version.
-
Execute stored procedure from Unix shell script
My current method of executing stored procedures (wpl_1 and wpl_2) from a unix shell script is as follows:
<<wpl.sh>>
sqlplus user/password @/home/oracle/scripts/wpl.sql
<<wpl.sql>>
set serveroutput on size 1000000
set timing on
execute wpl_1('0000010676','~')
execute wpl_2('0000010676','~')
execute wpl_1('0000010236','FIX')
execute wpl_2('0000010236','FIX')
exit
Question: Is it possible to combine the two scripts (unix and oracle) together?A little rusty on this, but this may work:
My current method of executing stored procedures
(wpl_1 and wpl_2) from a unix shell script is as
follows:
<<wpl.sh>>sqlplus user/password @/home/oracle/scripts/wpl.sql << EOF
set serveroutput on size 1000000
set timing on
execute wpl_1('0000010676','~')
execute wpl_2('0000010676','~')
execute wpl_1('0000010236','FIX')
execute wpl_2('0000010236','FIX')
exit
EOF
>
Question: Is it possible to combine the two scripts
(unix and oracle) together? -
Running SQLPLUS from UNIX shell script
I'm not sure if this is the right forum, but...
How can I execute a sql file from inside the UNIX shell script, logging on to Oracle w/o supplying a UID/pwd? Normally, we log into UNIX using our own logon, then sudo as another user to login to Oracle. Now, I'm trying to create a UNIX shell script, where I'm already sudo'd as the UserID that logs into Oracle. I've tried the following, but can't get it to work. I'm a UNIX scripting noob. Any ideas?
example:
#! /usr/bin/ksh
sqlplus / \@test.sql << EOF
exit;
EOFI'm a UNIX scripting noob.In which case I feel obligated to point you at William Robertson's excellent article Database Shellscripts Considered Harmful. Save yourself a world of pain.
Cheers, APC -
How can i call a Stored Procedure procedure from Unix shell script
Hi All,
I want to call a Strored PL-SQL Procedure through Unix shell script.
Can any body help me with this.
Regards,
SaurabhI prefer a seperate script like the other poster mentioned. However, most shells can use a 'here' document as well ...
sqlplus uid/pwd <<END
exec myproc
exit
ENDRichard -
I am unable to set the classpath from unix shell script
) I am new to java, provide me the solution to my problem, as it is urgent
I am unable to execute shell script on unix machine, the code is given below:
Basically it is not setting the classpath
dbUpload .java is astand alone java program to retrieve the report instance statistics from crystal server
Created a jar file from dbUpload.java as
Jar �cvf dbUpload.jar dbUpload.class
Here is mycode(script.sh)
CLASSPATH=/u01/CrystalList/cecore.jar:${CLASSPATH}:
CLASSPATH=${CLASSPATH}:/u01/CrystalList/cereports.jar:
CLASSPATH=${CLASSPATH}:/u01/CrystalList/dbUpload.jar:
Export CLASSPATH
Echo ${CLASSPATH}
Java dbUploadvenkat123,
if the code you posted is the original code of your script - it has some misspellings. Please try this one - it works for me both on solaris and linux.
#! /bin/bash
CLASSPATH=/u01/CrystalList/cecore.jar:$CLASSPATH
CLASSPATH=$CLASSPATH:/u01/CrystalList/cereports.jar
CLASSPATH=$CLASSPATH:/u01/CrystalList/dbUpload.jar
export CLASSPATH
echo $CLASSPATH
java dbUpload -
Passing Null Characters from Unix Shell Script to Java Program
Hi Experts,
Facing an issue with a shell script....
The shell script has 10 input parameters....
1st Parameter is a compiled Java program name(This can keep changing)
Rest 9 are the parameters of the Java Program...
The following piece of code is working when Test "a z" "b t" "" "" "" "" "" "" "" "" is hardcoded.
lv_java_string=`java Test "a z" "b t" "" "" "" "" "" "" "" ""`
The whole thing being dynamic.....
But when I dynamically populate the same on to a parameter lv_java_param and then execute the same
lv_java_string=`java $lv_java_param`
if i echo $lv_java_param its giving me Test "a z" "b t" "" "" "" "" "" "" "" "" correctly
Im facing some issue...... The issue is " is being treated as a parameter itself and the space between a and z is not taken into consideration and hence z is taken as the 2nd parameter
Issue seems to be something like the precedence in which the above statement is executed, because of which "s are calculated/manipulated. Is it something like
a) $lv_java_param is computed first and then java $lv_java_param
b) or java $lv_java_param is run on the fly......
Any help is much appreciated.This forum is about Oracle *RDBMS*
I don't see any question about Oracle RDBMS
Please find a forum about Java.
Sybrand Bakker
Senior Oracle DBA -
Calling sqlplus from unix shell script
Hi All,
I am executing the following code :-
sqlplus -s ${DATABASE_USER} |&
print -p -- 'set feed off pause off pages 0 head off veri off line 500'
print -p -- 'set term off time off serveroutput on size 1000000'
print -p -- "set sqlprompt ''"
print -p -- "SELECT run_command from tmp_run_batch where upper(batch_name) = upper('${PAR_PROGRAM_NAME}');"
read -p RUN_COMMAND
eval print -p -- \""execute dbms_output.put_line(${RUN_COMMAND});"\"
read -p RET_VAL
print -p -- "exit;"
The select stmt given above gives sample output as :-
pack_claims_clas_utils.func_main('$PAR_RUN_DATE','$PAR_RUN_LEVEL','$PAR_EXCLUSIVE_RUN_YN')
And then this package is executed.
The problem that I am facing is how to handle the no_data_found case of the select stmt. . When this case arises then the stmt. "read -p RUN_COMMAND" hangs.
Could you please provide any solution ?
Thanks
SudsHi,
Have you tried this:
# if [ -n means String has non-zero length
if [ -n $RUN_COMMAND ]
read -p RUN_COMMAND
fi
Hi All,
I am executing the following code :-
sqlplus -s ${DATABASE_USER} |&
print -p -- 'set feed off pause off pages 0 head off veri off line 500'
print -p -- 'set term off time off serveroutput on size 1000000'
print -p -- "set sqlprompt ''"
print -p -- "SELECT run_command from tmp_run_batch where upper(batch_name) = upper('${PAR_PROGRAM_NAME}');"
read -p RUN_COMMAND
eval print -p -- \""execute dbms_output.put_line(${RUN_COMMAND});"\"
read -p RET_VAL
print -p -- "exit;"
The select stmt given above gives sample output as :-
pack_claims_clas_utils.func_main('$PAR_RUN_DATE','$PAR_RUN_LEVEL','$PAR_EXCLUSIVE_RUN_YN')
And then this package is executed.
The problem that I am facing is how to handle the no_data_found case of the select stmt. . When this case arises then the stmt. "read -p RUN_COMMAND" hangs.
Could you please provide any solution ?
Thanks
Suds -
Error while trying to execute a unix shell script from java program
Hi
I have written a program to execute a unix shell script in a remote machine. I am using J2ssh libraries to estabilish the session connection with the remote box.The program is successfully able to connect and authenticate with the box.
The runtime .exec() is been implemented to execute the shell script.I have given below the code snippet.
try {
File file_location = new File("/usr/bin/");
String file_location1 = "/opt/app/Hyperion/scripts/daily";
String a_mib_name = "test.sh";
String cmd[] = new String[] {"/usr/bin/bash", file_location1, a_mib_name};
Runtime rtime = Runtime.getRuntime();
Process p = rtime.exec(cmd, null, file_location);
System.out.println( "Connected to the server1" );
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = br.readLine();
while(line !=null)
System.out.println(line);
line = br.readLine();
br.close();
p.getErrorStream ().close ();
p.getOutputStream().close();
int retVal = p.waitFor();
System.out.println("wait " + retVal);
//session.executeCommand("ls");
catch (IOException ex) {
I get an error message
Connected to the server
java.io.IOException: Cannot run program "/usr/bin/bash" (in directory "\usr\bin"
): CreateProcess error=3, The system cannot find the path specified
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at SftpConnect.main(SftpConnect.java:143)
Caused by: java.io.IOException: CreateProcess error=3, The system cannot find th
e path specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
I am sure of the file path where the bash.sh and test.sh are located.
Am i missing something? Any help would be greatly appreciated.
Thanks
SenthilHi, I am using a simple program to connect to a RMI server and execute shell script. I use the Runtime.exec aommand to do the same.
The script is sh /tmp/pub/alka/test.sh /tmp/pub/alka/abc/xyz/ul ul
The script when run from the server, gives no errors. But when ran using rthe above method in java, gives errors as follows,
Mycode:
String command = "/bin/sh /tmp/pub/alka/test.sh /tmp/pub/alka/abc/xyz/ul ul";
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(command);
int exitVal = proc.exitValue();
System.out.println("Process exitValue: " + exitVal);
java.io.IOException: CreateProcess: /bin/sh /tmp/pub/alka/test.sh /tmp/pub/alka/abc/xyz/ul ul error=3
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at DecryptTest.main(DecryptTest.java:18)
Can anyone please help -
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> -
Unix shell script run from pl/sql procedure
Hi Guru
I want to run unix shell script from pl/sql procedure. Actual I want to run it from developer 10g form.
Please guide me in this regards
Regards
JewelLook at the host or client_host builtins in the help
Maybe you are looking for
-
Is there a limit of words for shortcuts on the iphone?
I'm having a problem with the shortcuts on my iphone. I had a bunch of shortcuts and since i had too many it started to rarely worked. Is there a limit or something? Now the option for shortcuts is still available. But only to add and when i try to s
-
Client Configuration in Applications 11i
Hi, I installed oracle apps 11i successfully. But I was unable to connect from clients. Welcome screen is coming and then Jinitiator is loading. After that it is giving error, unable to connect to server servername:9002. Please help me out. Regards,
-
Agent Assignment for MDG Workflow
Hi, I have copied a standard wokflow of master data governance into a 'Z' copy of it. I will use that same workflow but for different agents in it. I have to assign agents in it but that agents are like users with different hierarchical levels. I am
-
I got the new iPhone 5, and all is well, but when I wanted to download a new app, I got a message asking me for the answers to my security questions. I don't even recognize the questions, let alone know the answers. My rescue email is no longer valid
-
Hi all, I am doing a test Idoc to File interface. Can anybody tell me how to send an Idoc from R/3? I am trying to send using we19 transaction. I am selecting basic type and after giving appropriate values, i am clicking on <b>Standard outbound proce