Script fails with ORA-20000 when run with su


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script fails with ORA-20000 when run with su
# 1  
Old 07-13-2011
Script fails with ORA-20000 when run with su

Hi,

I have a ksh script that runs as root ans issues several commands as a user differente from root as 'su <user> -c "command" ' . It works fine except for one step where the command executes sql statements. That command fails with ORA-20000.
Now the strangest thing, if I place a read command just before that su everything works fine. I've tried a sleep 10/20/30 instead of read and it didn't work.
This is supposed to be an automation script so it must not pause waiting for input from the user.
Can someone help?

Thanks and kind regards
# 2  
Old 07-13-2011
ORA-20000 errors are generated by exceptions in stored procedures or other PL/SQL code. Check that first, maybe it's depending on some other background procedure. Also, are you reading from a file in a loop? Could be that the command for the database connection (sqlplus, or something else) is reading incorrect data from there.
# 3  
Old 07-13-2011
Hello Pludi,
the exception comes from a PL/SQL procedure. I wonder how, without changing anything else other than putting "read" before the su command that ultimately runs that PL/SQL makes it work. I was thinking of something in the line of "the read command flushes the DBMS_OUTPUT buffer" but I have nothing to support this nor do I have a way to control this behaviour.

Tnx
# 4  
Old 07-13-2011
Couldn't say without seeing the code. But you could try using read this way and see if it makes a difference:
Code:
read </dev/null

# 5  
Old 07-13-2011
Quote:
Originally Posted by pludi
Couldn't say without seeing the code. But you could try using read this way and see if it makes a difference:
Code:
read </dev/null

Didn't work!
# 6  
Old 07-14-2011
Quote:
Originally Posted by naf
Didn't work!
Try to put the code here.

Are you using DBMS_OUTPUT?

If so, try the following:
Code:
set serveroutput on size 1000000

By default, you can output 2000 characters, the maximum is 1,000,000.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace string works on command-line but fails when run from shell script

I wish to replace "\\n" with a single white space. The below does the job on command-line: $ echo '/fin/app/scripts\\n/fin/app/01/sql' | sed -e 's#\\\\n# #g'; /fin/app/scripts /fin/app/01/sql However, when i have the same code to a shell script it is not able to get me the same output:... (8 Replies)
Discussion started by: mohtashims
8 Replies

2. Red Hat

Ora-27603:ora-27626:

Hi, User claim that job is running slow from their end. I DBA found in database the below errors in alert log file. ORA-27603: Cell storage I/O error, I/O failed on disk o/192.168.10.3/RECO_DM01_CD_01_drm01 at offset 13335789568 for data length 1048576 ORA-27626: Exadata error: 2201 (IO... (2 Replies)
Discussion started by: Maddy123
2 Replies

3. Shell Programming and Scripting

Bash script fails when run as file

The following bash script fails with error message: "./phpquery_KNBB_html_reader.sh: line 65: syntax error near unexpected token `done'" when do ./<scriptname> in the shell. However when I copy-paste the entire contents of the file directly into a shell environment it runs ok returning the intended... (2 Replies)
Discussion started by: BurritoSolution
2 Replies

4. Shell Programming and Scripting

Script fails to run properly when run from CRONTAB

Hello all, I'm trying to write a script to gather and send data and it works just fine at the bash command line, but when executing from CRON, it does not run properly. My scripting skills are pretty limited and there's probably a better way, but as I said it works at the command line, but... (12 Replies)
Discussion started by: rusman
12 Replies

5. Shell Programming and Scripting

Need help! command working ok when executed in command line, but fails when run inside a script!

Hi everyone, when executing this command in unix: echo "WM7 Fatal Alerts:", $(cat query1.txt) > a.csvIt works fine, but running this command in a shell script gives an error saying that there's a syntax error. here is content of my script: tdbsrvr$ vi hc.sh "hc.sh" 22 lines, 509... (4 Replies)
Discussion started by: 4dirk1
4 Replies

6. UNIX for Advanced & Expert Users

grep all ORA errors except one ORA error

Hi - I am trying to grep all "ORA" errors in a log files.I have to grep all ORA errors except one error for example ORA-01653.How can exclude that error in "grep" command? In following "grep" command I want to exclude "ORA-01653" error grep -i ORA alert.log >>/tmp/ora_errors.txt ... (7 Replies)
Discussion started by: Mansoor8810
7 Replies

7. Solaris

maxuprc and maxusers - ORA-27300, ORA-27301, ORA-27302

Hi all, Am intermittently getting the following errors on one of my databases. Errors in file /oracle/HRD/saptrace/background/hrd_psp0_13943.trc: ORA-27300: OS system dependent operation:fork failed with status: 12 ORA-27301: OS failure message: Not enough space ORA-27302:... (1 Reply)
Discussion started by: newbie_01
1 Replies

8. Shell Programming and Scripting

crontab fails to run script

OS is Ubuntu 8.04.3. When I run the command: /usr/bin/syslogMailer < /etc/syslog.pipes/criticalMessagesFrom a bash shell it works and i receive an email as per the script however when run from crontab it does not work. Can anyone explain why and how to fix it? /usr/bin/syslogMailer... (4 Replies)
Discussion started by: jelloir
4 Replies

9. Shell Programming and Scripting

Running script that sends an html formatted email fails when its run as cronjob

Hi Im very new at working with unix and this problem I simply can not understand. I know there are a lot of threads about problems with shell scripts behaving differently when run from a terminal and from a cronjob. I have tried everything(almost) but I still havent cracked this problem. Im... (15 Replies)
Discussion started by: Nightowl
15 Replies

10. HP-UX

test program(dlopen) fails on hp but run well on solaris

Hi, I have a c test program which test dlopen call. This program run well on solaris but fails on hp-ux. The program load jvm library successfully on solaris. On hp-ux it displays error I compile this program as $cc -o testjvm testjvm.c What am I missing? I have tried... (2 Replies)
Discussion started by: shriashishpatil
2 Replies
Login or Register to Ask a Question