Обсуждение: Can't start service but works from command line

Поиск
Список
Период
Сортировка

Can't start service but works from command line

От
"Dejan"
Дата:
Computer which hosted a database crashed, but I managed to save "data"
folder. I copied it to another computer and pointed postgres to that folder
(stopping the service first). But, the service cannot start. Progress bar
just goes for awhile, and then a pop-up tells me that the service stopped.

I found in Services that command for starting the service is this

"C:\Program Files\PostgreSQL\8.2\bin\pg_ctl.exe" runservice -w -N
"pgsql-8.2" -D "f:\PostgreSQL\data\"

I tried to start it from command line with

"C:\Program Files\PostgreSQL\8.2\bin\pg_ctl.exe" start -w -D
"f:\PostgreSQL\data\"

and it works. The server starts and I can connect to it and access all
tables. But I need it to start as a service. Any help? I'm using version
8.2.5 on WinXP Pro SP2.



Re: Can't start service but works from command line

От
Thomas Kellerer
Дата:
Dejan wrote on 24.05.2009 01:19:
> Computer which hosted a database crashed, but I managed to save "data"
> folder. I copied it to another computer and pointed postgres to that folder
> (stopping the service first). But, the service cannot start. Progress bar
> just goes for awhile, and then a pop-up tells me that the service stopped.
>
> I found in Services that command for starting the service is this
>
> "C:\Program Files\PostgreSQL\8.2\bin\pg_ctl.exe" runservice -w -N
> "pgsql-8.2" -D "f:\PostgreSQL\data\"

Hmm, the command to start a service in Windows is "net start serviceName", so
that should be:

net start "pgsql-8.2"

in your case.

Re: Can't start service but works from command line

От
Craig Ringer
Дата:
Dejan wrote:
> Computer which hosted a database crashed, but I managed to save "data"
> folder. I copied it to another computer and pointed postgres to that folder
> (stopping the service first). But, the service cannot start. Progress bar
> just goes for awhile, and then a pop-up tells me that the service stopped.
>
> I found in Services that command for starting the service is this
>
> "C:\Program Files\PostgreSQL\8.2\bin\pg_ctl.exe" runservice -w -N
> "pgsql-8.2" -D "f:\PostgreSQL\data\"
>
> I tried to start it from command line with
>
> "C:\Program Files\PostgreSQL\8.2\bin\pg_ctl.exe" start -w -D
> "f:\PostgreSQL\data\"
>
> and it works.

The permissions on the data directory are wrong. Stop PostgreSQL, then
update the permissions on the data directory so that the PostgreSQL user
account has "full control" over the data directory and all its contents.
Then re-start the service.

The reason it works when you run it from the command line is that you're
running it with the rights of a user who owns those files. When you
copied them, the copies were changed to your ownership.

If you look in the Event Viewer (under Control Panel / Administrative
Tools ) you'll see the full error from PostgreSQL, which should mention
permissions problems.

--
Craig Ringer