PDA

View Full Version : Dump DB - Uninstall PG - Reinstal PG - Restore DB



batmanhm
11-20-2011, 02:10 PM
Hello,

Steps I followed:

1. pgdump -U postgres HandHistoryHM > db.out
2. Uninstall Postgres
3. Install Postgres (different drive)
4. Create new DB HandHistoryHM using PGAdmin(just entered the name, left everything else as default).
5. psql -U postgres -e HandHistoryHM < db.out

db.out has a considerable 1.7Gb and I have no other backup of my hands.
The restore operation worked fine(there were no errors in the command line).

When I tried to start HM it asked me to create a new DB(which I did). That DB is the only one that shows in the list of databases inside HM.

I connected with PGAdmin to the 2 databses(empty one and HandHistoryHM) and they look identical in structure, privileges, etc. I can't figure out why HoldemManager does not realize that my HandHistoryHM database exists on the server.

Any clues?

Regards,
batman

Betpotbot
11-20-2011, 10:10 PM
Same problem here because as I mentioned in the thread http://forums.holdemmanager.com/general-support/151641-no-reports-sessions-after-backup-restore-moving-database-doesnt-work-all.html the backup/restore feature of hm2 didnt work at all.

So I used pgdump to backup manually but couldnt integrate my successfully recovered database in Holdem Manager anymore.

udbrky
11-22-2011, 05:51 AM
I will pass this along to some people more knowledgeable in postgres than I am.

batmanhm
11-24-2011, 09:52 AM
Bump to this. Already 4 days, 5th page and no answer.

Betpotbot
11-24-2011, 03:38 PM
Does this help?

http://forums.holdemmanager.com/bug-reports/154211-backup-doesnt-save-hm-database-folder.html

You have to copy the mentioned folder manually after using pgdump and psql. Then it should work. Not everything seems to be stored in the postgresql db. Dont know why (performance issues I think) but I think it is a huge disadvantage, at least for handling the db, for example when you want backup by scheduled script.

Folder is located in User/<User>/AppData/Roaming/HoldemManager/Data

batmanhm
11-25-2011, 04:10 AM
Thank you Betpotbot. I don't have that folder on my PC at that location. The closest that I could find is a folder called database(in AppData/Roaming/HoldemManager/), but it is empty.

Betpotbot
11-25-2011, 07:16 AM
you can specify that folder during hm installation. just create a new database in hm with a unique name. hm will create a folder with that name. search for it and then you know your hm database folder. Or just go to the restore tab in HM. There you can see it as well. I guess it is that folder above. have you ever created a database with hm or only used psql to restore a db?

The problem is that your postgre backup is worthless without the backup of that folder. I am pretty sure that you cant restore it anymore.

batmanhm
11-25-2011, 07:56 AM
Deam, now I know about what folder you are talking about... I deleted it, unfortunately, but thank you anyway, now I know what I need to do in the future. Then its great news for me that I managed to recover most of my hand history.

I will try at some point over the weekend to duplicate one small database see if I can manually complete the procedure from start to end. Then I will do it also for the big database to see how long it takes and how much space is needed for the backup files.

Can someone from HoldemManager confirm that this folder is necessary? And provide a way of recovering drive space(because it gets HUGE)? And maybe tell us when they plan to move all that data stored in shitty text files to the database(or at least use some sort of intelligent indexing&binary files)?

udbrky
11-26-2011, 03:15 PM
The DB is split between the postgresql folder and database folder in roaming. With the 2 folders, it's still a lot smaller than the HM1 DB and the PT3 DB for the same hands.

batmanhm
11-29-2011, 11:06 AM
So here it is:

Manual DB Copy:

Step 1: Create a DB with HM2 (NEW_DB).
Keep in mind the Database Parent Folder

Step 2: Copy the content of Database Parent Folder/OLD_DB into Database Parent Folder/NEW_DB
(Hint: it is faster to zip the contents, move the zip file then unzip it)
Info: The compressed zip file will be about 25% of the initial size of your folder.

Step 3: Export the DB using pg_dump(it is in your bin folder of Postgres)
Exact syntax is: pg_dump -U postgres OLD_DB > filename
You will be requested the password for the postgres user.
Info: Now this is going to take a while. For a 234 MB DB(as Holdem Manager showed) it took about 5 minutes and the resulting file was about 160MB. You can zip it with very good results.

Step 4 Import the file into the new DB using psql like this:
psql -U postgres -d NEW_DB -f filename
You will be requested the password for the postgres user.
Info This is going to take about the same as the export. For the same 234MB DB it took about 5 minutes and in the meantime there were a lot of messages shown in the command line, none of them of interest for us.

Step 5: Start HM 2 and select you and look at the reports to make sure everything is fine.

(I did not try to actually use this DB as a live DB, import some more hands in it while playing, but I see no reason for it not to work).

Info: The total size of the backup(ZIP old db + ZIP exported file) will be about 20-30% of your DB size, as shown by HM.


LE: a backup of a 5.3gb(shown in HEM, about 11 gb if you add the dedicated folder) lasts 3h 45m and the backup file is about 1.6gb in size.