Visit Our UNIX and Linux User Community


Sql plus problem in unix


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sql plus problem in unix
# 1  
Old 07-24-2009
Sql plus problem in unix

I am getting sqlplus not found error while trying to connect to database from unix.
my sql plus is present at the location
/opt/dbms/app/oracle/product/10.2_Client
and i gave in shell script as below.
ORACLE_HOME=/opt/dbms/app/oracle/product/10.2_Client
export ORACLE_HOME
Please help me with this..am i missing something here?
# 2  
Old 07-24-2009
What is the result of the
# which sqlplus
command ?
And
# echo $ORACLE_HOME
?
For Oracle 9.2 this is the path (on my system):
/usr/oracle/app/oracle/product/9.2/bin/sqlplus
Mind the bin directory.
# 3  
Old 07-24-2009
type..

Code:
whereis sqlplus
or 
which sqlplus

# 4  
Old 07-24-2009
Sorry for the confusion.
It is working finw now..i gave it as follows.

ORACLE_HOME=/opt/dbms/app/oracle/product/10.2_Client
export ORACLE_HOME
$ORACLE_HOME/bin/sqlplus -s ........
# 5  
Old 07-24-2009
Code:
. oraenv

would normally be used to set up the environment.
# 6  
Old 07-24-2009
Hi rdhanek,

export ORACLE_HOME and PATH vraibles as

ORACLE_HOME=opt/dbms/app/oracle/product/10.2_Client ;
export ORACLE_HOME
PATH=${ORACLE_HOME}/bin:${PATH} ;
export PATH

Now try
# 7  
Old 07-24-2009
Hi folks,

I don't really understand why you need to do that.

Code:
head -20 /usr/local/bin/oraenv
 
#!/bin/sh
#
# $Header: oraenv.sh.pp 16-jun-2005.10:46:09 mlfallon Exp $ oraenv.sh.pp Copyr (c) 1991 Oracle
#
###################################
#
# usage: . oraenv
#
# This routine is used to condition a user's environment for access to
# an ORACLE database. It will prompt for the value of the new SID unless
# the variable ORAENV_ASK is set to NO, in which case it will use the
# current value of ORACLE_SID.
# The character "*" denotes a null SID.
#
# NOTE:         Due to constraints of the shell in regard to environment
# -----         variables, the command MUST be prefaced with ".". If it
#               is not, then no permanent change in the user's environment
#               can take place.
#
#####################################

I'm not sure I agree with this statement, though!!
Quote:
Due to constraints of the shell in regard to environment variables

Previous Thread | Next Thread
Test Your Knowledge in Computers #564
Difficulty: Medium
The negation operator is a null task operator not a unary operator.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How can i run sql queries from UNIX shell script and retrieve data into text docs of UNIX?

Please share the doc asap as very urgently required. (1 Reply)
Discussion started by: 24ajay
1 Replies

2. UNIX for Dummies Questions & Answers

unix script with SQL statement problem

Hello, I have a script to get the information from database, however, it's look like the loop is not work, can someone help? :confused: echo Input file list to check: read filelist for file in 'cat $filelist.txt' do echo "select FILENAME from FILE_TABLE where filename like '${file}'%;" >>... (9 Replies)
Discussion started by: happyv
9 Replies

3. Shell Programming and Scripting

problem in SQL query

I used the following code code select * from tablename where columnname Instead of printing the expected output it prints all the files in the present directory since there is a "*" in the code. Is there any way to overcome the problem? Thanks Ananth (2 Replies)
Discussion started by: Ananthdoss
2 Replies

4. Shell Programming and Scripting

How to use sql data file in unix csv file as input to an sql query from shell

Hi , I used the below script to get the sql data into csv file using unix scripting. I m getting the output into an output file but the output file is not displayed in a separe columns . #!/bin/ksh export FILE_PATH=/maav/home/xyz/abc/ rm $FILE_PATH/sample.csv sqlplus -s... (2 Replies)
Discussion started by: Nareshp
2 Replies

5. Shell Programming and Scripting

Problem in sql loader

Hi Frnds, I wanto load the data thats in data file with comma(,) delimited. it throw this errors SQL*Loader-951: Error calling once/load initialization ORA-00604: error occurred at recursive SQL level 1 ORA-00054: resource busy and acquire with NOWAIT specified Plz look at my file... (3 Replies)
Discussion started by: Gopal_Engg
3 Replies

6. UNIX for Dummies Questions & Answers

Execute PL/SQL function from Unix script (.sql file)

Hi guys, I am new on here, I have a function in oracle that returns a specific value: create or replace PACKAGE BODY "CTC_ASDGET_SCHED" AS FUNCTION FN_ASDSCHEDULE_GET RETURN VARCHAR2 AS BEGIN DECLARE ASDSchedule varchar2(6); ASDComplete... (1 Reply)
Discussion started by: reptile
1 Replies

7. Shell Programming and Scripting

unix variables from sql / pl/sql

How do I dynamically assign the below output to unix shell variables so I can build a menu in a shell script? Example: var1 = 1 var2= SYSTEM var3 = 2 var4= UNDOTBS1 and so on, then in the shell script I can use the variables to build a menu. set serveroutput on declare... (2 Replies)
Discussion started by: djehres
2 Replies

8. Shell Programming and Scripting

sql query problem

Hi, I am passing an argument for the script and that argument values should exist in database. bill_period_input="'""$1""'" bill_period=`sqlplus uname/pwd@dbname <<eof! set verify off set heading off set feedback off select bill_period from bill_period_ref where... (4 Replies)
Discussion started by: ss_ss
4 Replies

9. Shell Programming and Scripting

pl/sql in unix problem

hi all i have written this small code. sqlplus $schema_name/$passwrd@$instance <<eof set serveroutput on; declare lv_count pls_integer; lv_option varchar2(20); begin select count(*) into lv_count from all_objects where upper(object_name)=upper('$temp_file1');... (1 Reply)
Discussion started by: infyanurag
1 Replies

10. UNIX for Dummies Questions & Answers

Problem with while loop and SQL

Connected to oracle database sqlplus << EOF $CONNECTSTR set heading off set trimspool on set feedback off select ID,DATE from sysadm.TEST where VALUE = 'A' order by ID; value_id = ID value_date = DATE EOF 1. Is it possible to reference the values, ID,DATE in unix shell script. 2.... (20 Replies)
Discussion started by: nandajk
20 Replies

Featured Tech Videos