PDA

View Full Version : Installing postgres on a different spot



El Helado
10-20-2010, 09:00 PM
I have no option to choose where to install postgres (like in the old version) and I use real big DBs and do not wish to clog up my 50 gb-windows-partition so I am wondering how I can change postgres-storage?

morny
10-21-2010, 12:32 AM
The idea of the combo installer is to make the user make as little changes as possible so this feature isnt available but you can use any of the installers on the main PostgreSQL download site and it will allow you to change any settings

loustic
10-21-2010, 06:41 AM
You can easily use a new data folder.

Check that procedure. Just a little change, assuming you use PostgreSQL 8.4, the registry key to look for is "postgresql-8.4" instead of "pgsql-8.3RC2"

Change the default PGDATA directory on Windows - PostgreSQL Wiki (http://wiki.postgresql.org/wiki/Change_the_default_PGDATA_directory_on_Windows)

I highly suggest that you backup your registry first, or at least export the "postgresql-8.4" key before, if you're not familiar with that kind of changes.

For instance if you use a standard installation of PostgreSQL 8.4, your registry key would change from:

C:/Program Files/PostgreSQL/8.4/bin/pg_ctl.exe runservice -N "postgresql-8.4" -D "C:/Program Files/PostgreSQL/8.4/data" -w

to:

C:/Program Files/PostgreSQL/8.4/bin/pg_ctl.exe runservice -N "postgresql-8.4" -D "L:/HEM Database/data" -w

Where L:/HEM Database/data would be your new location for the data, and obviously this one is just an example, you can choose the location you want :)

Don't forget when you move your data folder, just take the data folder and not all of the folders!!
Also, I suggest that you copy instead of moving the data folder, for instance from C:/Program Files/PostgreSQL/8.4/data to L:/HEM Database/data.

Only when the copy is over and you are sure all the files are copied, you can delete the data folder on C:/Program Files/PostgreSQL/8.4/data

http://img529.imageshack.us/img529/6025/postx.jpg

If you do that, the database engine will be in "Program files" folder, and the database will be in a specific disk or partition, which is recommanded.

After you've made these changes, any database you'll create will automatically be created in that new location.