Archive for December, 2011

PostgreSQL custom Restore

December 7th, 2011

On dumping and restoring PostgreSQL databases, there may be the case for restoring selected tables from a global db dump.
For this to happen one needs to have the right options when dumping the data.
pg_dump
$ pg_dump -Fc -U username database_name > db_dump
Now, we have a “restore customizable” compressed dump of the database.
From the postgres documentation:
  -F format
  –format=format
    Selects […]


Convert SQL Server database to PostgreSQL via CSV

December 2nd, 2011

Needed to convert a client Microsoft SQLSERVER database to our PostgreSQL database server.
Lots of tables, severall Gigabytes of data.

In Windows:

open the SQL Server administration console for the databae and do a DIR > tables.txt to get a file with all the table names;
remove all the tables you will not be needing from the file;
now to […]