PDA

View Full Version : corrupt database



Newt_Buggs
09-16-2008, 02:18 PM
I wanted to transfer my HM database over to my second, much larger hard drive so I backed up my database, reinstalled Postgresql on my D drive, then restored the backed up database. The database restored fine and is intact, but I think its corrupted since whenever I try to import datamined hands the majority of hands get an import error instead of getting imported. I also tried exporting all of the hands from my restored database and importing them into a new database, but that didn't work either because a month ago i had purged some of the smaller hands to save space so my stats are skewed (My database says i'm a respectable 24/20 player instead of the 19/15 nit that I am).

Before I did any of this I made a second copy of my entire postgresql data folder onto my D drive, but am unsure how to restore from this. I tried reinstalling postgre onto the D drive using the backup data directory but that didn't seem to work. Any help in saving me from myself would be greatly appreciated.

fabio
09-16-2008, 05:47 PM
Please try this:

get to the command prompt and go to the c:\program files\postgresql\8.x\bin folder and run pg_dumpall -U postgres > c:\dbbackup.sql

This may take a while but the end result will be that your entire postgres database will be backed up to a file. If you want it saved to a different folder just change that c:\dbbackup.sql to something more fitting. Then on the new postgres folder get to the same folder in cmd and type

psql -U postgres -f c:\dbbackup.sql postgres (or change the filename to whatever makes sense)

Newt_Buggs
09-16-2008, 06:23 PM
Thanks for the help, but forget what I originally posted here. This is turning into quite a hassle and you guys have better things to do so I'm just going to build a new database from scratch.

zlatan24
08-24-2011, 08:41 AM
For working out given troubles you may use recovery for sql server (http://www.recoveryforsqlserver.com). It uses modern methods of restoring sql data. The tool works with mdf files up to 16TB. It can scan and analyzes corrupted info, fix your data and displays the results of working.