PDA

View Full Version : Transferred computers - Postgres DB Does Not Exist error



ProsperousOne
12-31-2010, 07:54 PM
I backed up my destop DB via PGAdmin and saved that file to my laptop. I"m now on travel, and trying to restore that db and getting the following when I try to restore via PG ADmin:


C:\Program Files\PostgreSQL\9.0\bin\pg_restore.exe --host localhost --port 5432 --username postgres --dbname \"P1\" --verbose "C:\Documents and Settings\Steve Sundberg\Desktop\P1 DB 122410.backup"
pg_restore: connecting to database for restore
pg_restore: [archiver (db)] connection to database ""P1"" failed: FATAL: database ""P1"" does not exist
pg_restore: *** aborted because of error

Process returned exit code 1.

I created a new DB via Holdem manager named P1 (same as my destop db name) and get the above when trying to restore.

ProsperousOne
01-01-2011, 06:53 AM
Update: I tried creating a new DB with a New name "P1 Laptop", and when I try to restore to this db from my desktop db named "P1" I get


C:\Program Files\PostgreSQL\9.0\bin\pg_restore.exe --host localhost --port 5432 --username postgres --dbname \"P1 Laptop\" --verbose "C:\Documents and Settings\Steve Sundberg\Desktop\P1 DB 122410.backup"
pg_restore: too many command-line arguments (first is "--verbose")
Try "pg_restore --help" for more information.

Note that during this problem I noticed that the registry image path had "/" separators, and I noticed there they are "\", so I changed them all to "\" as follows:


C:\Program Files\PostgreSQL\9.0\bin\pg_ctl.exe runservice -N "postgresql-9.0" -D "C:\Poker\Postgres data" -w
Don't know if this is an issue or not.

Could I just copy the entire Postgres Data Directory to my laptop?

netsrak
01-01-2011, 07:52 AM
With which Postgresql version did you create the backup file?
Postgresql 9 doesn't support restoring 8.3 backups.

And please don't restore a backup into a database created by HM - this will cause lots of problems.

ProsperousOne
01-01-2011, 10:20 AM
I created both with the version 9.0 of postgreSQL.

I don't understand your comment

And please don't restore a backup into a database created by HM - this will cause lots of problems. .

A lot of the FAQs indicate to use the PGAdmin to backup and restore Databases, ie FAQ - Hold'em Manager Poker Tracking Software :: Backup & Restore Database (http://faq.holdemmanager.com/questions/72/Backup+%26+Restore+Database) unless I"m completely misunderstanding you :confused:

ProsperousOne
01-01-2011, 10:29 AM
Using the above linked method, I get


C:\Program Files\PostgreSQL\9.0\bin\pg_restore.exe --host localhost --port 5432 --username postgres --dbname \"P1\" --verbose "C:\Documents and Settings\Steve Sundberg\Desktop\P1 DB 122410.backup"
pg_restore: connecting to database for restore
pg_restore: [archiver (db)] connection to database ""P1"" failed: FATAL: database ""P1"" does not exist
pg_restore: *** aborted because of error

Process returned exit code 1.


Both Databases were created with Postgres 9.0

ProsperousOne
01-01-2011, 10:49 AM
I'm running Windows XP SP3, and found some threads in the Postgres forums about similar "db does not exist" and a lot mentioned user privileges, and am inferring from this that the posgres user needs "superuser" priviliges.

So I tried to check the user privileges for posgres on this laptop, but that user doesn't appear when I'm loged in as an admin. HOwever, I am able to log in under user name posgress, and log on.

I would think logging in under the computer admin account I should see ALL users created on this computer, and be able to change privileges.

Note that I did edit the pg_hba.conf filt and changed all references to "trust":

# TYPE DATABASE USER CIDR-ADDRESS METHOD

# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
#host all all ::1/128 trust

netsrak
01-02-2011, 06:20 AM
What i'm trying to say above:

If you want to restore a backup you created with pgadmin you need to create the new database via pgadmin too. It will not work if you create a database in the Holdemmanager database and try to restore the backup into this database via pgadmin.

I'm not sure what your current problem is from all your posts. I think the best is if you arrange a teamviewer session: Please schedule a remote support session with our support. Email support@holdemmanager.net, with a link to this thread and your forum name, so we can setup a Teamviewer (http://www.holdemmanager.net/teamviewer) session.

PA_Kid
01-11-2011, 08:53 PM
I just upgraded PostgreSQL to postgresql-9.0.2-1-windows_x64 on my main system. I wanted to do a completely clean install, so I made backups (using pgAdmin) of all my 8.x databases, then uninstalled v8.x, wiped out the Postgres user, and deleted the data directory.

