07-24-2009
Hi jhon
DBLIST=`egrep -i ":Y|:N" /etc/oratab | cut -d":" -f1 | grep -v "\#" | grep -v "\*"`
for DBNAME in $DBLIST
do
username=`grep $DBNAME DBCONFIG.cfg | cut -d "|" -f2`
password=`grep $DBNAME DBCONFIG.cfg | cut -d "|" -f3`
sqlplus -s ${username}/${password} <<EOF
select name from v\$database;
select sysdate from dual;
EOF
done
scripter
Last edited by Franklin52; 07-24-2009 at 05:30 PM..
Reason: urls removed
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Anyone can help me ?
I try to using crontab with a simple shell script as echo it run okay but now i have more command in script. when I set entry to crontab and whe it run i get mail with error cannot execute binary file.
it urgent so please help me the soutions. Thank so much for your help.... (5 Replies)
Discussion started by: raccsdl
5 Replies
2. Shell Programming and Scripting
Hi
I am doing a process of converting all the values of key column into a row, for eg
Key col1 col2
1 1 1
1 2 1
1 1 3
1 3 1
2 ... (2 Replies)
Discussion started by: nvuradi
2 Replies
3. AIX
hi there,
Please help me
How transfer sql file from one server to another without username and password .i know just IP address.
Thanks
Arpit (1 Reply)
Discussion started by: Arpitmitm
1 Replies
4. Shell Programming and Scripting
Dear All
I am trying to write one shell which will be running through Cron which contain one SQL query. But I want to draw/fetch the Username password and Instance name (required to loging to the database) from one single file to run that SQL query . Also this file contain details of multiple... (2 Replies)
Discussion started by: jhon
2 Replies
5. UNIX for Advanced & Expert Users
Hi,
I am running the following command, and it tries to delete some dn from ldap, however, it takes lot of time before it finally request LDAP server to delete it.
I am trying to find why it is taking lot of time. Could you anyone help me in this regard. I have copies the pstack output, and... (3 Replies)
Discussion started by: john_prince
3 Replies
6. Shell Programming and Scripting
Hi All,
I am writing a script where it updates a file in an unix account.
To update that file i need to be logged in as that account user.
say account name is ab01 and its password is passab01.
What i want to do is, my script should read login id and password from a parameter file and... (4 Replies)
Discussion started by: pkbond
4 Replies
7. Shell Programming and Scripting
Hi,
I need to query Oracle database for 100 users. I have these 100 users in a file. I need a shell script which would read this User file (one user at a time) & query database.
For instance:
USER CITY
--------- ----------
A CITY_A
B CITY_B
C ... (2 Replies)
Discussion started by: DevendraG
2 Replies
8. Shell Programming and Scripting
Hi
I am new to using unix and am struggling with a script i am writing. What i am trying to do is get a user to enter a username, check the original file i created with username and pin to see if their is a corresponding entry. Next ask the user to enter the pin and see if this matches... (5 Replies)
Discussion started by: somersetdan
5 Replies
9. Shell Programming and Scripting
Hello All,
I have created a shell script, When i run it manually as ./<script_name> it takes 5 hours to run, but when i am scheduling it in crontab, it is taking 20 hours to run.
Please help me and advice, what can be done to reduce the time in crontab.
Thank you (6 Replies)
Discussion started by: anand2308
6 Replies
10. Shell Programming and Scripting
Hokay...first post, and I have been doing Linux scripting for a total of 2 days now. I think I am doing pretty well, but awk and arrays(what I think I need here) is a bit above me so far.
I have written a script that will take and either create or modify 5 users, and passwords.
It checks... (6 Replies)
Discussion started by: cashman04
6 Replies
LEARN ABOUT REDHAT
createdb
CREATEDB(1) PostgreSQL Client Applications CREATEDB(1)
NAME
createdb - create a new PostgreSQL database
SYNOPSIS
createdb [ options... ] [ dbname ] [ description ]
DESCRIPTION
createdb creates a new PostgreSQL database.
Normally, the database user who executes this command becomes the owner of the new database. However a different owner can be specified
via the -O option, if the executing user has appropriate privileges.
createdb is a shell script wrapper around the SQL command CREATE DATABASE [create_database(7)] via the PostgreSQL interactive terminal
psql(1). Thus, there is nothing special about creating databases via this or other methods. This means that the psql program must be found
by the script and that a database server must be running at the targeted port. Also, any default settings and environment variables avail-
able to psql and the libpq front-end library will apply.
OPTIONS
createdb accepts the following command-line arguments:
dbname Specifies the name of the database to be created. The name must be unique among all PostgreSQL databases in this installation. The
default is to create a database with the same name as the current system user.
description
This optionally specifies a comment to be associated with the newly created database.
-D location
--location location
Specifies the alternative location for the database. See also initlocation(1).
-e
--echo Echo the queries that createdb generates and sends to the server.
-E encoding
--encoding encoding
Specifies the character encoding scheme to be used in this database.
-O owner
--owner owner
Specifies the database user who will own the new database.
-q
--quiet
Do not display a response.
-T template
--template template
Specifies the template database from which to build this database.
The options -D, -E, -O, and -T correspond to options of the underlying SQL command CREATE DATABASE [create_database(7)]; see there for more
information about them.
createdb 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 the 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
CREATE DATABASE
The database was successfully created.
createdb: Database creation failed.
(Says it all.)
createdb: Comment creation failed. (Database was created.)
The comment/description for the database could not be created. The database itself will have been created already. You can use the
SQL command COMMENT ON DATABASE to create the comment later on.
If there is an error condition, the backend error message will be displayed. See CREATE DATABASE [create_database(7)] and psql(1) for pos-
sibilities.
ENVIRONMENT
PGDATABASE
If set, the name of the database to create, unless overridden on the command line.
PGHOST
PGPORT
PGUSER Default connection parameters. PGUSER also determines the name of the database to create, if it is not specified on the command line
or by PGDATABASE.
EXAMPLES
To create the database demo using the default database server:
$ createdb demo
CREATE DATABASE
The response is the same as you would have gotten from running the CREATE DATABASE SQL command.
To create the database demo using the server on host eden, port 5000, using the LATIN1 encoding scheme with a look at the underlying query:
$ createdb -p 5000 -h eden -E LATIN1 -e demo
CREATE DATABASE "demo" WITH ENCODING = 'LATIN1'
CREATE DATABASE
SEE ALSO
dropdb(1), CREATE DATABASE [create_database(7)]
Application 2002-11-22 CREATEDB(1)