i used below command to backup my database
sudo -u user_name pg_dump dbName -f /home ..../someWhere/db.sql
but it gives me this :
pg_dump: [archiver] could not open output file "/home ..../someWhere/db.sql": Permission denied
after googling this issue i find that i must backup my data under the /tmp
path , but doesn't work
how can i resolve this issue ?
thanks in advance,
i am using Ubuntu 12.04 lts
touch
command – Berstinetouch
using the same sudo command though? What is "user_name"? Why are yousudo
ing to another user to do the dump? – Chaparropostgres=# \! touch /tmp/myfile.txt
postgres=# \! ls -l /tmp/myfile.txt
-rw-rw-r-- 1 postgres postgres 0 Jan 31 10:23 /tmp/myfile.txt – Cyanohydrinpg_dump
command frompsql
– Berstinepg_dump
.pg_dump
is a shell command, not a PostgreSQL command. If you mean you want to switch to the user, i.e. you really meantsudo -u postgres pg_dump ...
, why didn't you say so? – Chaparrosudo -u user_name
it gives me thispg_dump: [archiver (db)] connection to database "dbName" failed: FATAL: role "user_name" does not exist
– Berstineuser_name
. So create one, or specify a different user to connect as. I think you really need to go read the client authentication chapter of the user manual, or possibly the tutorial. – Chaparro