Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2016
    Posts
    3

    Unanswered: Using the PG_ commands in windows (pg_ctl, pg_basebakup)

    I am about 3 week into learning Postgres (9.5) and it is running on Windows which seems to be the least popular OS

    I am trying to reload the pg_hba file which I thought would work with the following command:

    C:\Program Files\PostgreSQL\9.5\bin>pg_ctl -D "C:\Program Files\PostgreSQL\9.5\bin reload
    pg_ctl: no operation specified
    Try "pg_ctl --help" for more information.

    I know I can restart the database under services but I want to know how to reload for when this hits production so we don't take an outage just to update the pg_hba file.

    I have read countless forums and read over this page https://www.postgresql.org/docs/9.5/...pp-pg-ctl.html many times but I can't seem to figure out what the problem is.

    I read it could be a permissions issue since I shouldn't have had Postgres installed under the program files directory I believe I have granted this full access but I could be wrong.

    I have also been trying to get the pg_basebackup command to work as well which I am going to assume once I get pg_ctl to work pg_basebackup will follow (fingers cross)

    The kicker is that pg_dump works just fine.

  2. #2
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Quote Originally Posted by mrunreal View Post
    C:\Program Files\PostgreSQL\9.5\bin>pg_ctl -D "C:\Program Files\PostgreSQL\9.5\bin reload
    pg_ctl: no operation specified
    Try "pg_ctl --help" for more information.
    You seem to be missing a second double quote: C:\Program Files\PostgreSQL\9.5\bin>pg_ctl -D "C:\Program Files\PostgreSQL\9.5\bin" reload
    Note the " after bin

    But more importantly: -D specifies the data directory which most definitely is not located at "C:\Program Files\PostgreSQL\9.5\bin".

    If Postgres is still running you can do a
    Code:
    show data_directory
    to find the location of it.
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags: http://www.dbforums.com/misc.php?do=bbcode#code

    Tips for good questions:

    http://tkyte.blogspot.de/2005/06/how...questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

  3. #3
    Join Date
    Jul 2016
    Posts
    3
    Quote Originally Posted by shammat View Post
    You seem to be missing a second double quote: C:\Program Files\PostgreSQL\9.5\bin>pg_ctl -D "C:\Program Files\PostgreSQL\9.5\bin" reload
    Note the " after bin

    But more importantly: -D specifies the data directory which most definitely is not located at "C:\Program Files\PostgreSQL\9.5\bin".

    If Postgres is still running you can do a
    Code:
    show data_directory
    to find the location of it.
    I think the double quote may have been a type oh but I have corrected it and also have the correct data directory which is C:\Program Files\PostgreSQL\9.5\data

    Now I get a new error which I guess is progress

    pg_ctl: could not send reload signal (PID: 1144): Operation not permitted

  4. #4
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Quote Originally Posted by mrunreal View Post
    I think the double quote may have been a type oh but I have corrected it and also have the correct data directory which is C:\Program Files\PostgreSQL\9.5\data
    Unrelated to your question, but:
    Storing program data in "c:\Program Files" is a really bad idea on Windows. I blame the Postgres installer for that as that is the default location that is offered. But it should really be somewhere else (and you can change that during the installation)

    Quote Originally Posted by mrunreal View Post
    Now I get a new error which I guess is progress

    pg_ctl: could not send reload signal (PID: 1144): Operation not permitted
    You probably need to open cmd.exe as an Administrator.
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags: http://www.dbforums.com/misc.php?do=bbcode#code

    Tips for good questions:

    http://tkyte.blogspot.de/2005/06/how...questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

  5. #5
    Join Date
    Jul 2016
    Posts
    3
    Quote Originally Posted by shammat View Post
    Unrelated to your question, but:
    Storing program data in "c:\Program Files" is a really bad idea on Windows. I blame the Postgres installer for that as that is the default location that is offered. But it should really be somewhere else (and you can change that during the installation)
    Yeah I read about this and knew it was a problem but unfortunately I wasn't the one who installed it. May have to look into changing this.

    Quote Originally Posted by shammat View Post
    You probably need to open cmd.exe as an Administrator.

    Thank you sir! This has saved me and also gotten me one step closer to troubleshooting my other problem

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •