Tables to query to find users for database from shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Tables to query to find users for database from shell script
# 1  
Old 04-10-2009
Tables to query to find users for database from shell script

I am coding shell script.

I need to connect to different databases like DB2, Oracle and Sybase.
I would then need to query tables where it has all the groups, users for that database.
I would also need who has what kind of permissions.
EG: I know for DB2 some TABAUTH table needs to be queried , i need help with other databases.


I have a list of server names.
I need to loop through each of them and connect and get this data.
what command can be used to connect to this servers.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script automation using cron which query's MySQL Tables

What I have: I have a input.sh (script which basically connect to mysql-db and query's multiple tables to write back the output to output1.out file in a directory) note: I need to pass an integer (unique_id = anything b/w 1- 1000) next to the script everytime I run the script which generates... (3 Replies)
Discussion started by: kkpand
3 Replies

2. Shell Programming and Scripting

How to use V$tables in UNIX shell script?

Hi All, In my script I have used the below code to retrieve the instance name V_INSTANCE_NAME=`sqlplus -s ${APPS_USR_PSWD} <<+ set pagesize 0 linesize 256 feedback off verify off head off echo off set serveroutput off select... (2 Replies)
Discussion started by: kalidoss
2 Replies

3. Shell Programming and Scripting

Help with script to create users from database query

#!/bin/bash user=`mysql userList -uuserlist -puserlistpassword -s -N -e "SELECT userName FROM users WHERE activated='n'"` for i in $user; do useradd "$i" -m doneThis is what I have done so far. But obviously it still does not work. I'm trying to create users based on information stored in a... (5 Replies)
Discussion started by: bucketuk
5 Replies

4. Shell Programming and Scripting

Need help in updating the tables inside shell script

I have an input file with contents like : 1LMXTJJD0W28TX2 1LS1XJGDEVWAC5T 1LK81JVDE2HRNDG 1LMXTJJD0W28TX2 1LS1XJGDEVWAC5T 1LK81JVDE2HRNDG 1LMXTJJD0W28TX2 I need to read each field from the file pass it to a query: select count(*) from usage_error where usage_id='$field... (17 Replies)
Discussion started by: Rajesh Putnala
17 Replies

5. Shell Programming and Scripting

Korn Script to connect and query oracle database

I've been sent the following script to finish. It's supposed to connect to an oracle database, query it, and send an email if the query result value is one or more. Currently it isn't connecting properly, just giving the following error: ERROR: ORA-01017: invalid username/password; logon denied... (2 Replies)
Discussion started by: jackmorgan2007
2 Replies

6. Shell Programming and Scripting

How to run a SQL select query in Oracle database through shell script?

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)
Discussion started by: vel4ever
9 Replies

7. Shell Programming and Scripting

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. For instance: USER CITY --------- ---------- A CITY_A B CITY_B C ... (2 Replies)
Discussion started by: DevendraG
2 Replies

8. Shell Programming and Scripting

Query Oracle tables and return values to shell script that calls the query

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)
Discussion started by: balaeswari
6 Replies

9. Shell Programming and Scripting

shell script to find unowned users and groups

Hello, I am new to Unix and shell scripting. I am trying to find unowned files and groups on my servers. I know, i could use the below command to find it on individual server. #find / -nouser -o -nogroup -print But I was wondering, if someone could help with a shell script so that I can... (2 Replies)
Discussion started by: ut916
2 Replies

10. Shell Programming and Scripting

compare two tables using shell script

Hi, I want to compare two tables fieldwise using shell script. Can anyone help me regarding the same. The approach which i tried is to first move the two tables in simple txt file where each field is now seperated by space. But i can't retrive each field with "space" as a seperator b'coz there... (1 Reply)
Discussion started by: dtidke
1 Replies
Login or Register to Ask a Question
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)