Re: Creating a clean database

From: Keith Worthington <KeithW(at)NarrowPathInc(dot)com>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Creating a clean database
Date: 2005-01-04 12:15:56
Message-ID: 41DA88FC.2010605@NarrowPathInc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Michael Fuhr wrote:

>On Mon, Jan 03, 2005 at 09:13:56PM -0500, Keith Worthington wrote:
>
>
>
>>I have finished a testing phase and I would like to create a production
>>database. My thought is to use pg_dump to create a backup of the data
>>dictionary, create a new database using pgadminIII or psql and then use
>>something (pg_restore or psql or ?) to rebuild all of the database
>>objects. I am hoping that a technique is available that will allow me
>>to get all new oids and reset all sequences. Suggestions will be
>>appreciated.
>>
>>
>
>Have you looked at the documentation for pg_dump, in particular
>the --schema-only and --data-only options? If those won't work
>then please be more specific about what you're trying to do.
>
>
Yes I have and I believe I understand how to use pg_dump for the most
part. The last time I used pg_dump and pg_restore to create a new
database. The procedure went something like this:
1) pg_dump
2) psql create database testdb
3) pg_restore
This seems to have the affect of keeping OIDs. Are OIDs universal to an
installation or specific to a database? I thought that when I created
the new database the OIDs would start over at 0 but they didn't appear
to do so. I will check later but I am not sure whether or not the
sequences were reset to 1 or not either. My desire is to simply create
a clean database. I have read about OID counter wraparound and how that
can be bad but I do not yet understand the implications of this issue.

I suspect that I need to use pg_dump to output the SQL commands
necessary to create the data dictionary and then run these commands via
psql. Do I just cat the file into psql? i.e. cat data_dictionary.sql
> psql -database NEWDB -username postgres

--
Kind Regards,
Keith

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Andreas Kretschmer 2005-01-04 13:03:18 Re: [despammed] Day name, month name from a datetime field
Previous Message Deepa K 2005-01-04 12:13:34 Day name, month name from a datetime field