pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Starting PostgreSQL from a windows application
3+ messages / 3 participants
[nested] [flat]

* Starting PostgreSQL from a windows application
@ 2006-07-26 17:26 Hovik Avedian <havedian@ebasetech.com>
  2006-07-26 17:48 ` Re: Starting PostgreSQL from a windows application Andy Shellam <andy@andycc.net>
  2006-08-18 11:33 ` Re: Starting PostgreSQL from a windows application Magnus Hagander <mha@sollentuna.net>
  0 siblings, 2 replies; 3+ messages in thread

From: Hovik Avedian @ 2006-07-26 17:26 UTC (permalink / raw)
  To: pgsql-admin

Hello,

I have installed Postures on a Windows server and it starts as a service and all is OK.

I have 2 questions:

1. I need to be able to wrap PostgreSQL as part of my application and, therefore, start it as part of my app. start-up. I know that pg_ctl start is the command, but as your documentation clearly states, PostgreSQL can only be started by a non-privileged user. Here lies my problem.
Most software needs a privileged user to start it. So how can I start PostgreSQL as a different user from the one which needs to be logged in to start the other software?

2. How do I give my users a totally new database. Is backup/restore the only mechanism?
Can I copy (parts of) the data directory, from one installation of PostgreSQL to another?

Thanks in advance for your support,

Hovik Avedian
Senior Consultant
Ebase Technology Ltd.

 

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Starting PostgreSQL from a windows application
  2006-07-26 17:26 Starting PostgreSQL from a windows application Hovik Avedian <havedian@ebasetech.com>
@ 2006-07-26 17:48 ` Andy Shellam <andy@andycc.net>
  1 sibling, 0 replies; 3+ messages in thread

From: Andy Shellam @ 2006-07-26 17:48 UTC (permalink / raw)
  To: havedian@ebasetech.com; +Cc: pgsql-admin

Hi Hovik:
> Hello,
>
> I have installed Postures on a Windows server and it starts as a 
> service and all is OK.
>
> I have 2 questions:
>
> 1. I need to be able to wrap PostgreSQL as part of my application and, 
> therefore, start it as part of my app. start-up. I know that pg_ctl 
> start is the command, but as your documentation clearly states, 
> PostgreSQL can only be started by a non-privileged user. Here lies my 
> problem.
> Most software needs a privileged user to start it. So how can I start 
> PostgreSQL as a different user from the one which needs to be logged 
> in to start the other software?
You would need the commands to start and stop a Windows service ("net 
start <ServiceName>" I believe).  Does it really matter that PostgreSQL 
is running while the application isn't?
>
> 2. How do I give my users a totally new database. Is backup/restore 
> the only mechanism?
> Can I copy (parts of) the data directory, from one installation of 
> PostgreSQL to another?
NO!! Never touch the raw PostgreSQL data files.  You could, as part of 
your application, build in an SQL script of your DB schema, created by 
"pg_dump --schema-only" that gets run through psql, or piped to an 
Npgsql .NET library, ODBC connection or other technology.
>
> Thanks in advance for your support,
>
> Hovik Avedian
> Senior Consultant
> Ebase Technology Ltd.
>
>
> !DSPAM:14,44c7a9ac143291148420564! 

-- 
Andy Shellam <mailto:andy.shellam@mailnetwork.co.uk>,
the Mail Network <http://www.mailnetwork.co.uk/;

NetServe Support - we don't go the extra mile; we go the whole distance!

p: (+44) 0 845 838 0879 / +44 0 7818 000834
w: www.mailnetwork.co.uk <http://www.mailnetwork.co.uk/;
e: support@mailnetwork.co.uk <mailto:support@mailnetwork.co.uk>






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Starting PostgreSQL from a windows application
  2006-07-26 17:26 Starting PostgreSQL from a windows application Hovik Avedian <havedian@ebasetech.com>
@ 2006-08-18 11:33 ` Magnus Hagander <mha@sollentuna.net>
  1 sibling, 0 replies; 3+ messages in thread

From: Magnus Hagander @ 2006-08-18 11:33 UTC (permalink / raw)
  To: havedian@ebasetech.com; pgsql-admin

> I have installed Postures on a Windows server and it starts as a
> service and all is OK.
> 
> I have 2 questions:
> 
> 1. I need to be able to wrap PostgreSQL as part of my application
> and, therefore, start it as part of my app. start-up. I know that
> pg_ctl start is the command, but as your documentation clearly
> states, PostgreSQL can only be started by a non-privileged user.
> Here lies my problem.
> Most software needs a privileged user to start it. So how can I
> start PostgreSQL as a different user from the one which needs to be
> logged in to start the other software?

This will be fixed in 8.2 (it's fixed in the development snapshots). You
can find backported versions of initdb and pg_ctl on
http://people.planetpostgresql.org/mha/index.php?/archives/93-Backported
-run-as-admin-tools.html.

I would not recommend these for a big production deployment, because
they are *not* official PostgreSQL binaries (the database backend still
is, though, so it *should* be safe. But they have not been as well
tested as postgresql-proper). But for a pilot install that will go to
8.2, definitely worth using.


> 2. How do I give my users a totally new database. Is backup/restore
> the only mechanism?
> Can I copy (parts of) the data directory, from one installation of
> PostgreSQL to another?

Backup/restore, or you can create a manual sql script that you pass to
psql that generates all your objects.


//Magnus




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2006-08-18 11:33 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-07-26 17:26 Starting PostgreSQL from a windows application Hovik Avedian <havedian@ebasetech.com>
2006-07-26 17:48 ` Andy Shellam <andy@andycc.net>
2006-08-18 11:33 ` Magnus Hagander <mha@sollentuna.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox