How To: Set up a hotswap drive to share databases

Frequently Asked Questions/Answers, Tutorials, and Common How To's

Moderator: Moderators

How To: Set up a hotswap drive to share databases

Postby prajna » Sat Nov 22, 2008 7:36 pm

Quick links


Overview
This guide is to help an individual set up their database on a hot swappable hard drive.
By doing this, you can take your hard drive with you to another computer and use the same database. This gets around the networking issues some have with PostgreSQL and allows you to use your database outside your local network.

This guide assumes you already have PokerTracker 3 installed on two computers but have separate databases for the two installations. It is written from the point of view of a Vista user, but it does tell some of the similarities of XP and Vista.
prajna
 
Posts: 734
Joined: Thu Apr 03, 2008 1:58 pm

Backup databases in pgAdmin III

Postby prajna » Sat Nov 22, 2008 7:38 pm

EDIT: This guide was written before Backup and / Restore functionality was added to PokerTracker 3.
You can now backup and restore databases from within PT3.
The following directions will still work, but it is easier to do the backup and restore from within PT3.
Click here for more information


Go to Start -> Programs -> PostgreSQL-> pgAdmin III.
Double click on the server in the left hand part of the screen and put in the password if prompted (which should be dbpass).
If this doesn’t work, disable your password for PostgreSQL (How To: Remove PostgreSQL Password) and try again.

Once logged in, click on database and you will see all the databases you have in your PostgreSQL server.
This guide will show how to backup and restore PT3 databases.

All the databases listed EXCEPT for the database named postgres are databases you have created.
Right click on one of them and select Backup.
Select compressed, and press the “…” button.
Name your backup file and choose a folder to save it to (e.g. in "My Documents").
Click on Save, then click on OK.
Depending on the size of your database, the time can be anywhere from a few seconds to several minutes.
Do this for each of your databases.

Image
prajna
 
Posts: 734
Joined: Thu Apr 03, 2008 1:58 pm

Prepare the Hotswap Drive

Postby prajna » Sat Nov 22, 2008 7:40 pm

Go to Start -> Computer.
You will come to this window many times in this part of the guide (we’ll call it the “My Computer window”).
Right click on your Hotswap drive and choose Rename and give it some name in reference to the fact it’s your database (for instance, I named mine pg_8_3_4).

Go back to the My Computer window, right click on your Hotswap drive and choose Format.
Make sure it is set to NTFS and a block size of 4096.
Choose Quick Format, then click on Start.

Now, we need to assign this a drive letter that is available on both computers.
Go to Start -> right click on -> Computer -> Manage.
Now click on “Disk Management” .
Right click your hotswap drive and choose Change Drive Letter and Paths.
Click on Change…, then click on “Assign the following drive letter “ and select “P” from the drop down menu (P is for PostgreSQL in this case). Ignore the warning (yes, you want to continue).
prajna
 
Posts: 734
Joined: Thu Apr 03, 2008 1:58 pm

Uninstall PostgreSQL

Postby prajna » Sat Nov 22, 2008 7:42 pm

Go to Start -> Control Panel.
Select Programs and Features (Add/Remove Programs for XP).
Wait for this list to populate.
Right click on PostgreSQL and choose Uninstall.
Take a note of the version number you see.

In Vista, click on Start -> All Programs -> Accessories -> right click on -> Command Prompt -> Run as Administrator.
In XP, just click on Command Prompt in the same Start folder you have.
At the command prompt type net user /delete postgres.
If it did not say “The command completed successfully” then you did not do this step correctly (which is important).

If you get something along the lines of “user access denied”, in Vista this means you are not running the command prompt as an administrator, try running the command prompt in administrator mode again.
If in XP, you probably are using a limited account to do this. You need to change accounts to an administrator account. Once completed type “exit”.

You can now go to Start -> Computer -> C: -> Program Files -> right click on -> PostgreSQL -> Delete.
Before doing this make sure you have all your data backed up and secured.
prajna
 
Posts: 734
Joined: Thu Apr 03, 2008 1:58 pm

Download and install PostgreSQL

Postby prajna » Sat Nov 22, 2008 7:43 pm

Go to here, or to whatever version of PostgreSQL you wish to install - you should generally get the lastest version within the same major update as you were already running; for instance if you had 8.3.4 before you could install 8.3.8 now - (Postgresql 8.3.4 Download) and get PostgreSQL.
Once downloaded, extract EVERYTHING to a temp folder, double click on postgresql-8.3. If you get an error that says, “please use the main MSI file”, you double clicked on the wrong one. Try the other install file you see.

When you get to this screen, select browse and install it on your P: drive at P:\PostgreSQL\8.3 (click on the new folder icon in the upper right to create a new folder).

Image

Click on next, then click on it again. It will tell you it generated a random password.
Ignore this, click on OK and you will be presented w/this screen:

Image

Choose the password dbpass for the two boxes highlighted here. Now click on next until it installs.
prajna
 
Posts: 734
Joined: Thu Apr 03, 2008 1:58 pm

Restore databases

Postby prajna » Sat Nov 22, 2008 7:45 pm

EDIT: Again, PT3 now has backup and restore functionality built in so you should restore your databases in the same way that you backed them up.

With PostgreSQL now installed on your hotswap drive, go to Start -> Computer -> C: -> Program Files -> Pokertracker 3 -> Data -> Config. Right click on -> Pokertracker.cfg -> open with… and select Notepad.
Scroll until you find the section labeled “[Database]”.

You need to remove any part of this section of the config file which starts with DB#.
In my screenshot here, you can see I have two databases.
However, you need to remember the PostgreSQL database name. My DB1’s name is massivedb50nlftp and DB2 is pstars_micro.
One you have your database names written down, remove these lines from the document and save it. If you get an error when trying to save it that says it cannot find the path, then you are in Vista. You need to save the file on your desktop, then drag it back into your config folder in Pokertracker 3 to overwrite this file.

Image

Once edited, saved, and in the config folder, you can start up PT3 again. When you start it this time, it will want to create a database right off the bat.
Name this database the name of one of your previous databases (I am going to name my pstars_micro).
Once created, close pt3.

Now go to Start -> Programs -> PostgreSQL -> pgAdmin III.
Double click on your server, put in the password (dbpass), then click on Databases and right click on the database you just created (in my case pstars_micro) and choose Restore. Click on the “…” button and select the backup file you made of this database before uninstalling PostgreSQL. If you get an exit code of “1” you are okay.

Now run PT3 again. You should now have your database restored. To restore any other PT3 databases you have, click on Database -> Database Management, then click on New. Name it the same name it was before, have PT3 create it, then close PT3 and do the same steps above to restore that database.
prajna
 
Posts: 734
Joined: Thu Apr 03, 2008 1:58 pm

PostgreSQL shutdown and startup

Postby prajna » Sat Nov 22, 2008 7:45 pm

It is time to move to the other computer and get it synched up to this hotswap drive.

You will and MUST do this EVERY TIME you move the hard drive from one system to the other or you risk losing the database server.

On your main/first computer:
Close PT3, then go to Start -> right click on -> Computer -> Manage.
Go to Applications and Services -> Services.
Find PostgreSQL in the list, right click -> Stop Service. You may now safely remove your hard drive.

When you move the hard drive from one computer to the other, you always must stop the PostgreSQL service before unplugging the hard drive.

You should also make sure the PostgreSQL service is NOT running on the other computer before you attach the hotswap drive.
When you have it plugged into the new computer, start the PostgreSQL service there.
To do this, go to the same place you went to stop PostgreSQL, but select Start Service instead of Stop.
prajna
 
Posts: 734
Joined: Thu Apr 03, 2008 1:58 pm

2nd Computer

Postby prajna » Sat Nov 22, 2008 7:46 pm

If PostgreSQL was installed on this computer, follow the guide to uninstall it.

Now plug in your hard drive and go through the steps here to change it to drive P: as you did on the first computer.
Now download postgresql 8.3.4 again.
Run the installer on the new computer, and again set it to install to P:\PostgreSQL\8.3.
Again let it create the password for the service, but when it gets to the screen where you would put in the password “dbpass”, UNCHECK INITIALIZE DATABASE. Let it install.

Once installed, go to Start -> Computer -> C: -> Program Files -> Pokertracker 3 -> Data -> Config and edit the Pokertracker.cfg file here (like you did on the first computer).
Remove all database information from it and save it.

Now run PT3.
When the configuration screen comes up to configure PostgreSQL, make sure you have in the correct password (“dbpass”). Click on connect.
Now it wants to create a database.
Check “This Database Already Exists”, then click on Browse. Select your database, then click on connect.

You now have the same database at your disposal on each computer!

Remember to shut down the PostgreSQL service when moving your hard drive or it will fail!!!

When you plug it into the new computer, remember to start the service (click on Start -> Programs -> PostgreSQL -> Start Service).

~ Thomas
[PokerTracker Support]
prajna
 
Posts: 734
Joined: Thu Apr 03, 2008 1:58 pm


Return to FAQs, Tutorials, and How To's [Read Only]

Who is online

Users browsing this forum: No registered users and 10 guests

cron