On 06/12/2012 09:01 PM, gipsy-king1 wrote:
Dear all
I want to import a postGIS-DB backup-file.
When I execute this command:
*pg_restore -i -h localhost -p 5432 -U postgres -d THS -v
"<path>/alkis.backup" > "<path2>\output.txt" 2>&1*
I get an textfile with all outputs. There are lots of ERRORs like this:
When you create the database to restore to, create it from template0.
postgres# CREATE DATABASE "THS" WITH TEMPLATE template0;
... adding any LOCALE, ENCODING, OWNER, etc directives you need too.
That'll ensure you're stating with an empty target to restore to.
Alternately, you can use pg_restore with the -C option to tell it to
make a new database to restore to. It'll create a new DB with the same
name as the one you dumped, and restore to it. Strangely, you must tell
pg_restore to connect to a different database in order to create a
database, eg:
pg_restore -C --dbname postgres -U postgres -h localhost -p 5432 -i
-v <path>/alkis.backup
will restore to a NEW database (not to the postgres database) created
with the same name as the db that was dumped had. Note, however, that
this WILL NOT WORK if you're restoring a dump made on Linux to a Windows
box or vice versa due to a limitation/bug in how PostgreSQL and
pg_restore handle locales and encodings. You must use the CREATE
DATABASE followed by separate pg_restore method in that case.
--
Craig Ringer
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general