Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting "Access is denied" error when executing pg_dump on Windows

Tags:

I'm trying to execute pg_dump for one of my PostgreSQL databases, but I am having permission problems.

C:\Windows\system32>pg_dump -U postgres -p 1863 -O social_sense > C:\\Program Files\\PostgreSQL\\8.4\\data\\social_sense.sql 


I am getting the following error:

Access is denied


Can anyone enlighten?

like image 718
goh Avatar asked Jul 23 '10 08:07

goh


People also ask

What does pg_dump command do?

pg_dump can be used to backup an entire database, then pg_restore can be used to examine the archive and/or select which parts of the database are to be restored. The most flexible output file formats are the “custom” format ( -Fc ) and the “directory” format ( -Fd ).

Who can run pg_dump?

pg_dump is a regular PostgreSQL client application (albeit a particularly clever one). This means that you can perform this backup procedure from any remote host that has access to the database. But remember that pg_dump does not operate with special permissions.

What is path to pg_dump?

c:\Program files\postgresql\9.3\bin> pg_dump -h localhost -p 5432 -U postgres test > D:\backup. sql ... After above command enter User "postgres" password and check D:\ drive for backup.sql file. Follow this answer to receive notifications.

Is pg_dump backwards compatible?

restores to earlier versions not working.


2 Answers

I apologise for taking up your time. It was due to that there is no write permission to the directory i was writing to.

like image 82
goh Avatar answered Oct 13 '22 01:10

goh


Or you can run the cmd as administrator. In my situation that solved the problem too. I know it is a bit late answer but I thought, it would help someone else maybe

like image 41
mctuna Avatar answered Oct 12 '22 23:10

mctuna