Error in shell script
isitpasrd03{icfgtst2}/apps/opt/oracle> cat text.sh
#!/bin/ksh
VALUE1=`/apps/opt/oracle/product/10.2.0/bin/sqlplus -silent / as sysdba <<END
set pagesize 0 feedback off verify off heading off echo off
col TIME_TAKEN_DISPLAY for a10
col INPUT_BYTES_DISPLAY for a10
col OUTPUT_BYTES_DISPLAY for a10
select start_time,end_time,output_device_type,input_type,status,time_taken_display,input_bytes_display,output_bytes_display from V\$RMAN_BACKUP_JOB_DETAILS where to_date(Start_time, 'DD-MON-YY')=to_date(sysdate,'DD-MON-YY');
`
echo " $VALUE1"
isitpasrd03{icfgtst2}/apps/opt/oracle> sh text.sh
select start_time,end_time,output_device_type,input_type,status,time_taken_display,input_bytes_display,output_bytes_display from V where to_date(Start_time, 'DD-MON-YY')=to_date(sysdate,'DD-MON-YY')
ERROR at line 1:
ORA-00942: table or view does not exist
I do not understand where the error is.. can anyone help me on this pls..
isitpasrd03{icfgtst2}/apps/opt/oracle> cat text.sh
#!/bin/ksh
VALUE1=`/apps/opt/oracle/product/10.2.0/bin/sqlplus -silent / as sysdba <<END
set pagesize 0 feedback off verify off heading off echo off
col TIME_TAKEN_DISPLAY for a10
col INPUT_BYTES_DISPLAY for a10
col OUTPUT_BYTES_DISPLAY for a10
select start_time,end_time,output_device_type,input_type,status,time_taken_display,input_bytes_display,output_bytes_display from V\$RMAN_BACKUP_JOB_DETAILS where to_date(Start_time, 'DD-MON-YY')=to_date(sysdate,'DD-MON-YY');
`
END
echo " $VALUE1"
ITS THE SAME ERROR
isitpasrd03{icfgtst2}/apps/opt/oracle> sh text.sh
text.sh: END: not found
select start_time,end_time,output_device_type,input_type,status,time_taken_display,input_bytes_display,output_bytes_display from V where to_date(Start_time, 'DD-MON-YY')=to_date(sysdate,'DD-MON-YY')
ERROR at line 1:
ORA-00942: table or view does not exist
Similar Messages
-
Error executing shell script using dbms_scheduler
I have a job running which executes a shell script,which fails with following error :
SQL> SELECT additional_info
2 FROM user_scheduler_job_run_details
3 WHERE log_date = (SELECT MAX (log_date)
4 FROM user_scheduler_job_run_details);
ADDITIONAL_INFO
ORA-27369: job of type EXECUTABLE failed with exit code: No such file or directory
STANDARD_ERROR="mkdir: Failed to make directory "/export/home/bwsolaris/abc"; Permission denied"
This are contents of my shell script
#!/bin/ksh
/bin/mkdir /export/home/bwsolaris/abc
Can anyone suggest me some way out of it?
Thanks in advance!!!Does oracle still creates a user nobody"nobody" is a "standard" Unix/Linux lowly privileged user, which is used by DBMS_SCHEDULER by default.
You should change permissions on /export/home/bwsolaris, e.g.
$ chmod 777 /export/home/bwsolaris
or use a different directory, where everyone has access, for example /tmp.
Or take a look at Metalink Note:391820.1 - Scheduled Job Running Shell Script Fails With ORA-27369 -
Osascript Finder error in shell script
I have a shell script that displays a popup via osascript based on a ping response.
#!/bin/sh
+pinghost=`/sbin/ping -c1 -o -q xxx.xxx.xxx.xxx | grep "100%"`+
+if $pinghost >/dev/null 2>&1 ; then+
+exit 0+
else
+osascript -e 'Tell Application "Finder"' -e "activate" -e "display dialog \"Excuse me, The home router is not responding\"" -e 'end tell'+
exit
fi
If the osascript line executes it works but in testing I see the following:
+2008-07-08 18:41:29.270 osascript[18705:10b] * _NSAutoreleaseNoPool(): Object 0x12e4a0 of class NSPathStore2 autoreleased with no pool in place - just leaking+
+Stack: (0x93343cdf 0x93251767 0x932594af 0x93258fae 0x9325da5b 0xc78e6 0xc7b5b 0x96b11f97 0x96b122f6 0x941cbc74 0x941bd648 0x941c67be 0x941c95ab 0x97052caf 0x22417a 0x227dfd 0x227fc0 0x20fc3d 0x20ff07 0x20ffa5 0x207a2d 0x9659bf31 0x96b10168 0x2236c4 0x2237e2 0x223915 0x22311c 0x2238c9 0x9659bf31 0x96b21513 0x20c9)+
+2008-07-08 18:41:29.273 osascript[18705:10b] * _NSAutoreleaseNoPool(): Object 0x12f8b0 of class NSPathStore2 autoreleased with no pool in place - just leaking+
+Stack: (0x93343cdf 0x93251767 0x93250869 0x9325afd2 0x9325dc32 0xc78e6 0xc7b5b 0x96b11f97 0x96b122f6 0x941cbc74 0x941bd648 0x941c67be 0x941c95ab 0x97052caf 0x22417a 0x227dfd 0x227fc0 0x20fc3d 0x20ff07 0x20ffa5 0x207a2d 0x9659bf31 0x96b10168 0x2236c4 0x2237e2 0x223915 0x22311c 0x2238c9 0x9659bf31 0x96b21513 0x20c9)+
+2008-07-08 18:41:29.277 osascript[18705:10b] * _NSAutoreleaseNoPool(): Object 0x131190 of class NSPathStore2 autoreleased with no pool in place - just leaking+
+Stack: (0x93343cdf 0x93251767 0x932594af 0x93258fae 0x93258eb6 0x9325ef58 0xc79fc 0xc7b5b 0x96b11f97 0x96b122f6 0x941cbc74 0x941bd648 0x941c67be 0x941c95ab 0x97052caf 0x22417a 0x227dfd 0x227fc0 0x20fc3d 0x20ff07 0x20ffa5 0x207a2d 0x9659bf31 0x96b10168 0x2236c4 0x2237e2 0x223915 0x22311c 0x2238c9 0x9659bf31 0x96b21513 0x20c9)+
+2008-07-08 18:41:29.278 osascript[18705:10b] * _NSAutoreleaseNoPool(): Object 0x130e90 of class NSBundle autoreleased with no pool in place - just leaking+
+Stack: (0x93343cdf 0x93250562 0xc79fc 0xc7b5b 0x96b11f97 0x96b122f6 0x941cbc74 0x941bd648 0x941c67be 0x941c95ab 0x97052caf 0x22417a 0x227dfd 0x227fc0 0x20fc3d 0x20ff07 0x20ffa5 0x207a2d 0x9659bf31 0x96b10168 0x2236c4 0x2237e2 0x223915 0x22311c 0x2238c9 0x9659bf31 0x96b21513 0x20c9)+
+2008-07-08 18:41:29.290 osascript[18705:10b] * _NSAutoreleaseNoPool(): Object 0x131270 of class NSCFArray autoreleased with no pool in place - just leaking+
+Stack: (0x93343cdf 0x93250562 0x932828f1 0x932828ba 0xc7ad2 0xc7b5b 0x96b11f97 0x96b122f6 0x941cbc74 0x941bd648 0x941c67be 0x941c95ab 0x97052caf 0x22417a 0x227dfd 0x227fc0 0x20fc3d 0x20ff07 0x20ffa5 0x207a2d 0x9659bf31 0x96b10168 0x2236c4 0x2237e2 0x223915 0x22311c 0x2238c9 0x9659bf31 0x96b21513 0x20c9)+
+2008-07-08 18:41:29.291 osascript[18705:10b] * _NSAutoreleaseNoPool(): Object 0x131e80 of class NSPathStore2 autoreleased with no pool in place - just leaking+
+Stack: (0x93343cdf 0x93251767 0x93250869 0x9325afd2 0x9325ae62 0x9328305a 0x932829bf 0x932828ba 0xc7ad2 0xc7b5b 0x96b11f97 0x96b122f6 0x941cbc74 0x941bd648 0x941c67be 0x941c95ab 0x97052caf 0x22417a 0x227dfd 0x227fc0 0x20fc3d 0x20ff07 0x20ffa5 0x207a2d 0x9659bf31 0x96b10168 0x2236c4 0x2237e2 0x223915 0x22311c 0x2238c9 0x9659bf31 0x96b21513 0x20c9)+
+2008-07-08 18:41:29.294 osascript[18705:10b] LCC Scroll Enhancer loaded+
+2008-07-08 18:41:29.296 osascript[18705:10b] * _NSAutoreleaseNoPool(): Object 0x133d60 of class NSMachPort autoreleased with no pool in place - just leaking+
+Stack: (0x93343cdf 0x93250562 0x9326ff65 0x93296e4f 0xce702 0xce5bf 0xc7b2e 0xc7b5b 0x96b11f97 0x96b122f6 0x941cbc74 0x941bd648 0x941c67be 0x941c95ab 0x97052caf 0x22417a 0x227dfd 0x227fc0 0x20fc3d 0x20ff07 0x20ffa5 0x207a2d 0x9659bf31 0x96b10168 0x2236c4 0x2237e2 0x223915 0x22311c 0x2238c9 0x9659bf31 0x96b21513 0x20c9)+
+2008-07-08 18:41:29.344 osascript[18705:10b] * _NSAutoreleaseNoPool(): Object 0x134fb0 of class NSCFNumber autoreleased with no pool in place - just leaking+
+Stack: (0x93343cdf 0x93250562 0xcf1b2 0xce766 0xce5bf 0xc7b2e 0xc7b5b 0x96b11f97 0x96b122f6 0x941cbc74 0x941bd648 0x941c67be 0x941c95ab 0x97052caf 0x22417a 0x227dfd 0x227fc0 0x20fc3d 0x20ff07 0x20ffa5 0x207a2d 0x9659bf31 0x96b10168 0x2236c4 0x2237e2 0x223915 0x22311c 0x2238c9 0x9659bf31 0x96b21513 0x20c9)+
+2008-07-08 18:41:29.345 osascript[18705:10b] * _NSAutoreleaseNoPool(): Object 0x1353f0 of class NSCFString autoreleased with no pool in place - just leaking+
+Stack: (0x93343cdf 0x93250562 0x932d102a 0xce766 0xce5bf 0xc7b2e 0xc7b5b 0x96b11f97 0x96b122f6 0x941cbc74 0x941bd648 0x941c67be 0x941c95ab 0x97052caf 0x22417a 0x227dfd 0x227fc0 0x20fc3d 0x20ff07 0x20ffa5 0x207a2d 0x9659bf31 0x96b10168 0x2236c4 0x2237e2 0x223915 0x22311c 0x2238c9 0x9659bf31 0x96b21513 0x20c9)+
+2008-07-08 18:41:29.346 osascript[18705:10b] * _NSAutoreleaseNoPool(): Object 0x135430 of class NSPathStore2 autoreleased with no pool in place - just leaking+
+Stack: (0x93343cdf 0x93251767 0x9325fd75 0xce782 0xce5bf 0xc7b2e 0xc7b5b 0x96b11f97 0x96b122f6 0x941cbc74 0x941bd648 0x941c67be 0x941c95ab 0x97052caf 0x22417a 0x227dfd 0x227fc0 0x20fc3d 0x20ff07 0x20ffa5 0x207a2d 0x9659bf31 0x96b10168 0x2236c4 0x2237e2 0x223915 0x22311c 0x2238c9 0x9659bf31 0x96b21513 0x20c9)+
+2008-07-08 18:41:29.346 osascript[18705:10b] * _NSAutoreleaseNoPool(): Object 0x1355c0 of class NSCFData autoreleased with no pool in place - just leaking+
+Stack: (0x93343cdf 0x93250562 0x93264c35 0x932729fa 0x932728b8 0x932726d5 0xce79e 0xce5bf 0xc7b2e 0xc7b5b 0x96b11f97 0x96b122f6 0x941cbc74 0x941bd648 0x941c67be 0x941c95ab 0x97052caf 0x22417a 0x227dfd 0x227fc0 0x20fc3d 0x20ff07 0x20ffa5 0x207a2d 0x9659bf31 0x96b10168 0x2236c4 0x2237e2 0x223915 0x22311c 0x2238c9 0x9659bf31 0x96b21513 0x20c9)+
Ideas?If the osascript line executes it works but in testing I see the following:
You might first want to try a heredoc. Easier to read and might cause it to execute differently:
<pre style="padding-left: .75ex; padding-top: .25em; padding-bottom: .25em; margin-top: .5em; margin-bottom: .5em; margin-left: 1ex; max-width: 80ex; overflow: auto; font-size: 10px; font-family: Monaco, 'Courier New', Courier, monospace; color: #444; background: #eee; line-height: normal">osascript <<EO_SCRIPT > /dev/null
tell application "Finder"
activate
display dialog "Excuse me, The home router is not responding"
end tell
EO_SCRIPT
</pre>
If that doesn't pan out, other handy notify commands are say, mail, or open.
Cole -
Error in calling SQL plus program with parameter from Shell script
This is my Shell script. I am trying to call in the SQL plus program with the parameter and the shell script is registered as a concurrent program.
PARAMETERS=`echo $1 |tr -d '\"'`
DB_USER_ID=`echo $PARAMETERS|cut -d" " -f3|cut -d"=" -f2`
CONN_STRING=$DB_USER_ID
REQ_DATE=`echo $PARAMETERS|cut -d" " -f9|cut -d"=" -f2`
timestamp=`date +%m-%d-%y-%H:%M:%S-%Z`
timestam=`date +%y-%m-%d`
sqlplus -s $CONN_STRING @ar_statement.sql $REQ_DATE
chmod 755 statement.sh
. statement.sh
My Sql plus program is like this.
set pagesize 0
set heading off
set feedback off
spool $GEC_TOP/log/ge_ar_statement.sh
select output_file_name
from fnd_concurrent_requests
where trunc(actual_completion_date) = '&2';
spool off;
exit;
When i run the concurrent program, i am getting the following error:
ar_statement: line 14: REQ_DATE: command not found
Enter value for 2:
User requested Interrupt or EOF detected.
ar_statement.sh: line 1: Enter: command not found
ar_statement.sh: line 2: User: command not found
ar_statement
Program exited with status 127
I am not strong at Unix Porgamming and i would request someone who can
help me out as soon as possible.
I need this solution quickly and thank everyone in advance.
Thanks.Can you put your coding between code statements, like shown in the FAQ. It will be easier to read.
Looking at your script, my first guess is that crontab will not find your sqlplus since your script does not have $HOME/bin in the $PATH. From what I understand, running .profile in your script will not work either because variables are exported to sub-shells, not to the shell above. You can call your script with a dot like . ./script which means that the script will run like it was typed at the command prompt. But it will be less confusing to define appropriate variables in the script. eg.
ORACLE_SID=my_instance_name
ORACLE_HOME=/my_path_to_oracle_home_directory
LD_LIBRARY_PATH=$ORACLE_HOME/lib
PATH=$ORACLE_HOME/bin:$PATH
I remember some slightly different way of coding to handle the sqlplus return codes.
For instance:
sqlplus -s /nolog > /dev/null <<-EOF
connect system/manager
@ssm.sql
whenever oserror exit failure
whenever sqlerror exit failure
EOF
sql_err=$?
if [ $sql_err -ne 0 ]; then
echo "FAILURE"
else
echo "SUCCESS"
fiThe - in -EOF supresses tab's
Using connect will prevent ps from showing your login credentials
In some versions of bash the ending EOF needs to be at the beginning of the line to work.
Edited by: waldorfm on Jul 14, 2010 7:05 PM
complaining about putting code between code delimiters and forgot myself ;-)
Edited by: waldorfm on Jul 14, 2010 7:08 PM
Btw, if you "source" a script running it like . .script, than an exit in that script will log you out. -
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 submitting a conc program through CONCSUB in shell script
Hi All,
I am working on 11.5.10.2.
I have a shell script from which I am calling a concurrent program using CONCSUB utility as below
CONCSUB $p_login $p_resp_appl_short_name "$p_resp_name" $p_user_name CONCURRENT $p_conc_appl_short_name $p_conc_prog_name "ABC" $v_seq_num
There are two types of error I am getting:
1. When I am submitting it from Order Management Super User it is giving error
Please enter a valid responsibility. The responsibility Order Management Super User does not exist or is not active. Check that the correct application short name is specified for your responsibility.
2. When I am submitting it from some custom responsibility I am getting following error
Cannot submit concurrent request for program APPS/APPS0
Check if the concurrent program is registered with Application Object Library.
Check if you specified the correct application short name for your concurrent program.
Cannot submit your concurrent request
Please suggest me the possible cause of the error.
Thanks
VishalakshaIt is solved now. In the script I had p_data_file_path=$10 instead of p_conc_prog_name=${10}. This is the reason I was not getting the right concurrent program name as input parameter.
Thanks
Vishalaksha -
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> -
Error with dbms_scheduler and shell script execution
Hi,guys.
I have an issue with a dbms_scheduler and a shell script execution. So, the shell script as it self works fine, when i'm executing ./test.sh all process is running, but when i'm executing the script from dbms_scheduler it just simply doesn't work. Actually it works, but some of executable information in sh doesn't work, seems it just jump over of the part of the script. Sendmail part is running, maybe there is problem with rman script as it self?
DB version: 10g
And my scripts:
Shell scripts (permisons 755):
#!/bin/ksh
export PATH=/home/oracle/product/asm_home/bin:/home/oracle/product/db_home/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/oracle/bin:/usr/bin/X11:/sbin:.
export ORACLE_BASE=/home/oracle/product
export ORACLE_SID=zabbix
export ORACLE_HOME=/home/oracle/product/db_home
${ORACLE_HOME}/bin/rman<<EOF
connect target /
run {backup recovery area delete all input;}
EOF
{ echo "From:[email protected]"
echo "To: [email protected]"
echo "Subject: Recovery area"
echo 'Content-Type: text/html'
echo
echo '<html><body><table border="1" cellspacing="1">'
echo '<tr><td><b>Process</b></td><td><b>Statuss</b></td></tr>'
echo "<tr><td>RMAN</td><td><b>Works</b></td></tr>"
echo "</table></body></html>"
} | sendmail -tIn the first part i'm exporting all of the important stuff for oracle, then I call RMAN with specific atributes. And then there is just simply sendmail functionality inside script to represent if script works (for now).
And below pl/sql script:
begin
DBMS_SCHEDULER.CREATE_JOB
job_name => 'FLASH_RECOVERY',
job_type => 'EXECUTABLE',
job_action => '/home/oracle/backup/test.sh',
start_date => sysdate,
job_class => 'DEFAULT_JOB_CLASS',
enabled => TRUE,
auto_drop => FALSE,
comments => 'FLASH RECOVERY USAGE AREA backup and delete'
END;
/And this job execution:
begin
DBMS_SCHEDULER.run_job (job_name =>'FLASH_RECOVERY',use_current_session => TRUE);
end;What can be wrong? For me, I think it's something with permisions.
I hope you got my idea and could help me.
Tom
Edited by: safazaurs on 2013.18.2 22:16There is no error, i just receive all the time e-mail, seems it jumps over rman. I tried almost everything and still couldn't get result as i want. And, if i'm running script from command line - it works. Rman calls, and starts to recover archivelogs.
-
Error Using dbms_scheduler to call a shell script
Hi,
I have been assigned a job of sending emails through unix utility(Mailx), based on certain activity in database.
Email needs to be sent on insert/update of a column in one of the database tables.
I am trying to use the block below to call the unix script responsible to send mails:
begin
dbms_scheduler.create_job
job_name => 'TPP_SEND_EMAIL_JOB',
job_type => 'EXECUTABLE',
job_action => '/opt/ENV/code/BIL/users/usrbil01/Hemz/sndmailscrpt.ksh',
repeat_interval => 'FREQ=MINUTELY; INTERVAL=30',
enabled => true,
comments => 'Send Email on ISU update'
end;
sndmailscrpt.ksh: Script to send email is embedded within the shell script
I am getting the below error when i try to run the job using 'exec dbms_scheduler.run_job('TPP_SEND_EMAIL_JOB');'
Error:
ORA-27370: job slave failed to launch a job of type EXECUTABLE
ORA-27300: OS system dependent operation:accessing extjob wrapper failed with status: 2
ORA-27301: OS failure message: No such file or directory
ORA-27302: failure occurred at: sjsec 3
ORA-06512: at "SYS.DBMS_ISCHED", line 150
ORA-06512: at "SYS.DBMS_SCHEDULER", line 441
ORA-06512: at line 1
I am not aware of any db related permissions that needs to be given, is this related to that or is there somethin i need to do for execution to be successfull
Request you to let me know the exact solution and also the steps i need to take in order to ensure successfull execution of this script.
Please also let me know if there is any other way wherein i can call a unix script from a database trigger on run time(i.e, whenever insert/update on a particular column in database)
Regards,
HemanthHi All,
Thank you for your inputs.
I am now pressed to explore the option of utl_mail as this dircetly sends mail from database. This is suggested as an option for my delivery now.
I am able to install utl_mail and send a mail using the block below:
begin
utl_mail.send(
sender => '[email protected]',
recipients => '[email protected]',
subject => 'Testing utl_mail',
message => 'The receipt of this email is checking on working of UTL_MAIL '
exception
when others then
dbms_output.put_line('error: '||sqlerrm);
end;
The block gets executed successfully, but i have not received a mail yet, is there a table or oracle log from where i can trace the delivery status for the mai, or if the mail is successfully sent too?
I have heard from users in this forum for support of mime type "HTML", Should i pass the whole html body in the *'message'* input parameter here or can i pass a html template name with path present else where?
Please do assist me in this regard.
Regards,
Hemanth -
Error reading data from Infocube using shell script.
Dear all ,
I am facing a problem while reading data from an infocube using a shell script.
The details are as follows.
One of the shell script reads the data from the infocube to extract files with the values.
The tables used for extraction by the shell script are :
from SAPR3."/BIC/F&PAR_CUBE.COPA" FCOPA,
SAPR3."/BIC/D&PAR_CUBE.COPAU" COPAU,
SAPR3."/BIC/D&PAR_CUBE.COPAP" COPAP,
SAPR3."/BIC/D&PAR_CUBE.COPA1" CCPROD,
SAPR3."/BIC/D&PAR_CUBE.COPA2" CCCUST,
SAPR3."/BIC/D&PAR_CUBE.COPA3" COPA3,
SAPR3."/BIC/D&PAR_CUBE.COPA4" COPA4,
SAPR3."/BIC/D&PAR_CUBE.COPA5" COPA5,
SAPR3."/BIC/MCCPROD" MCCPROD,
SAPR3."/BIC/SCCPROD" SCCPROD,
SAPR3."/BIC/MCCCUSTOM" MCCCUSTOM,
SAPR3."/BIC/SCCCUSTOM" SCCCUSTOM,
SAPR3."/BIC/SORGUNIT" SORGUNIT,
SAPR3."/BIC/SUNIMOYEAR" SUNIMOYEAR,
/* SAPR3."/BI0/SFISCPER" SFISCPER, */
SAPR3."/BI0/SREQUID" SREQUID,
SAPR3."/BI0/SCURRENCY" SCURRENCY,
SAPR3."/BIC/SSCENARIO" SSCENARIO,
SAPR3."/BIC/SSOURCE" SSOURCE
The problem is that the file generation by this script (after reading the data from teh infocube) is taking an unexpected time of 2 hours which needs to be maximum 10 mins only.
I used RSRV to get the info about these tables for the infocube:
Entry '00046174', SID = 37 in SID table is missing in master data table /BIC/MCUSLEVEL2
Entry '00081450', SID = 38 in SID table is missing in master data table /BIC/MCUSLEVEL2
and so on for SID = 39 and SID = 35 .
Checking of SID table /BIC/SCUSLEVEL2 produced errors
Checking of SID table /BIC/SCUSLEVEL3 produced errors
Can you please let me know if this can be a reason of delay in file generation (or reading of data from the infocube).
Also , Please let me know how to proceed with this issue.
Kindly let me know for more information, if required.
Thanks in advance for your help.
-ShalabhHi ,
In continuation with searching the solution to the problem , I could manage to note a difference in the partition of the Fact table of the infocube.
Using SE14 -> Storage Parameters, I could find the partition done for the fact table as :
PARTITION BY: RANGE
COLUMN_LIST: KEY_ABACOPA
and subsequently there are partitions with data in it.
I need to understand the details of these partitions .
Do they correspond to each requests in the infocube(which may not be possible as there are 13 requests in infocube and much more partitions).
Most importantly, since this partition is observed for this onfocube only and not for other infocubes, it is possible that it can be a reason for SLOW RETRIEVAL of data from this ionfocube( not sure since the partition is used to help in fast retreival of data from the infocubes).
Kindly help.
Thanks for your co-operation in advance.
-Shalabh -
Random SP2 error when starting oracle process through SHELL script
Hi All,
I am trying to process data in n-Number of tables through a package. The package is called through a shell script to create start data processing. All calls to the package are in a sql script which is basically exec calls-
exec package.process ('T1','some param');
exec package.process ('T1','some param');
exec package.process ('T..n','some param');
I have a shell script which I use to execute commands from the sql script. There is a reason behind using shell script. For some strange reason, I keep on getting -
ERROR: logon denied - check for valid user with valid privileges
SP2-0640: Not connected
SP2-0641: "EXECUTE" requires connection to server
SP2-0640: Not connected
for some EXEC calls. Problem is, errors are generated at random. So in one run, I get error for T10,T11 and then in next run I might get for some other tables.
However, when I am running the sql script from the sql prompt, all calls to the package are executed without any problem.
This makes me think, it is something to do with the way database connection being initiated through UNIX.
Has anyone faced similar issue? Your help/gudence is much appreciated.
DB: Oracle 10.2.0.5
OS: SUN Solaris 10
Thanks in advance.Login credentials are provided inside the shell script.
I did put a sleep(10) after EOF but no help. As mentioned if I run script file from sql promt, it runs without any hiccup. So it is the connection through the UNIX that is causing issue.
As pointed out by Sybrand, I agree that it does not make a sense to connect and commit after every sql statement. So decided to change the shell script and so far, the result from my initial tests on a sample data is quite encouraging. Hopefully I will have a solution.
But it will be nice to know why SHELL is doing what it is doing!!
Legacy prog are sometime big time eye-openers..;) -
How to get ORA errors in alertlog file using shell script.
Hi,
Can anyone tell me how to get all ORA errors between two particular times in an alertlog file using shell script.
ThanksHi,
You can define the alert log as an external table, and extract messages with SQL, very cool:
http://www.dba-oracle.com/t_oracle_alert_log_sql_external_tables.htm
If you want to write a shell script to scan the alert log, see here:
http://www.rampant-books.com/book_2007_1_shell_scripting.htm
#!/bin/ksh
# log monitoring script
# report all errors (and specific warnings) in the alert log
# which have occurred since the date
# and time in last_alerttime_$ORACLE_SID.txt
# parameters:
# 1) ORACLE_SID
# 2) optional alert exclusion file [default = alert_logmon.excl]
# exclude file format:
# error_number error_number
# error_number ...
# i.e. a string of numbers with the ORA- and any leading zeroes that appear
# e.g. (NB the examples are NOT normally excluded)
# ORA-07552 ORA-08006 ORA-12819
# ORA-01555 ORA-07553
BASEDIR=$(dirname $0)
if [ $# -lt 1 ]; then
echo "usage: $(basename) ORACLE_SID [exclude file]"
exit -1
fi
export ORACLE_SID=$1
if [ ! -z "$2" ]; then
EXCLFILE=$2
else
EXCLFILE=$BASEDIR/alert_logmon.excl
fi
LASTALERT=$BASEDIR/last_alerttime_$ORACLE_SID.txt
if [ ! -f $EXCLFILE ]; then
echo "alert exclusion ($EXCLFILE) file not found!"
exit -1
fi
# establish alert file location
export ORAENV_ASK=NO
export PATH=$PATH:/usr/local/bin
. oraenv
DPATH=`sqlplus -s "/ as sysdba" <<!EOF
set pages 0
set lines 160
set verify off
set feedback off
select replace(value,'?','$ORACLE_HOME')
from v\\\$parameter
where name = 'background_dump_dest';
!EOF
`
if [ ! -d "$DPATH" ]; then
echo "Script Error - bdump path found as $DPATH"
exit -1
fi
ALOG=${DPATH}/alert_${ORACLE_SID}.log
# now create awk file
cat > $BASEDIR/awkfile.awk<<!EOF
BEGIN {
# first get excluded error list
excldata="";
while (getline < "$EXCLFILE" > 0)
{ excldata=excldata " " \$0; }
print excldata
# get time of last error
if (getline < "$LASTALERT" < 1)
{ olddate = "00000000 00:00:00" }
else
{ olddate=\$0; }
errct = 0; errfound = 0;
{ if ( \$0 ~ /Sun/ || /Mon/ || /Tue/ || /Wed/ || /Thu/ || /Fri/ || /Sat/ )
{ if (dtconv(\$3, \$2, \$5, \$4) <= olddate)
{ # get next record from file
next; # get next record from file
# here we are now processing errors
OLDLINE=\$0; # store date, possibly of error, or else to be discarded
while (getline > 0)
{ if (\$0 ~ /Sun/ || /Mon/ || /Tue/ || /Wed/ || /Thu/ || /Fri/ || /Sat/ )
{ if (errfound > 0)
{ printf ("%s<BR>",OLDLINE); }
OLDLINE = \$0; # no error, clear and start again
errfound = 0;
# save the date for next run
olddate = dtconv(\$3, \$2, \$5, \$4);
continue;
OLDLINE = sprintf("%s<BR>%s",OLDLINE,\$0);
if ( \$0 ~ /ORA-/ || /[Ff]uzzy/ )
{ # extract the error
errloc=index(\$0,"ORA-")
if (errloc > 0)
{ oraerr=substr(\$0,errloc);
if (index(oraerr,":") < 1)
{ oraloc2=index(oraerr," ") }
else
{ oraloc2=index(oraerr,":") }
oraloc2=oraloc2-1;
oraerr=substr(oraerr,1,oraloc2);
if (index(excldata,oraerr) < 1)
{ errfound = errfound +1; }
else # treat fuzzy as errors
{ errfound = errfound +1; }
END {
if (errfound > 0)
{ printf ("%s<BR>",OLDLINE); }
print olddate > "$LASTALERT";
function dtconv (dd, mon, yyyy, tim, sortdate) {
mth=index("JanFebMarAprMayJunJulAugSepOctNovDec",mon);
if (mth < 1)
{ return "00000000 00:00:00" };
# now get month number - make to complete multiple of three and divide
mth=(mth+2)/3;
sortdate=sprintf("%04d%02d%02d %s",yyyy,mth,dd,tim);
return sortdate;
!EOF
ERRMESS=$(nawk -f $BASEDIR/awkfile.awk $ALOG)
ERRCT=$(echo $ERRMESS|awk 'BEGIN {RS="<BR>"} END {print NR}')
rm $LASTALERT
if [ $ERRCT -gt 1 ]; then
echo "$ERRCT Errors Found \n"
echo "$ERRMESS"|nawk 'BEGIN {FS="<BR>"}{for (i=1;NF>=i;i++) {print $i}}'
exit 2
fi -
Dbms_scheduler error when running shell script
I have 2 shell scripts.
ftp_file_from_apps.sh copies a file from one server to antoher. It receives an input which is the name of the file to be copied.
scp_file_to_dbs.sh does a secure copy. Copying the file fo anther directory on the same server.
ftp_file_from_apps.sh
~~~~~~~~~~~~~~~~~
#!/bin/bash
sftp applprod@<host.domain>:/<source_directory>/$1
/<destination_directory>/$2
scp_file_to_dbs.sh
~~~~~~~~~~~~~
scp -r /<source_directory>/$1 <host.domain>:/<destination_directory>/$1
Both of these scripts works 100% when i run them from os level:
ftp_file_from_apps.sh xxx.out xxx.pdf
scp_file_to_dbs.sh xxx.pdf
the problem is when i run them with dbms_scheduler:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
v_file_name and v_file_name_pdf is varchar2(20) with values assigned.
begin
dbms_scheduler.create_job(
job_name=>'FTP_FILE_FROM_APPS',
job_type=>'executable',
job_action=>'/<directory_of_script>/ftp_file_from_apps.sh
v_file_name v_file_name_pdf',
enabled=>TRUE
end;
begin
dbms_scheduler.create_job(
job_name=>'SCP_FILE_TO_DBS',
job_type=>'executable',
job_action=>'/<directory_of_script>/scp_file_to_dbs.sh
v_file_name_pdf',
enabled=>TRUE
end;
ftp_file_from_apps.sh error:
ORA-27369: job of type EXECUTABLE failed with exit code: No such file or directory
scp_file_to_dbs.sh error:
ORA-27369: job of type EXECUTABLE failed with exit code: No such file or directory
I tripple checked my <directory_of_script>.
Please help.
Regards
JohnHi,
What Paul means is that you should not be using
job_action=>
'/<directory_of_script>/scp_file_to_dbs.sh v_file_name_pdf',
Instead job_action should be the name of the shell script only. So you should have
job_action=>
'/<directory_of_script>/scp_file_to_dbs.sh',
number_of_arguments=>1
enabled=>false
And then make a call to dbms_scheduler.set_job_argument_value (for each argument) and finally a call to dbms_scheduler.enable.
Hope this helps,
Ravi. -
Unix Shell Script -- ORA-00905 error in pl/sql
Below is my unix shell script .... in which i am trying to caluclate difference between time stamps ..... i am getting a severe error when i run --- ORA-00905: missing keyword ( included it bottom of this post )
please look into this and let me know where to correct ....
much appreciated in adv
~~~~~~~~~~~~~~~~~~~~~START of Script~~~~~~~~~~~~~~~~~~~~
#!/bin/ksh
export readTime checkTime timeDiff
# Get initial Time
readTime=`sqlplus -s scott/tiger@database <<EOF
whenever sqlerror exit 1
set escape off
set head off
set verify off
select SYSTIMESTAMP from dual;
EOF
`
echo "readTime value is : $readTime"
# Get end of time
checkTime=`sqlplus -s scott/tiger@database <<EOF
whenever sqlerror exit 1
set escape off
set head off
set verify off
select SYSTIMESTAMP from dual;
EOF
`
echo "value of checkTime : $checkTime"
# calculate time diff
timeDiff=`sqlplus -s scott/tiger@database <<EOF
whenever sqlerror exit 1
set escape off
set head off
set verify off
select CAST(TO_DATE('$time2','''YYYY\/MM\/DD:HH24:MI:SS'''))-CAST(TO_DATE('$VAR1','YYYY-MM-DD:HH24:MI:SS')) from dual;
EOF
`
echo "value of timeDiff : $timeDiff"
~~~~~~~~~~~~~~~~~OUTPUT here ~~~~~~~~~~~~~~~~~~~~~~~
readTime value is :
02-DEC-05 12.07.53.779328 AM -06:00
value of checkTime :
02-DEC-05 12.07.54.013613 AM -06:00
value of timeDiff : 02-DEC-05 12.07.54.013613 AM -06:00','''YYYY\/MM\/DD:HH24:MI:SS'''))-CAST(TO_DATE('
ERROR at line 2:
ORA-00905: missing keywordYou didn't specify if you want a total time for a portion of a shell script, or the whole script in general. If you only want to know the time of the whole shell script, just reference the linux/unix built-in variable ${SECONDS}. This variable is reset for each PID.
I usually add these lines to the bottom of long running shell scripts (just before an exit code):
~~~~~~~~~~~~~~~~~~~~~~~~~
((TIME = ${SECONDS} / 60))
echo "Script ran for ${TIME} minutes. (${SECONDS} seconds total.)
~~~~~~~~~~~~~~~~~~~~~~~~~
Like I said, ${SECONDS} starts ticking from 0 when you start the script, so no need to export the variable, just reference it. The nice part is that you don't have to bother getting into sqlplus and hit the database. -
how to run 3 job(a,b,c) parallel in unix shells script and after will complete d will start and we have to handle the error also
032ee1bf-8007-4d76-930e-f77ec0dc7e54 wrote:
how to run 3 job(a,b,c) parallel in unix shells script and after will complete d will start and we have to handle the error also
Please don't overwhelm us with so many details!
Just off the top of my head ... as a general approach ... something like
nohup proca
nohup procb
nohup procc
while (some condition checking that all three procs are still running ... maybe a ps -ef |grep )
do
sleep 2
done
procd
But, we'd really need to know what it is you are really trying to accomplish, instead of your pre-conceived solution.
Maybe you are looking for
-
Cache and/or Connection problems under load
I have a Kodo web app that's been running just fine in production for many months now. However, recently the web traffic has shot up by a huge amount, literally overnight. But unfortunately, it's caused the app to fail very ungracefully under the str
-
i bought an iphone5 from saudi arabia,can i use it in india?is there any requirements i have to take?many one are saying i need to unlock it,please any one help me,i did'nt activate my phone yet.
-
Re: Acer Aspire Switch 10 - Proprietary Charging Port to micro-USB adapter
I have a high power power bank capable of charging via both usb and 19v. Included were adapter cables that fit many devices that don't charge via usb. However none fit an acer switch 12.Any ideas?
-
Proposed delivery quantity in inbound delivery vs purchase schedule line
Hello all I have got a doubt when creating inbound delivery for an item of purchase schedule line. I want to know how to get the proposed delivery quantity equal to the quantity of all schedule lines until today. For example I have got 4 schedule lin
-
Convert square wave to saw tooth wave
Hi all i need your help. I have a square wave data in for of an array. Can any one of you suggest me a method to convert this data into saw tooth data. What i mean is that i want to convert a square wave to a saw tooth wave with minimum value 0. Your