Sponsored Content
Top Forums Shell Programming and Scripting Connect Oracle using shell script at run time Post 302536960 by rwuerth on Wednesday 6th of July 2011 04:24:32 PM
Old 07-06-2011
Use the shell script to collect the user/pass info as follows:

Code:
 
echo "Enter username: "
read USER
echo "Enter password: "
read PASS
sqlplus -s /NOLOG << EOF
connect ${USER}/${PASS}
<add sqlplus commands here like 'set pagesize 60 trimspool on'>
<do your sql statements here 'select/insert/etc.'>
exit
EOF

If you need to, have the shell script also prompt for the Oracle Connection info. Here I assumed that the current $ORACLE_SID value is good.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

run shell script from oracle store procedure

hi, this is urgent..can i run a shell script from store procedure without using java. (8 Replies)
Discussion started by: arnabb4u
8 Replies

2. Shell Programming and Scripting

run oracle query remotly with shell script

hello how to run shell script to excute oracle queries on remote db ? i have tried as following sqlplus -s user/password@remote_server "select query;" but not working also this one sqlplus -s user/password@remote_server `select query;` not working :( i add this line to run another... (4 Replies)
Discussion started by: mogabr
4 Replies

3. Shell Programming and Scripting

run shell script connecting to oracle from crontab

Hi, I have problems with running shell script connecting to Oracle from the crontab. Here is the script: #!/sbin/sh ORACLE_HOME=/opt/oracle/10g/ export ORACLE_HOME if then echo "Source path is not specified" exit fi /opt/oracle/10g/bin/sqlplus user/pass@testdb << EOF truncate table... (6 Replies)
Discussion started by: apenkov
6 Replies

4. Shell Programming and Scripting

Connect to oracle db using shell script

Hi, I want to connect to oracle db using unix shell script. And i want to retrieve data from db through shell script. Please help me as soon as possible. Thanks, J.P. Das (1 Reply)
Discussion started by: jyotidas
1 Replies

5. Shell Programming and Scripting

Need help in writing a shell Script to connect to oracle instance

Please help me in writing a shell script which connects to a Oracle instance and tables to get the required information...:wall: (1 Reply)
Discussion started by: Dpu
1 Replies

6. Shell Programming and Scripting

Shell Script to connect to the oracle database

Hi Unix Gurus, I have a requirement to write a script, Oracle DB gets referesh every 6hrs, hence we need write a script to connect to the database , if it connects it should generate a file to proceed the next job application or when an error when connectiong to DB it should not generate any... (8 Replies)
Discussion started by: bshivali
8 Replies

7. Shell Programming and Scripting

How to connect to Oracle database using shell script?

Hi All, I am newbie to unix shell scripting. I want to connect to oracle database using shell script. I know how to connect DB using user name and password but my question is if my password is having '@' sign then how to connect. I have tried like below, cnt=`sqlplus -s /nolog << EOFSQL ... (3 Replies)
Discussion started by: pmotewar
3 Replies

8. Shell Programming and Scripting

How to Connect to Teradata and Run in Shell Script?

Hi Master, I need to create dan run script in linux to get data from teradata I did this ---------- Post updated at 02:28 AM ---------- Previous update was at 02:25 AM ---------- LOG_DIR="/home/"; OUTDIR="/home/"; SCRIPT_NAME=“test"; DUMPFILE="${OUTDIR}${SCRIPT_NAME}"_"$(date... (2 Replies)
Discussion started by: radius
2 Replies

9. UNIX for Beginners Questions & Answers

Shell Script to run in given time

Hi All, Would like to write a Script which will run between 11am to 3 pm and send the results to output.txt. Please suggest. (2 Replies)
Discussion started by: vasuvv
2 Replies

10. Shell Programming and Scripting

Not able to connect to Oracle server from shell script

Hi, I am facing an issue in connecting to database from Linux shell script. Here is my code export ORACLE_BASE=xxx export ORACLE_SID=xxx export ORACLE_HOME=xxxx DB_PATH=xxx/'yyy@yy' UserId=`sqlplus -s $DB_PATH <<EOF set head off feedback off select max(USER_ID)+1 from USERS;... (6 Replies)
Discussion started by: yuvi
6 Replies
DROPUSER(1)						  PostgreSQL Client Applications					       DROPUSER(1)

NAME
dropuser - remove a PostgreSQL user account SYNOPSIS
dropuser [ options... ] [ username ] DESCRIPTION
dropuser removes an existing PostgreSQL user and the databases which that user owned. Only users with usesuper set in the pg_shadow table can destroy PostgreSQL users. dropuser is a shell script wrapper around the SQL command DROP USER [drop_user(7)] via the PostgreSQL interactive terminal psql(1). Thus, there is nothing special about removing users via this or other methods. This means that the psql must be found by the script and that a database server is running at the targeted host. Also, any default settings and environment variables available to psql and the libpq front-end library do apply. OPTIONS
dropuser accepts the following command-line arguments: username Specifies the name of the PostgreSQL user to be removed. This name must exist in the PostgreSQL installation. You will be prompted for a name if none is specified on the command line. -e --echo Echo the queries that dropuser generates and sends to the server. -i --interactive Prompt for confirmation before actually removing the user. -q --quiet Do not display a response. createuser also accepts the following command-line arguments for connection parameters: -h host --host host Specifies the host name of the machine on which the server is running. If host begins with a slash, it is used as the directory for the Unix domain socket. -p port --port port Specifies the Internet TCP/IP port or local Unix domain socket file extension on which the server is listening for connections. -U username --username username User name to connect as (not the user name to drop) -W --password Force password prompt (to connect to the server, not for the password of the user to be dropped). ENVIRONMENT
PGHOST PGPORT PGUSER Default connection parameters DIAGNOSTICS
DROP USER All is well. dropuser: deletion of user "username" failed Something went wrong. The user was not removed. If there is an error condition, the backend error message will be displayed. See DROP USER [drop_user(7)] and psql(1) for possibilities. EXAMPLES
To remove user joe from the default database server: $ dropuser joe DROP USER To remove user joe using the postmaster on host eden, port 5000, with verification and a peek at the underlying query: $ dropuser -p 5000 -h eden -i -e joe User "joe" and any owned databases will be permanently deleted. Are you sure? (y/n) y DROP USER "joe" DROP USER SEE ALSO
createuser(1), DROP USER [drop_user(7)] Application 2002-11-22 DROPUSER(1)
All times are GMT -4. The time now is 08:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy