Sponsored Content
Full Discussion: Postgres : pg_dump Error
Top Forums Shell Programming and Scripting Postgres : pg_dump Error Post 302223874 by Ikon on Monday 11th of August 2008 03:34:50 PM
Old 08-11-2008
I havnt used postgres in along time but I would guess it need a username and password...

Try something like this:

Code:
echo -n -e "username\npassword\n" | pg_dump -u -v dbname > dbname.pgdump

This is insecure, as your password is briefly visible in a full ps output,
but it works non-interactively, so you can do it in scripts (e.g., from
cron). Of course, that's potentially even more insecure...


EDIT: I cant tell if the error is with the database connect or if the user you are using has permission to write the the /home/backup/psql/11-08-08 directory.

Im thinking that if it were a db error you would get:
Code:
Connection to database 'dbname' failed.

So check write permissions for the directory.

Last edited by Ikon; 08-11-2008 at 04:40 PM..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how will i connect postgres database from unix shell script

I have got the solution so just closing this issue. (3 Replies)
Discussion started by: jambesh
3 Replies

2. Shell Programming and Scripting

Backup-Script for Postgres

Hi, I'm working with postgres. Now I found a script to backup my databases. # #!/bin/bash # # # setup environment PG_PORT=5432 PG_HOME=/usr/lib/postgresql/8.3 PG_VAR=/backup PG_DATA=/backup/data PG_BACKUPS=/backup/backup PG_LOGS=/backup/logs ... (6 Replies)
Discussion started by: karl_ha
6 Replies

3. Shell Programming and Scripting

testing postgres connection in shell script

I have a script that does db query in postgres. I'm trying to put in some error checking in the script. I keep running into the password prompt problem where when invalid credentials/or database is put it, it would prompt me for a password which hangs the script. Is there a way that I can check for... (0 Replies)
Discussion started by: zerofire123
0 Replies

4. Shell Programming and Scripting

How to write cron job for calling sql function database is postgres

Hi, Please help me to write cron job for calling sql function daily. I have Postgres database. (1 Reply)
Discussion started by: kulbhushan
1 Replies

5. Shell Programming and Scripting

help copy *.txt to postgres

hi all, a have problem to load *.txt to postgres my database: id_list_ip (nextval) list_ip (varchar) txt file (list_ip.txt) hasilping_10.8.248.1 hasilping_119.110.112.226 hasilping_119.110.125.33 hasilping_125.22.1.25 hasilping_192.168.2.1 hasilping_202.73.96.70 script... (3 Replies)
Discussion started by: adi0926
3 Replies

6. Shell Programming and Scripting

Postgres in Linux

I have this 15 postgres sql queries similar to below to run in linux... Its taking a lot of time to run (3hours) . can any one plz guide me how can i reduce the time of execution execute 'insert into cc.rpt_cons_sub_ccdb_data(report_date, server_name, report_type, count) select... (3 Replies)
Discussion started by: nikhil jain
3 Replies

7. UNIX for Advanced & Expert Users

How to set postgres process in monit file?

Dear Friends, I need to add the postgres process in monit file ( Debian machine ). How to add that process in monit?. If anyone know the solution for this, pls let me know. ---------- Post updated at 02:27 PM ---------- Previous update was at 12:21 PM ---------- I have found the... (0 Replies)
Discussion started by: rekha_sri
0 Replies

8. Shell Programming and Scripting

Script for removing Postgres

I made a script to remove Postgres if this is already installed on your system. I have a other script to install Postgres, so this script can be used before you going to install Postgres. Do you like this script? I would love to hear feedback. #!/bin/bash # #################################... (2 Replies)
Discussion started by: dannyvdberg
2 Replies

9. Shell Programming and Scripting

Using shell scripting for making queries on postgres sql

I have a situation where I have a list of airplanes that make a series of flights. Therefore I am looking up the different flights that each airplane makes based on a postgres sql query: select flightid from plane where airplane='DELTAx' As a result I get a series of flight numbers... (0 Replies)
Discussion started by: JSNY
0 Replies
REINDEXDB(1)						  PostgreSQL 9.2.7 Documentation					      REINDEXDB(1)

NAME
reindexdb - reindex a PostgreSQL database SYNOPSIS
reindexdb [connection-option...] [--table | -t table] [--index | -i index] [dbname] reindexdb [connection-option...] --all | -a reindexdb [connection-option...] --system | -s [dbname] DESCRIPTION
reindexdb is a utility for rebuilding indexes in a PostgreSQL database. reindexdb is a wrapper around the SQL command REINDEX(7). There is no effective difference between reindexing databases via this utility and via other methods for accessing the server. OPTIONS
reindexdb accepts the following command-line arguments: -a, --all Reindex all databases. [-d] dbname, [--dbname=]dbname Specifies the name of the database to be reindexed. 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. -e, --echo Echo the commands that reindexdb generates and sends to the server. -i index, --index=index Recreate index only. -q, --quiet Do not display progress messages. -s, --system Reindex database's system catalogs. -t table, --table=table Reindex table only. -V, --version Print the reindexdb version and exit. -?, --help Show help about reindexdb command line arguments, and exit. reindexdb 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 the value begins with a slash, it is used as the directory for the Unix domain socket. -p port, --port=port Specifies the TCP 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, --no-password Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. -W, --password Force reindexdb to prompt for a password before connecting to a database. This option is never essential, since reindexdb will automatically prompt for a password if the server demands password authentication. However, reindexdb will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. --maintenance-db=dbname Specifies the name of the database to connect to discover what other databases should be reindexed. If not specified, the postgres database will be used, and if that does not exist, template1 will be used. ENVIRONMENT
PGDATABASE, PGHOST, PGPORT, PGUSER Default connection parameters This utility, like most other PostgreSQL utilities, also uses the environment variables supported by libpq (see Section 31.14, "Environment Variables", in the documentation). DIAGNOSTICS
In case of difficulty, see REINDEX(7) and psql(1) for discussions of potential problems and error messages. The database server must be running at the targeted host. Also, any default connection settings and environment variables used by the libpq front-end library will apply. NOTES
reindexdb might need to connect several times to the PostgreSQL server, asking for a password each time. It is convenient to have a ~/.pgpass file in such cases. See Section 31.15, "The Password File", in the documentation for more information. EXAMPLES
To reindex the database test: $ reindexdb test To reindex the table foo and the index bar in a database named abcd: $ reindexdb --table foo --index bar abcd SEE ALSO
REINDEX(7) PostgreSQL 9.2.7 2014-02-17 REINDEXDB(1)
All times are GMT -4. The time now is 04:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy