PDA

View Full Version : Moving PostgreSQL folder



_Loki_
01-31-2010, 02:05 PM
Non urgent question...

I'm planning to move my PostgreSQL folder from C:\Program files\PostgreSQL to C:\PostgreSQL - but I'm unsure of the process. I think that HM finds the DB via the port number so there is no 'path' to change

** Is this what I should do ?:

1] Close HM & pgSQL server
2] Move folder to new location
3] Change the paths in Start > Programs > PostgreSQL so that the shortcuts still work (or delete shortcut & make a new shortcut)
4] Reboot
5] Open & Test

** General interest questions:
What is this 'port number' thing ?
I guess it's a way of describing a path ?
It reminds me of the way devices on a network in UNIX or on USB are numbered so that the packets of data can find their destination

netsrak
02-01-2010, 07:36 AM
Its not that easy because you have to reconfigure the Postgresql server (easiest is a reinstall with the new path and restoring database backup)

The communication port is indeed a network TCP/Ip Port which Postgresql uses for the communication with the clients. So there is no change required in Holdemmanager when moving postgresql.

Btw. if you google for "move postgresql data folder" you should find lots of descriptions.

_Loki_
02-01-2010, 10:03 AM
Thanks Netsrak

It's the whole PostgreSQL folder I plan to move not just the data folder (I assume the data folder is inside the PostgreSQL folder)

I will google as you advised

netsrak
02-01-2010, 12:13 PM
Its not possible to move the whole Postgresql installation - you need to reinstall it.

_Loki_
02-01-2010, 04:53 PM
ty netsrak

fozzy71
02-01-2010, 07:00 PM
Its not that easy because you have to reconfigure the Postgresql server .......

It is actually rather simple. You only have to change one setting in regedit. We have a FAQ, that is part of another FAQ, and I am going to re-write that section as it's own FAQ.


.......r (I assume the data folder is inside the PostgreSQL folder)

....d

Yes


Its not possible to move the whole Postgresql installation - you need to reinstall it.

This

_Loki_
02-01-2010, 09:13 PM
ty netsrak & fozzy. I've changed my mind about 'moving' the whole folder - doesn't seem worthwhile

################


It is actually rather simple. You only have to change one setting in regedit. We have a FAQ, that is part of another FAQ, and I am going to re-write that section as it's own FAQ

My machine is poker dedicated...

I suppose that FAQ is about moving the DB part of PostgreSQL to another partition ?

Using Pertition Wizard I would like my db to sit in the most efficient part of my only HDD on its own newly created partition (lets call it A:\) with nothing else except for some poker vids & poker ebooks. So I'm interested in seeing the proposed new FAQ - I will keep my eyes peeled (painful)

I'm confused about where the best place to put A:\ is. From the little I've read I *think* it's as far as possible to the inside of the disc near to the spindle. So I would put A:\ before C:\. That also puts the db near my XP MFT & system files on C:\. The reason I'm confused is the outside of the disc is the place where the track is moving under the head fastest so isn't that where the head can read/write quickest ?

Am I talking rubbish - it's all new to me ?

fozzy71
02-01-2010, 09:31 PM
ty netsrak & fozzy. I've changed my mind about 'moving' the whole folder - doesn't seem worthwhile

################



My machine is poker dedicated...

I suppose that FAQ is about moving the DB part of PostgreSQL to another partition ?

Here is the section of the old FAQ that I am re-writing/updating. I followed these steps and easily moved my DB from C:\ to A:\


First you need to have PostgreSQL installed on the C drive where windows is installed but you need to install the Data folder i.e Database on the external hard drive. We need to close down the PostgreSQL service while doing this. Go to start > Control Panel > Administrative Tools (Use classic View) > Services

This will bring up the following window:

http://208.109.95.123/faq/files/Image/postgreServices.jpg

Right click this and choose Stop to stop the service.

Then create the following folders in the external hard drive. Program Files and inside that folder create a PostgreSQL folder and inside that create a data folder. So if your external hard drive is on the D drive you would have created a path D:\Program Files\PostgreSQL\data

Then go to where you have the data folder which will be c:\program files\PostgreSQL\8.2\data by default unless you changed it. Copy all the files in here to the new data folder we just created above on the external hard drive. If this is a big database this may take some time.

When youve done that we need to tell PostgreSQL where the new data folder is located and to this we need to edit the registry.

Windows XP
Go to Start > Run and type the following in the textbox: regedit and then press enter and a new window should appear like in the screenshot below:

