Archive for the 'database' Category

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 […]


install PostgreSQL in Mac OSX via Homebrew

March 10th, 2010

Apple OSX Snow Leopard
System Version: Mac OS X 10.6.2
Kernel Version: Darwin 10.2.0
Install notes for PosgreSQL 8.4 install using the great
Homebrew by Adam Vandenberg.
Run the author’s installation script, and that’s it. Try:
$ brew help
$ brew search postgresql
$ brew install postgresql
==> Summary
/usr/local/Cellar/postgresql/8.4.2: 2297 files, 31M, built in 3.3 minutes
$ brew info postgresql
postgresql 8.4.2
My advice ? Use Homebrew. True UNIX […]


pg_upgradecluster 8.2 main

February 12th, 2008

PostgreSQL 8.3 is here. After apt-get’ing it, the upgrade didn’t move the 8.2 cluster up. Having 8.2 running in a custom port, made 8.3 go use the standard 5432 port.
8.3 created a main cluster.
Check ports:
$ sudo netstat -anput | grep postgres
Check wich configuration files and wich versions are running:
$ ps -Af | grep postgres
pg_upgradecluster when […]