开发者

How to use pg_dump / pg_dumpall with postgres DB?

I am uncertain if its the permissions issue or something I am doing wrong and any help will be greatly appreciated. I have a dedicated Ubuntu server with Postgres DB installed on it. I want to backup the databases, but when I use pg_dump I get permission denied. Can some one help me out? Here are a few details about my set up.

On postgres: I have the following databases.

postgres, 
template0, 
template1, 
mydb, 
mydb1

I have 2 PostgreSQL users

postgres, 
mydb (There are no postgresql groups defined yet)

All the other settings for postgres are default values.

On my ubuntu itself, I ha开发者_StackOverflowve 2 users.

user1,
mydb

I logged into the box as root/user1 using SSH, issued the following commands,

$ pg_dumpall > a.sql

I get, -bash: a.sql: Permission denied Same goes with pg_dump command.

I know I am missing something here. Can some one guide me to properly issue this command? TIA.


I get, -bash: a.sql: Permission denied Same goes with pg_dump command.

This looks more like a file permission issue. Does the OS user have the right to write the dump file? Check file/directory permissions.


When you run the command

pg_dumpall > a.sql

then your shell will attempt to create the file a.sql in the current directory. If you (as "user1") do not have permission to create files in the current directory, then first use the cd command to change to a directory where you do have permission. You can use the pwd command to see what the current directory actually is.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