Getting "Access is denied" error when executing pg_dump on Windows
Asked Answered
D

3

28

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?

Drama answered 23/7, 2010 at 8:4 Comment(0)
D
44

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

Drama answered 23/7, 2010 at 8:38 Comment(3)
seems to happen fairly often. I have seen some other questions to that effect.Hosbein
Same permissions issue for me, thanks for highlighting it.Cortese
Weird why there is no permission to write in that very same folder... Thank you!Houseman
I
10

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

Ichthyo answered 23/7, 2010 at 8:4 Comment(0)
W
0

Sometimes you may get "ACCESS DENIED" because you specified the output directory but did not specify the file name.

ACCESS DENIED: pg_dump -h localhost -d databasename -U username -n schema_name > C:\temp\

OK: pg_dump -h localhost -d databasename -U username -n schema_name > C:\temp\dump.sql

Wendywendye answered 20/11, 2023 at 11:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.