Database connection from korn shell prompt


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Database connection from korn shell prompt
# 1  
Old 10-08-2010
Database connection from korn shell prompt

Hello,

I want to connect to Database through shell command line.
Here is my command from putty,
Code:
$ sqlplus -S ora/ora@ORA

But I am not able to connact to database.
If this command succed, what is the expected output on shell prompt?
Could you please let me know how to connact to database from shell prompt?
Thanks in advance.Smilie
# 2  
Old 10-08-2010
Don't use -S flag.

Code:
sqlplus ora/ora@ORA


Note: Make sure that you have set the oracle environment variables.

Code:
echo $ORACLE_HOME

(optional)
Code:
echo $TNS_ADMIN 
echo $LD_LIBRARY_PATH

If it still fails, what is the error msg?
# 3  
Old 10-08-2010
Thanks for reply.
Here is my code,
Code:
DB=$(sqlplus $USERID/$PASSWORD@$DATABASE << EOF 
set head off 
set feed off 
set serveroutput on
WHENEVER SQLERROR EXIT;
/ 
EOF)

Itried to create table using
Code:
create table TEST (Name Varchar, Number Varchar);

But getting error as,
Code:
SQL> SQL> SQL> SQL> SQL> create table TEST (Name Varchar, Number Varchar)
                               *
ERROR at line 1:
ORA-00906: missing left parenthesis

Could u tell me that how I can create table through shell script?
thanks in advance.
# 4  
Old 10-08-2010
you have mentioned previously that you are connecting through command line.

anyways, Did you try this thread posted by you - Create DB table through shell script


what problem you are facing?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to fix connection to Oracle database through shell script?

I have a question regarding how to connect to Oracle Database through shell script. 1. If I want call a stored procedure on Linux server as this, it works. $sqlplus /nolog SQL*Plus: Release 12.1.0.2.0 Production on Fri Jun 12 14:49:49 2015 Copyright (c) 1982, 2014, Oracle. All rights... (2 Replies)
Discussion started by: duke0001
2 Replies

2. Shell Programming and Scripting

RFC - Korn shell prompt

Hi, I am learning shell scripting for the first time. I use AT&T Korn Shell, Version AJM 93u+ 2012-08-01, compiled from source on NetBSD. So far I have managed to set up what I think is a useful and pleasing shell prompt, which can be seen in the image attached to this post. The prompt is... (2 Replies)
Discussion started by: gezley
2 Replies

3. Shell Programming and Scripting

Two-line prompt using Korn

I'm attempting to set up a two-line prompt using Korn. This is what I've set up in .kshrc PS1='$(print -n "`logname`@`hostname`:";if ] then; print -n "~${PWD#$HOME}"; else; print -n "$PWD";fi;print "\n$ ")' And in .profile, ENV="$HOME/.kshrc"; export ENV The hosts that in use are... (10 Replies)
Discussion started by: capnpepper
10 Replies

4. Shell Programming and Scripting

Korn Script to connect and query oracle database

I've been sent the following script to finish. It's supposed to connect to an oracle database, query it, and send an email if the query result value is one or more. Currently it isn't connecting properly, just giving the following error: ERROR: ORA-01017: invalid username/password; logon denied... (2 Replies)
Discussion started by: jackmorgan2007
2 Replies

5. Shell Programming and Scripting

Korn shell program to parse CSV text file and insert values into Oracle database

Enclosed is comma separated text file. I need to write a korn shell program that will parse the text file and insert the values into Oracle database. I need to write the korn shell program on Red Hat Enterprise Linux server. Oracle database is 10g. (15 Replies)
Discussion started by: shellguy
15 Replies

6. Shell Programming and Scripting

MKS KORN SHELL WONT EXECUTE from windows command prompt

Can anybody help me with this small script , the script works fine and launches the IE from c:\documents and settings \test\my documents>ksh prompt $RunURL1.sh this scitpt works and launches the ie from ksh , but when i schedule it to run the script then i get the error box saying command:1... (2 Replies)
Discussion started by: venu
2 Replies

7. Shell Programming and Scripting

Unix Korn Shell script on Solaris to DB2 UDB LUW database

I am rather new to korn shell scripting and attempting to write a Unix script that would detach, attach a range partition table in DB2 UDB LUW database. This would be a job scheduled in control M that reads in an input file with 5 parameters passed to it from the application. I don't have much... (1 Reply)
Discussion started by: tjhanso
1 Replies

8. AIX

korn prompt autocompletion possible ?

My client`s system is an AIX 4.2 and using the Kron shell. I was just wondering if it is possible to have the prompt autocompletion enabled on it without changing shell version. By autocompletion, I mean to automatically complete the filenames or directories we type in using the Tab key. (2 Replies)
Discussion started by: Browser_ice
2 Replies

9. Shell Programming and Scripting

Connection to database through shell script

Hi when i am calling the shell script with two parameter like id and date it works fine.But the same shell script is call by java application it gives the error as shown below Thu Jan 8 04:13:22 EST 2009|The Get Segment Process Failed: SP2-0306: Invalid option. Usage: CONN where <logon>... (1 Reply)
Discussion started by: ravi214u
1 Replies

10. Shell Programming and Scripting

Connect to sybase database using Korn shell script

Hi, Can anyone please give me a script or let me know how to connect to a sybase database and execute a query using Korn shell scripts.Am new to Unix but i need to do this ASAP. Please help. Thanks, Gops (7 Replies)
Discussion started by: bhgopi
7 Replies
Login or Register to Ask a Question