Thread: Creating a database

Creating a database

From
Richard Francis Duggan
Date:
Hi

I am trying to create a database and use the following command:
'createdb <database-name>'

However I get the following error:
ERROR:  CREATE DATABASE: could not initialize database directory
createdb: database creation failed

I am pretty sure that the database is up and running, I used the command
'ps -aux | grep "postures"' and got back the following :
postgres  9510  0.0  0.3  1292  512 pts/2    S    11:22   0:00 grep
postures

I was hopeing(praying!) if anyone could help me...

Thanks a lot,

Richie

=========================================================
Richie Duggan
Computer Science IV
University College Cork
Eamil : dugganr@student.cs.ucc.ie   richie_dug@yahoo.com
Homepage : http://student.cs.ucc.ie/01/dugganr/index.html


Re: Creating a database

From
Tom Lane
Date:
Richard Francis Duggan <dugganr@student.cs.ucc.ie> writes:
> I am trying to create a database and use the following command:
> 'createdb <database-name>'
> However I get the following error:
> ERROR:  CREATE DATABASE: could not initialize database directory
> createdb: database creation failed

Hm.  That's not an especially easy error to get ... to get that far,
you must have a running postmaster and a working template1 database.
Furthermore you don't have a permissions problem, because it already
was able to create the new subdirectory for the new database.  What's
failing is the 'cp' command to copy files into that subdirectory from
template1.  Most odd.

What platform are you on?  What's the name of the intended new database?
Also, just reaching at straws, what's the PGDATA setting you are using
(full pathname)?

            regards, tom lane

Re: Creating a database

From
Ben Stringer
Date:
Tom Lane wrote:
>
> Richard Francis Duggan <dugganr@student.cs.ucc.ie> writes:
> > I am trying to create a database and use the following command:
> > 'createdb <database-name>'
> > However I get the following error:
> > ERROR:  CREATE DATABASE: could not initialize database directory
> > createdb: database creation failed
>
> Hm.  That's not an especially easy error to get ... to get that far,
> you must have a running postmaster and a working template1 database.
> Furthermore you don't have a permissions problem, because it already
> was able to create the new subdirectory for the new database.  What's
> failing is the 'cp' command to copy files into that subdirectory from
> template1.  Most odd.

Richard - Is there room on the filesystem for your new DB? Are there any
quotas on usage of disk space in your environment?


>
> What platform are you on?  What's the name of the intended new database?
> Also, just reaching at straws, what's the PGDATA setting you are using
> (full pathname)?
>
>                         regards, tom lane

--
_____________________________________________________________
 Ben Stringer
 Burbong Consultants P/L   ACN 092 664 198
 ben@burbong.com    http://www.burbong.com   ph 0402 211 638

Re: Creating a database

From
Fred Yankowski
Date:
On Wed, Jan 10, 2001 at 01:32:03PM +0000, Richard Francis Duggan wrote:
> I am trying to create a database and use the following command:
> 'createdb <database-name>'
>
> However I get the following error:
> ERROR:  CREATE DATABASE: could not initialize database directory
> createdb: database creation failed

I'm getting a similar response to createdb on my NT4 system running
Postgres 7.0.3, but only when I run postmaster/postgres as an NT
service.  It works OK if I run postmaster from a bash shell.

I think this is because the 'rm' and 'cp' commands are not in the PATH
used when running NT services in my current configuration.
dbcommand.c calls 'rm' and 'cp' (without any directory path) via
system() in the course of doing createdb.

I've changed my system PATH variable so that the commands should be
found, but I need to reboot the system so that services pick up the
new PATH (is there any less drastic way to get that effect on NT?).
The machine I'm installing postgres on is a remote host and it hangs
during reboot (needs attention on system console) so I can't reboot it
with VNC.  I'm about to have a sysadmin help me with that so I can
find out if the PATH changes actually fix the problem.

I think I'm seeing more subtle problems that relate to the some
underlying problem.  I created a SEQUENCE table, then dropped it, and
now I can't seem to create it again with the same name.  I think
that's happening because there is still a file in pgsql/data/testdb/
with the name of the SEQUENCE, and I'm assuming that some 'rm' quietly
failed when I dropped the sequence.  I'll be able to test that theory
later today, once I reboot the server.

I'm still looking for a clean way to run postmaster as an NT service.
Running it via 'invoker' starts up OK, but does not shut down cleanly.

--
Fred Yankowski           fred@OntoSys.com      tel: +1.630.879.1312
Principal Consultant     www.OntoSys.com       fax: +1.630.879.1370
OntoSys, Inc             38W242 Deerpath Rd, Batavia, IL 60510, USA