03-31-2006
Input to shell script
Hi,
I have 10 database instances runnning in one unix box. To connect to each database..i have to set the environment. I am trying to write a shell script to set my environment for database by just tying the oracle instance name
After logging into the unix machine... i want to type the oracle instacne name and the environment needs to be set for the typed oracle instance
How to pass an oracle instance name typed in the console to the shell script
any idea? how to do this
Is there any other way to do?
$/u01/oracle/ORACLEINSTANCENAME
Script:
FILE_LOCATION=/etc/oratab
dbname=awk 'BEGIN{FS=":"}{print $1}' < "$FILE_LOCATION" )
do
#echo "USER #$n = $dbname"
echo $dbname
if [$dbname= passed_db_name]
export ORACLE_SID=dbname
done
Many Thanks,
Last edited by castlerock; 03-31-2006 at 11:59 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hey, i'm trying to write a shell script which accepts:
operand operator operand
then, the script would see which operator it is (using case) and calculate it...
but i dont know how to do it correctly with $1 $2 $3... (eliminating accepting separate inputs) (1 Reply)
Discussion started by: quipy
1 Replies
2. UNIX for Dummies Questions & Answers
How do I prevent user input from being displayed in running script (e.g. when entering a password)?
Thanx,
Aaron (2 Replies)
Discussion started by: Spetnik
2 Replies
3. UNIX for Dummies Questions & Answers
Can anyone help me how to write a shell script which accepts input parameter. My requirement is as follows:
I need to run a shell script with a input parameter, and inside the script i will create a file with this input parameter name.
Please help me out to create such a shell script.
... (1 Reply)
Discussion started by: jhmr7
1 Replies
4. Shell Programming and Scripting
I have a program that can be run in terminal, when its run it either returns SSH OK or CRITICAL, how do i use the output in my script?
good
./check_sh myserver
SSH OK
bad
./check_sh myserver
CRITICAL
I want to store it in a variable btw, SSH OK will give the variable $SSH=1 and if its... (1 Reply)
Discussion started by: aspect_p
1 Replies
5. Shell Programming and Scripting
Hi all,
Here is my shell script
#!/bin/sh
echo "What is your name"
read name
echo "What is your surname"
read surname
echo "Your name is:${name} and your surname is:${surname}"
How can I modify this script so that I input those two variables from console?Lets say my name is "first"... (3 Replies)
Discussion started by: c0mrade
3 Replies
6. UNIX for Dummies Questions & Answers
i have both linux and windos installed on my pc . i want to take 1st column of excel as in input for my shell script .can anyone tell me how can i achive that. (1 Reply)
Discussion started by: nitin_aaa27
1 Replies
7. Shell Programming and Scripting
Hello!
Need help with the following:
#!/bin/bash
streamripper http://mp3-live.swr.de/swr2_m.m3u -D ~/RadioMitschnitt -l 200 > /dev/null 2>&1
I want to change the script so that it asks for an input for "-l 200" (means length 200sec) and starts then with the new value for "-l".
Can I do this... (2 Replies)
Discussion started by: urug3170
2 Replies
8. Shell Programming and Scripting
Hello
I am trying to create a user input shell scipt. The objective is user should enter the circuit number and the input is saved in a log file. If the user does not enter anything then the question should prompt it until the circuit no. is entered.
Can any one please correct the code below.... (3 Replies)
Discussion started by: sureshcisco
3 Replies
9. Shell Programming and Scripting
hy,
I wrote a simple shell script to monitor (with Nagios) a SNX VPN function. Here the Code snippet:
testing=`ssh user@IP-address 'ls /etc/sysconfig/network-scripts/ifcfg-eth0'`
#echo $testing
if ; then
echo "VPN is working"
exit 0
else snx -s server -u user
... (2 Replies)
Discussion started by: tomies
2 Replies
10. Shell Programming and Scripting
I want to write a script that read the input to variable.
I want the input screen to have 2 lines, where the values already input will appear above the input line
for example if I want to input the words below:
like
love
live
life
The screen will display like this:
1. Before any input... (8 Replies)
Discussion started by: aydj
8 Replies
LEARN ABOUT REDHAT
vacuumdb
VACUUMDB(1) PostgreSQL Client Applications VACUUMDB(1)
NAME
vacuumdb - garbage-collect and analyze a PostgreSQL database
SYNOPSIS
vacuumdb [ connection-options... ] [ --full | -f ] [ --verbose | -v ] [ --analyze | -z ] [ --table | -t 'table [ ( column [,...] ) ]' ] [
dbname ]
vacuumdb [ connection-options... ] [ --all | -a ] [ --full | -f ] [ --verbose | -v ] [ --analyze | -z ]
DESCRIPTION
vacuumdb is a utility for cleaning a PostgreSQL database. vacuumdb will also generate internal statistics used by the PostgreSQL query
optimizer.
vacuumdb is a shell script wrapper around the backend command VACUUM [vacuum(7)] via the PostgreSQL interactive terminal psql(1). There is
no effective difference between vacuuming databases via this or other methods. psql must be found by the script and a database server must
be running at the targeted host. Also, any default settings and environment variables available to psql and the libpq front-end library do
apply.
vacuumdb might need to connect several times to the PostgreSQL server, asking for a password each time. It is convenient to have a
$HOME/.pgpass file in such cases.
OPTIONS
vacuumdb accepts the following command-line arguments:
[-d] dbname
[--dbname] dbname
Specifies the name of the database to be cleaned or analyzed. If this is not specified and -a (or --all) is not used, the database
name is read from the environment variable PGDATABASE. If that is not set, the user name specified for the connection is used.
-a
--all Vacuum all databases.
-e
--echo Echo the commands that vacuumdb generates and sends to the server.
-f
--full Perform ``full'' vacuuming.
-q
--quiet
Do not display a response.
-t table [ (column [,...]) ]
--table table [ (column [,...]) ]
Clean or analyze table only. Column names may be specified only in conjunction with the --analyze option.
Tip: If you specify columns to vacuum, you probably have to escape the parentheses from the shell.
-v
--verbose
Print detailed information during processing.
-z
--analyze
Calculate statistics for use by the optimizer.
vacuumdb 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
-W
--password
Force password prompt.
DIAGNOSTICS
VACUUM Everything went well.
vacuumdb: Vacuum failed.
Something went wrong. vacuumdb is only a wrapper script. See VACUUM [vacuum(7)] and psql(1) for a detailed discussion of error mes-
sages and potential problems.
ENVIRONMENT
PGDATABASE
PGHOST
PGPORT
PGUSER Default connection parameters.
EXAMPLES
To clean the database test:
$ vacuumdb test
To clean and analyze for the optimizer a database named bigdb:
$ vacuumdb --analyze bigdb
To clean a single table foo in a database named xyzzy, and analyze a single column bar of the table for the optimizer:
$ vacuumdb --analyze --verbose --table 'foo(bar)' xyzzy
SEE ALSO
VACUUM [vacuum(7)]
Application 2002-11-22 VACUUMDB(1)