View Single Post

   
  #3 (permalink)  
Old 04-17-2008, 09:18 PM
Keith Worthington
 
Posts: n/a
Default Re: Creating a clean database

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


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Reply With Quote