Sponsored Content
Full Discussion: db connection
Top Forums Shell Programming and Scripting db connection Post 302525916 by ozum on Sunday 29th of May 2011 04:53:22 PM
Old 05-29-2011
db connection

Hi,
I'm trying to write a script which will run a select on db.
Code:
#!/usr/bin/ksh
SQL_INPUT_FILE=file_name.sql
SQL_OUTPUT_FILE=output.txt
MANPATH=/usr/share/man:/opt/SUNWspro/man:/usr/local/man
PATH=/opt/oracle/product/11g/bin:/sbin:/usr/sbin:/usr/ccs/bin:/usr/bin:/sbin:/opt/oracle/product/11g/OPatch:/usr/local/bin:/u
sr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/bin
NLS_LANG=AMERICAN_AMERICA.UTF8
ORACLE_SID=ora11g
ORACLE_TERM=xterm
ORACLE_HOME=/home/oracle/product/11g
export ORACLE_SID
export NLS_LANG
export ORACLE_HOME
export PATH
export ORACLE_TERM

/home/oracle/product/11g/bin/sqlplus user/pass@ora11g < $SQL_INPUT_FILE  > $SQL_OUTPUT_FILE

however the output file turns out such that:
Code:
SQL*Plus: Release 11.1.0.7.0 - Production on Sun May 29 23:43:14 2011

Copyright (c) 1982, 2008, Oracle. All rights reserved.

ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified


Enter user-name: SP2-0306: Invalid option.
Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER|SYSASM}]
where <logon> ::= <username>[/<password>][@<connect_identifier>] [edition=value] | /
Enter user-name: SP2-0306: Invalid option.
Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER|SYSASM}]
where <logon> ::= <username>[/<password>][@<connect_identifier>] [edition=value] | /
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus

Can you help me?

Last edited by Scott; 05-29-2011 at 06:14 PM.. Reason: Code tags, please...
 

10 More Discussions You Might Find Interesting

1. Cybersecurity

FTP Connection

I just started a new job and inherited a Fedora core 3 server. I wanted to open the ftp ports and I wanted to verify this code before I mess things up. From my reading the two lines below should allow ftp access can anyone confirm my attempt. iptables -A INPUT -p tcp - sport 21 -m state - state... (0 Replies)
Discussion started by: mungaz
0 Replies

2. IP Networking

HOw to start a connection?

Hi, I understand assignment qns are not allowed. However, I need major help.. please teach me how to write a tcp/ip programme using C, wad are the websites that i can refer to? wad are the codes required for it? I have never done tcp/ip configurations before, and never learnt C before,... (13 Replies)
Discussion started by: microuniz
13 Replies

3. UNIX for Dummies Questions & Answers

ssh_exchange_identification: Connection closed by remote host Connection closed

Hi Everyone, Good day. Scenario: 2 unix servers -- A (SunOS) and B (AIX) I have an ftp script to sftp 30 files from A to B which happen almost instantaneously i.e 30 sftp's happen at the same time. Some of these sftp's fail with the following error: ssh_exchange_identification: Connection... (1 Reply)
Discussion started by: jeevan_fimare
1 Replies

4. UNIX for Advanced & Expert Users

Connection reset by peer..closing connection

Hello I'm facing the above problem while doing a performance run. I've a script which I'm launching from my windows desktop using mozilla. The script will invoke backend action on a Solaris host which in turn feeds the records to a driver located on a linux box(Cent OS). What's happening is... (1 Reply)
Discussion started by: subramanyab
1 Replies

5. Solaris

Solaris 10 ftp connection problem (connection refused, connection timed out)

Hi everyone, I am hoping anyone of you could help me in this weird problem we have in 1 of our Solaris 10 servers. Lately, we have been having some ftp problems in this server. Though it can ping any server within the network, it seems that it can only ftp to a select few. For most servers, the... (4 Replies)
Discussion started by: labdakos
4 Replies

6. Solaris

PC-X connection

Hi all, I have just installed SunOS 10 at the first PC and exceed (pc-x server) at the second. I'm trying to connect to the first pc via exceed softvare. After entering login and pass, the exceed window immidiate close without any errors (if CDE or JDS has been chosen). Via exceed working just... (0 Replies)
Discussion started by: Marauder62
0 Replies

7. AIX

IP connection

Hi, I have a server AIX 5.3 Few people have the root password and somebody used the root login to erase a file (command rm in the .sh_history of root). :mad: I would like to know if a file exist with what ip address has been connected. I want to find the guilty!!! :D Thanks guys (2 Replies)
Discussion started by: Castelior
2 Replies

8. UNIX for Advanced & Expert Users

How keep running a program n an another computer via a connection ssh when the connection is closed?

Hi everybody, I am running a program on a supercomputer via my personal computer through a ssh connection. My program take more than a day to run, so when I left work with my PC I stop the connection with the supercomputer and the program stop. I am wondering if someone know how I can manage... (2 Replies)
Discussion started by: TomTomGre
2 Replies

9. UNIX for Dummies Questions & Answers

DB connection

hi Im unable to find how this script in conencting to DB and which DB and job is scheduled in TWS to run this script. Any sugggestion where to look for or how to get information. please find below part of script for DB conenction. ##### SET VARIABLES ################## rundate=`date... (1 Reply)
Discussion started by: saif2825
1 Replies

10. Shell Programming and Scripting

Remote connection

How can we connect to remote computers with a bash script.? (1 Reply)
Discussion started by: diw10
1 Replies
getusershell(3C)					   Standard C Library Functions 					  getusershell(3C)

NAME
getusershell, setusershell, endusershell - get legal user shells SYNOPSIS
#include <unistd.h> char *getusershell(void); void setusershell(void); void endusershell(void); DESCRIPTION
The getusershell() function returns a pointer to a legal user shell as defined by the system manager in the file /etc/shells. If /etc/shells does not exist, the following locations of the standard system shells are used in its place: /bin/bash /bin/csh /bin/jsh /bin/ksh /bin/pfcsh /bin/pfksh /bin/pfsh /bin/sh /bin/tcsh /bin/zsh /sbin/jsh /sbin/pfsh /sbin/sh /usr/bin/bash /usr/bin/csh /usr/bin/jsh /usr/bin/ksh /usr/bin/pfcsh /usr/bin/pfksh /usr/bin/pfsh /usr/bin/sh /usr/bin/tcsh /usr/bin/zsh /usr/xpg4/bin/sh The getusershell() function opens the file /etc/shells, if it exists, and returns the next entry in the list of shells. The setusershell() function rewinds the file or the list. The endusershell() function closes the file, frees any memory used by getusershell() and setusershell(), and rewinds the file /etc/shells. RETURN VALUES
The getusershell() function returns a null pointer on EOF. BUGS
All information is contained in memory that may be freed with a call to endusershell(), so it must be copied if it is to be saved. SunOS 5.10 30 Aug 2004 getusershell(3C)
All times are GMT -4. The time now is 02:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy