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
PG_DUMPALL(1)						  PostgreSQL Client Applications					     PG_DUMPALL(1)

NAME
pg_dumpall - extract a PostgreSQL database cluster into a script file SYNOPSIS
pg_dumpall [ options... ] DESCRIPTION
pg_dumpall is a utility for writing out (``dumping'') all PostgreSQL databases of a cluster into one script file. The script file contains SQL commands that can be used as input to psql(1) to restore the databases. It does this by calling pg_dump(1) for each database in a clus- ter. pg_dumpall also dumps global objects that are common to all databases. (pg_dump does not save these objects.) This currently includes the information about database users and groups. Thus, pg_dumpall is an integrated solution for backing up your databases. But note a limitation: it cannot dump ``large objects'', since pg_dump cannot dump such objects into text files. If you have databases containing large objects, they should be dumped using one of pg_dump's non-text output modes. Since pg_dumpall reads tables from all databases you will most likely have to connect as a database superuser in order to produce a com- plete dump. Also you will need superuser privileges to execute the saved script in order to be allowed to add users and groups, and to cre- ate databases. The SQL script will be written to the standard output. Shell operators should be used to redirect it into a file. pg_dumpall 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
The following command-line options are used to control the output format. -c --clean Include SQL commands to clean (drop) the databases before recreating them. -d --inserts Dump data as INSERT commands (rather than COPY). This will make restoration very slow, but it makes the output more portable to other RDBMS packages. -D --column-inserts --attribute-inserts Dump data as INSERT commands with explicit column names (INSERT INTO table (column, ...) VALUES ...). This will make restoration very slow, but it is necessary if you desire to rearrange column ordering. -g --globals-only Dump only global objects (users and groups), no databases. -i --ignore-version Ignore version mismatch between pg_dumpall and the database server. pg_dumpall can handle databases from previous releases of PostgreSQL, but very old versions are not supported anymore (currently prior to 7.0). Use this option if you need to override the version check (and if pg_dumpall then fails, don't say you weren't warned). -o --oids Dump object identifiers (OIDs) for every table. Use this option if your application references the OID columns in some way (e.g., in a foreign key constraint). Otherwise, this option should not be used. -v --verbose Specifies verbose mode. This will cause pg_dumpall to print progress messages to standard error. The following command-line options control the database connection parameters. -h host Specifies the host name of the machine on which the database server is running. If host begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted. -p port The port number on which the server is listening. Defaults to the PGPORT environment variable, if set, or a compiled-in default. -U username Connect as the given user. -W Force a password prompt. This should happen automatically if the server requires password authentication. Long options are only available on some platforms. ENVIRONMENT
PGHOST PGPORT PGUSER Default connection parameters. NOTES
Since pg_dumpall calls pg_dump internally, some diagnostic messages will refer to pg_dump. pg_dumpall will need to connect several times to the PostgreSQL server. If password authentication is configured, it will ask for a pass- word each time. In that case it would be convenient to set up a password file. [Comment: But where is that password file documented?] EXAMPLES
To dump all databases: $ pg_dumpall > db.out To reload this database use, for example: $ psql -f db.out template1 (It is not important to which database you connect here since the script file created by pg_dumpall will contain the appropriate commands to create and connect to the saved databases.) SEE ALSO
pg_dump(1), psql(1). Check there for details on possible error conditions. Application 2002-11-22 PG_DUMPALL(1)