Dump Database

Started by José Pedro Santosabout 12 years ago4 messagesgeneral
Jump to latest
#1José Pedro Santos
zpsantos1@hotmail.com

Dear all,

I'm trying to dump my database using the following command after I enter as su postgres:

pg_dump - U postgres mydb -f mydb.sql

... but I'm always having the following message:

pg_dump [archiver] Could not open output file "mydb.sql" : Permission denied

I try to use the same statement using su.. but I didn't manage. Can someone give me a help?

I'm using Ubuntu 12.04 LTS and Postgres 9.1.

Kind Regards,
José Santos

#2Martin French
Martin.French@romaxtech.com
In reply to: José Pedro Santos (#1)
Re: Dump Database

pgsql-general-owner@postgresql.org wrote on 17/03/2014 12:50:20:

From: José Pedro Santos <zpsantos1@hotmail.com>
To: Postgres Ajuda <pgsql-general@postgresql.org>,
Date: 17/03/2014 12:56
Subject: [GENERAL] Dump Database
Sent by: pgsql-general-owner@postgresql.org

Dear all,

I'm trying to dump my database using the following command after I
enter as su postgres:

pg_dump - U postgres mydb -f mydb.sql

... but I'm always having the following message:

pg_dump [archiver] Could not open output file "mydb.sql" : Permission

denied

I try to use the same statement using su.. but I didn't manage. Can
someone give me a help?

I'm using Ubuntu 12.04 LTS and Postgres 9.1.

Kind Regards,
José Santos

The assumption here is that you're in a directory where you do not have
permissions.

try:
# cd
# pg_dump -f mydb.sql -U postgres mydb

It also appears that you have a space between "-" and "U", make sure that
it appears: "-U".

Cheers
=============================================

Romax Technology Limited
A limited company registered in England and Wales.
Registered office:
Rutherford House
Nottingham Science and Technology Park
Nottingham
NG7 2PZ
England
Registration Number: 2345696
VAT Number: 526 246 746

Telephone numbers:
+44 (0)115 951 88 00 (main)

For other office locations see:
http://www.romaxtech.com/Contact
=================================
===============
E-mail: info@romaxtech.com
Website: www.romaxtech.com
=================================

================
Confidentiality Statement
This transmission is for the addressee only and contains information that
is confidential and privileged.
Unless you are the named addressee, or authorised to receive it on behalf
of the addressee
you may not copy or use it, or disclose it to anyone else.
If you have received this transmission in error please delete from your
system and contact the sender. Thank you for your cooperation.
=================================================

#3Dennis
dennis@kabonkulator.com
In reply to: José Pedro Santos (#1)
Re: Dump Database

What does the shell command: pwd show when run immediately after you issue
a su postgres command?

You may want to try su - postgres to ensure you are in the postgres users
home directory.

From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of José Pedro Santos
Sent: Monday, March 17, 2014 7:50 AM
To: Postgres Ajuda
Subject: [GENERAL] Dump Database

Dear all,

I'm trying to dump my database using the following command after I enter as
su postgres:

pg_dump - U postgres mydb -f mydb.sql

... but I'm always having the following message:

pg_dump [archiver] Could not open output file "mydb.sql" : Permission denied

I try to use the same statement using su.. but I didn't manage. Can someone
give me a help?

I'm using Ubuntu 12.04 LTS and Postgres 9.1.

Kind Regards,
José Santos

#4José Pedro Santos
zpsantos1@hotmail.com
In reply to: Dennis (#3)
Re: Dump Database

Hi Dennis,

I already manage. The problem as because I wasn't in the right folder...rookie mistake.

Thank you for your email.

Regards,
José Santos

From: dennis@kabonkulator.com
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Dump Database
Date: Mon, 17 Mar 2014 08:14:03 -0500

What does the shell command: pwd show when run immediately after you issue a su postgres command? You may want to try su - postgres to ensure you are in the postgres users home directory. From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of José Pedro Santos
Sent: Monday, March 17, 2014 7:50 AM
To: Postgres Ajuda
Subject: [GENERAL] Dump Database Dear all,

I'm trying to dump my database using the following command after I enter as su postgres:

pg_dump - U postgres mydb -f mydb.sql

... but I'm always having the following message:

pg_dump [archiver] Could not open output file "mydb.sql" : Permission denied

I try to use the same statement using su.. but I didn't manage. Can someone give me a help?

I'm using Ubuntu 12.04 LTS and Postgres 9.1.

Kind Regards,
José Santos