PDA

View Full Version : Postgres data folder location



TJD
10-19-2010, 01:51 PM
I have 2 HDD on my machine. I have W7 installed on both.

I am in the process of getting one of them set up as a "clean" installation without all the junk on the other.

I installed HEM on the fresh one today.

I then:-

1) stopped the postgres 8.4 service

2) used regedit to alter ONE charachter in the image path from C to G (where G is the drive that system, postgres and its data etc sits) so that my new installation can see and use the old 8.4 database

3) Closed regedit down

4) closed and re-opened the services window

5) checked that the new location was changed to G: in services which it was

6) tried to restart the service but it timed out

This problem repeats even if I reboot. HEM can't start the service either

Both installations have log in as .\postgres in the services window

If I follow the steps above changing G back to C all is fine

I am the only user of this PC.

What is wrong please? I thought I had followed the instructions as given by HEM before but maybe I am missing something.

Cheers

Trevor

Patvs
10-19-2010, 06:28 PM
Can you delete the postgres user and reinstall SQL.

click on Start and go to Programs -> Accessories -> Command Prompt

* If you are on Vista, rightclick and choose "Run as Administrator".


A black box should appear. Type 'net user postgres /del' (without the quotes) and press enter.

The user is now deleted and you can (re)install PostgreSQL.



Download the SQL installer from PostgreSQL: The world's most advanced open source database (http://www.postgresql.org).


During installation, does it detect the installation on drive G?

TJD
10-20-2010, 01:07 PM
1) deleted user
2) UI Postgres
3) deleted the folder it left behind
4)C:/User/Postgres still existed despite deleting postgres
5) Re-booted machine "net user" cmd showed no sign of postgres but folder still there so I deleted it
6) Installed postgres 8.4 downloaded from their site used postgres and postgrespass as usual
7) It gave an option to choose a data directory and that may have allowed me to use g: but I did not try it because that is not the point of the original post (more later)
8) at no point in the installation did it refer to the cluster or the installation on the other HD drive (and why should it; I am installing on this one?)
9) HEM failed to find its default DB (details in config?) so I created another one - all OK
10) Then I followed instructions as explained in previous post with the same result. If I altered C to G in the registry; service would not start; replace it with C all is fine.

I do not WANT to point specifically at the cluster on the other drive. I want to find the method for being able to have the cluster where I want (and be able to move it at will) and be able to "point" postgres at it. For now, it is useful to point at the cluster on G because I can test HEM while still having the other DB where I want it for daily use. However, in time, I will have the cluster neither on C: nor G: but somewhere else where I can get both OS to point at it depending which one I decide to boot into.

A previous post on HEM (link below) seemed to give the instructions I followed in B) which was simply to alter the registry entry but that is not enough.

C:\Users\Trevor\Desktop\FAQ - Hold'em Manager Poker Tracking Software How do I setup Holdem Manager to share one database between two computers.mht

What have I done wrong here or is there another step in postgres config files somewhere that is needed as well?

Cheers

T

Patvs
10-20-2010, 04:54 PM
Just install SQL to G:.
If you want to move SQL to partition X: in the future.
-1 you uninstall PostgreSQL
-2 move the SQL data folder to partition X:
-3 install SQL to drive X:

Both changing the registry, and copying the data folder to a new location, BOTH have the risk that SQL suddenly won't run. And there's no fix for that.

Always make sure you also have a .backup file (backup in pgadminIII) of your database you can restore (to a new partition) AND the possibility to reimport all the original handhistories.

TJD
10-21-2010, 06:04 AM
Just install SQL to G:.
If you want to move SQL to partition X: in the future.
-1 you uninstall PostgreSQL
-2 move the SQL data folder to partition X:
-3 install SQL to drive X:

Both changing the registry, and copying the data folder to a new location, BOTH have the risk that SQL suddenly won't run. And there's no fix for that.

Always make sure you also have a .backup file (backup in pgadminIII) of your database you can restore (to a new partition) AND the possibility to reimport all the original handhistories.

you use SQL and postgresSQL almost inter-changeably is that what you intend or to "you" are SQL and postgresSQL different things

To you is SQL the "cluster" and postgresSQL the program that uses the cluster?

If so that mirrors what I thought as I was dropping off to sleep last night. Whenever I want to change the location just move the cluster and then re-install postgres from their own installer (not HEM packaged one) to allow me to choose the location.

Hopefully, if I do that it will "see" the cluster there and not create another one.

For other HEM users, I will confirm whether this works when I try later.:)

T

loustic
10-21-2010, 06:56 AM
TJD, the procedure you applied is just good to move the data folder, not the whole PostgreSQL engine and services ;)

I think you applied that procedure, which is correct to move the data folder, and only it :)

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

If you want to have service and engine pointing to a new location, you should simply uninstall & reinstall PostgreSQL :)

Don't forget to save all your databases to a safe location before !

And of course, if you want the uninstall to work properly, you must first change the registry key again to put it back to its origine state.

Move all your PostgreSQL folder to it's origine location on C:

TJD
10-21-2010, 08:21 AM
It was a problem of permissions; there is no need to re-install postgeSQL.

I did this:-

1) Stop service
2 Use regedit as in your link (and a previous HEM post) to alter location
3) Close and re-open services window and confirm location has altered correctly

4) NB!!!! Give postgres permissions to access the new directory (mine was simply "I:data" so all the sub-dirs indicated in HEM post are not required). Right Click folder - /Security/Edit/Add/put postgres as "Object name" and OK)/ make sure postgres has full control and OK. Permissions are now set

5) Reboot - I "think" this is required before permissions take effect but just to be safe

6) Check service is running; if not start it

7) Load HEM and we have the DB we pointed at in the changes above.

Without re-installing postgreSQL, I repeated the process to point at the cluster in my G: drive and HEM picked that up as well with no problem.

So everything I did before was fine and it will work. The reason it failed was because postgres did not have permission in this installation to use the other directory. That is why when we reverted to the installed one the service worked OK again because it DID have permission.

Cheers

Trevor