I rebooted, and then performed a fresh install of postgresql-9.0.2-1-windows_x64. Everything installed correctly, but now I'm getting the same errors as ProsperousOne when trying to restore.

I google'd around a bit, and this problem is definitely occurring due to the escape character (\) before the double quotes (") in the restore command. I know that ProsperousOne did make mention of this, but I'm not sure if he ever figured out the correct command to make the backup work.

Here's the exact command that needs to be entered:

"C:/Program Files/PostgreSQL/9.0/bin\pg_restore.exe" --host localhost --port 5432 --username postgres --dbname "P1 Laptop" --verbose "C:\Documents and Settings\Steve Sundberg\Desktop\P1 DB 122410.backup"


You can open up a command prompt and just copy and paste the above command, as long as the DB name and backup names are still the same. The empty DB needs to be created (in pgAdmin) with correct properties ahead of time.

The only thing I can really think of as to why this is happening is that the most recent pgAdmin tool must have some incorrect hard-coded commands.

Patvs
01-11-2011, 10:01 PM
@PA_kid
PostgreSQL 8.4.x is not compatible with 9.0.x
So you'll need to restore your SQL 8.4.x databases by also re-installing 8.4.x on your computer.

Or.. reimporting all the original handhistories in a new 9.0.x database.

PA_Kid
01-11-2011, 10:59 PM
@PA_kid
PostgreSQL 8.4.x is not compatible with 9.0.x
So you'll need to restore your SQL 8.4.x databases by also re-installing 8.4.x on your computer.

Or.. reimporting all the original handhistories in a new 9.0.x database.

Patvs... is this a general PostgreSQL backward compatibility issue, or is this something specific to HEM? The reason I ask is because I have successfully backed up PT3 databases (sorry to bring up the competition's product on the HEM forum) from 8.4.x and imported into a 9.0.x installation. And by all appearances everything seemed to work just fine afterward.

Regardless of the compatibility issues with the versions of the database itself, the command line above should work for ProsperousOne's problem. I do believe he said he created the backup in v9.0.x and was restoring back into another v9.0.x installation. Was really just a couple of command line syntax issues preventing the restore from working.

Patvs
01-12-2011, 12:58 AM
The general PostgreSQL (8.2/8.3/8.4) compatibility rule is, you can backup/restore any 8.3.x to any other 8.3.x version (so 8.3.1 is compatible with 8.3.13)
But it's not compatible with 8.4. There are ways to move a 8.2/8.3/8.4 database to a new 8.x version, using a pg-migrator script to convert the 8.3 database to 8.4.

It's a slightly different story for SQL 9.0.x. Basically the same as above still applies. But a new contrib module pg_upgrade supports in-place upgrades from 8.3 or 8.4 to 9.0.

I haven't tested this yet with PT3. But for HoldemManager it usually causes problems in pgadminIII. Similar errors come up if you want to restore a HoldemManager 1.09.xx database (pre multi-currency) into HoldemManager 1.11.xx (post multi-currency)

Therefore we always advise to install the same build type for both HoldemManager and PostgreSQL when restoring a database in pgadminIII to minimize the chance of errors.




Edit: http://www.postgresql.org/docs/9.0/static/pgupgrade.html

ProsperousOne
01-12-2011, 10:01 AM
PA_Kid - thanks so much for the tip. I'll give it a go this weekend. The timing is perfect - planning a trip to Vegas with my laptop and need to have it working for a meeting with my coach! OU1! - P1

ProsperousOne
01-17-2011, 05:56 PM
Here's the exact command that needs to be entered:

"C:/Program Files/PostgreSQL/9.0/bin\pg_restore.exe" --host localhost --port 5432 --username postgres --dbname "P1 Laptop" --verbose "C:\Documents and Settings\Steve Sundberg\Desktop\P1 DB 122410.backup"

PA_Kid, you SOOOOO ROCK DUDE!!!!!!:D

I suggest this be stickied or added to the FAQ.

ProsperousOne
02-08-2011, 02:18 PM
Hmmmm. still having an issue. I successfully completed the restore process to my laptop using the above, but when I launched HM, I'm only showing 2 sessions (ironically played on 12/31/10 and 1/1/11), but no other sessions.

My entire db that I restored should contain about 500K hands. But when I run the query FAQ - Hold'em Manager Poker Tracking Software :: Check Total Amount of Hands in Database (http://faq.holdemmanager.com/questions/115/Check+Total+Amount+of+Hands+in+Database+) on the restored db , it's only showing 893 hands.

Any ideas?