Windows Vista/W7
Go to Start > All Programs > Accessories > Run then type the following in the textbox: regedit and then press enter and a new window should appear like in the screenshot below:

http://208.109.95.123/faq/files/Image/2PCpostgresRegedit.jpg

Navigate the folders to this path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\pgsql-8.2 and you should then see the following screen:

http://208.109.95.123/faq/files/Image/2PCpostgresRegedit2.jpg

In the image above ive highlighted the key we need to change. Go to image path and right click and choose modify and you should see the following:

"C:\Program Files\PostgreSQL\8.2\bin\pg_ctl.exe" runservice -w -N "pgsql-8.2" -D "C:\Program Files\PostgreSQL\8.2\data\"

Now we need to only change the bit thats in bold. This is the location that PostgreSQL looks for the database files but weve moved them to the external hard drive so we must tell it the location. Make sure you get the path exactly correct. The easiest way is to navigate to the actual Data folder on the external hard drive and right click any file inside that folder and choose properties and youll see this:

http://208.109.95.123/faq/files/Image/2PCpostgres6.jpg

As you can see for location it shows the actual path, in my case its the I drive but yours maybe different so just copy and paste it. So if i was creating the key based on that screenshot my old key would be:

"C:\Program Files\PostgreSQL\8.2\bin\pg_ctl.exe" runservice -w -N "pgsql-8.2" -D "C:\Program Files\PostgreSQL\8.2\data\"

And i should change it to this:
"C:\Program Files\PostgreSQL\8.2\bin\pg_ctl.exe" runservice -w -N "pgsql-8.2" -D "I:\Program Files\PostgreSQL\8.3\data\"

That now has everything in place so we should close everything down and make sure to reboot the PC.




Using Pertition Wizard I would like my db to sit in the most efficient part of my only HDD on its own newly created partition (lets call it A:\) with nothing else except for some poker vids & poker ebooks. So I'm interested in seeing the proposed new FAQ - I will keep my eyes peeled (painful)

I'm confused about where the best place to put A:\ is. From the little I've read I *think* it's as far as possible to the inside of the disc near to the spindle. So I would put A:\ before C:\. That also puts the db near my XP MFT & system files on C:\. The reason I'm confused is the outside of the disc is the place where the track is moving under the head fastest so isn't that where the head can read/write quickest ?

Am I talking rubbish - it's all new to me ?

I have no clue about any of this.

_Loki_
02-02-2010, 11:22 PM
Thanks Fozzy & Netsrak - all seems simple - will let you know if I hit a wall :)

Tony23
02-11-2010, 06:59 AM
hey fozzy

thx for this but got a problem
when I move/delete files from old folder (C:\Program Files\PostgreSQL\8.2\data\) there is a message while starting HEM that my database doesnt exist

what should i do ?

morny
02-11-2010, 12:49 PM
So you moved the data folder from C:\Program Files\PostgreSQL\8.2\data to what location?

After you moved it to the new location did you update the imagepath in the registry with the new location?

Tony23
02-11-2010, 03:27 PM
I did exactly what foxy wrote

first I copied data folder to F:\Program Files\PostgreSQL\8.3\data\

than changed imagepath to:
"C:\Program Files\PostgreSQL\8.3\bin\pg_ctl.exe" runservice -w -N "pgsql-8.3" -D "F:\Program Files\PostgreSQL\8.3\data\"

when I deleted data folder from C: it said that HEM cannot find database
(I copied it back to C: and HEM is working with changed imagepath (F:...), but i want to delet it from C: and dont know what to do)

morny
02-11-2010, 06:17 PM
You could try another method, but first id advise to export your hands if you dont have all your hands archived in case it works. Move your files to F:\Program Files\PostgreSQL\8.3\data\ like you did before

Follow this FAQ FAQ - Hold'em Manager Poker Tracking Software :: Reinstall PostgreSQL Preserving Old Database (http://faq.holdemmanager.com/questions/71/Reinstall+PostgreSQL+Preserving+Old+Database)

When you get to step 6, you can do 2 things, you can install the complete installation including postreSQL at the F drive or you can click on the Data Directory Node and change that to F:\Program Files\PostgreSQL\8.3\data\ as you probably know postgreSQL itself dosent take up much room its the data folder so either option will work well

Then continue on for the rest of the FAQ after which with a bit of luck it should connect.

Tony23
02-12-2010, 09:01 AM
you're the boss
thx