wiki:CookBook postgres

Version 23 (modified by celine, 15 years ago) (diff)

--

back to first page ..
back to CookBook Eda

CookBook postgres


Saving a database : either use pgAdmin or in case of problems (cedric) use the script below...

C:\"Program Files"\PostgreSQL\8.4\bin\pg_dump.exe --host localhost --port 5433 --username postgres --format custom --blobs --verbose --file "C:\Documents and Settings\cedric\Mes documents\Migrateur\eda\BDMAP\export_BDMAP_pgsql_05022010.backup" "BDMAP"

Create a new postgres database with argis template
Restore the backup file
Cédric

REM move to local file where backup is stored
cd C:\Documents and Settings\cedric\Mes documents\Migrateur\eda\BDMAP
REM using postgresSQL 8.4
C:\"Program Files"\PostgreSQL\8.4\bin\pg_restore -d BDMAP -U postgres -p 5433 export_BDMAP_pgsql_05022010.backup

Céline

REM move to local file where backup is stored
cd C:\Celine Jouanin\workspace\EDA
C:\"Program Files"\PostgreSQL\8.4\bin\pg_restore -d BDMAPEDA -U postgres -p 5432 export_BDMAP_pgsql_19012010.backup

How to save only a table here I assume that the database is BDMAP user is postgres and table is codier

CD where\you\want\to\place\your\table
C:\"Program Files"\PostgreSQL\8.4\bin\pg_dump  -U postgres -p 5433 -t stationsp2 BDMAP> stationsp2.sql

How to load this table in another database here the file is restored into the CCM_EDA database

C:\base>C:\"Program Files"\PostgreSQL\8.4\bin\psql -d CCM_EDA -p 5433 -U postgres -f stationsp2.sql

How to save only a schema

--schema=<SCHEMA>