hi,
I'm trying to make some hardware upgrades (increasing disk capacity)
to the machine where the database server is running. So, I've backed
up all the existing databases using the following command:
pg_dump -f <location_for_dump> -Fc -v <dbname>
I want to restore these databases on a different machine. I've got the
postmaster installed and running (version same as on old one). To
restore the databases i tried the following command:
pg_restore -v -d <dbname> <dump_location>
to which i got the following error:
pg_restore: connecting to database for restore
pg_restore: [archiver (db)] connection to database "abc" failed: FATAL: datab
ase "abc" does not exist
pg_restore: *** aborted because of error
Realizing my mistake i used the following command:
pg_restore -v -C -d template1 <dump_location>
to which i got the following error:
pg_restore: connecting to database for restore
pg_restore: creating DATABASE abc
pg_restore: [archiver] could not set session user to "abc": ERROR:
user "abc" does not exist
pg_restore: *** aborted because of error
So, seeing this i first made the user, using 'createuser' and then
created a database using 'createdb'. Now, since i have many users do i
have to everytime createuser and createdb for each user and database.
Is there any way of copying/dumping/restoring the user and group
information and permissions from the old machine to the new one so
that i do not have to do a createuser everytime??
Could somebody help me out with this please. Thanks in advance.
Cheers,
Pritesh