Shell Script to execute Oracle query taking input from a file to form query
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.
Hi
I am trying to run a SQL statement from a unix script determined at runtime.
It is throwing me an error. Please advise some solution to this.
echo "Enter username for the database"
read username
echo "Enter password for the database"
read password
echo "Enter SQL stmt"
read... (4 Replies)
Hi,
I know in oracle a .sql file is called by @ <path> /<filename>.
But how to call in sql 2005, I am opening the sql sessionwith sqsh, is there any command to execute there a .sql file (query in sql 2005) in K shell script. (0 Replies)
Hi,
I have data in my text file something like this.
adams
robert
ahmed
gibbs
I want to use this data line by line as input to an sql query which i run by connecting to an oracle database from shell.
If you have code for similar scenario , please ehlp.
I want the output of the sql query... (7 Replies)
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)
Hi,
I have a requirement as below which needs to be done viz UNIX shell script
(1) I have to connect to an Oracle database
(2) Exexute "SELECT field_status from table 1" query on one of the tables.
(3) Based on the result that I get from point (2), I have to update another table in the... (6 Replies)
Hi, unix gurnis
I need help for following requirement for writing a shell scritp.
log in to oracle database, query one table total records (select count(*) from table1), pass the return value to a file.
Thanks in advance (2 Replies)
Hello everyone,
I have a RHEL 5 system and have been trying to get a batch of 3-4 scripts each in a separate variables and they are not working as expected.
I tried using following syntax which I saw a lot of people on this site use and should really work, though for some reason it doesn't... (3 Replies)
I need to run a SQL select query in Oracle database and have to capture the list of retrieved records in shell script. Also i would like to modify the query for certain condition and need to fetch it again. How can i do this?
Is there a way to have a persistent connection to oracle database... (9 Replies)
I have a postgres sql statement that is the following:
select age from students;
which gives me the entries:
Age
---
10
15
13
12
9
14
10
which is about 7 rows of data.
Now what I would like to do with this is use a shell script to create an array age. As a results... (3 Replies)
Hi Experts,
Need your support.
Not able to use sql query alias in shell script.
Could you please help me in finding right way to use alias with sql query in shell script.
Below is the code i am using.
#!/bin/bash
sqlplus -s abc/abc@abc << EOF> bcd.csv
set trimspool on
select zone_id... (4 Replies)
Discussion started by: as7951
4 Replies
LEARN ABOUT REDHAT
createuser
CREATEUSER(1) PostgreSQL Client Applications CREATEUSER(1)NAME
createuser - define a new PostgreSQL user account
SYNOPSIS
createuser [ options... ] [ username ]
DESCRIPTION
createuser creates a new PostgreSQL user. Only superusers (users with usesuper set in the pg_shadow table) can create new PostgreSQL
users, so createuser must be invoked by someone who can connect as a PostgreSQL superuser.
Being a superuser also implies the ability to bypass access permission checks within the database, so superuserdom should not be granted
lightly.
createuser is a shell script wrapper around the SQL command CREATE USER [create_user(7)] via the PostgreSQL interactive terminal psql(1).
Thus, there is nothing special about creating users via this or other methods. This means that the psql application must be found by the
script and that a database server must be running at the targeted host. Also, any default settings and environment variables used by psql
and the libpq front-end library will apply.
OPTIONS
createuser accepts the following command-line arguments:
username
Specifies the name of the PostgreSQL user to be created. This name must be unique among all PostgreSQL users.
-a
--adduser
The new user is allowed to create other users. (Note: Actually, this makes the new user a superuser. The option is poorly named.)
-A
--no-adduser
The new user is not allowed to create other users (i.e., the new user is a regular user, not a superuser).
-d
--createdb
The new user is allowed to create databases.
-D
--no-createdb
The new user is not allowed to create databases.
-e
--echo Echo the queries that createuser generates and sends to the server.
-E
--encrypted
Encrypts the user's password stored in the database. If not specified, the default is used.
-i uid
--sysid uid
Allows you to pick a non-default user ID for the new user. This is not necessary, but some people like it.
-N
--unencrypted
Does not encrypt the user's password stored in the database. If not specified, the default is used.
-P
--pwprompt
If given, createuser will issue a prompt for the password of the new user. This is not necessary if you do not plan on using pass-
word authentication.
-q
--quiet
Do not display a response.
You will be prompted for a name and other missing information if it is not specified on the command line.
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 create)
-W
--password
Force password prompt (to connect to the server, not for the password of the new user).
ENVIRONMENT
PGHOST
PGPORT
PGUSER Default connection parameters
DIAGNOSTICS
CREATE USER
All is well.
createuser: creation of user "username" failed
Something went wrong. The user was not created.
If there is an error condition, the backend error message will be displayed. See CREATE USER [create_user(7)] and psql(1) for possibili-
ties.
EXAMPLES
To create a user joe on the default database server:
$ createuser joe
Is the new user allowed to create databases? (y/n) n
Shall the new user be allowed to create more new users? (y/n) n
CREATE USER
To create the same user joe using the server on host eden, port 5000, avoiding the prompts and taking a look at the underlying query:
$ createuser -p 5000 -h eden -D -A -e joe
CREATE USER "joe" NOCREATEDB NOCREATEUSER
CREATE USER
SEE ALSO dropuser(1), CREATE USER [create_user(7)]
Application 2002-11-22 CREATEUSER(1)