Trying to restore Database

PostgreSQL is the database server used to store information. Do you have a question or are you having problem with PostgreSQL? If so, post them here.

Moderator: Moderators

Re: Trying to restore Database

Postby WhiteRider » Sat Sep 20, 2008 5:54 pm

You will need to enter it like this, I think:

pg_restore -U postgres "C:\Program Files\PostgreSQL\8.3\bin\PT3 DB2.sql"

(just put the path in quotes)
WhiteRider
Moderator
 
Posts: 54018
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Trying to restore Database

Postby PokerBot » Sat Sep 20, 2008 6:06 pm

This is what i typed in before.

I copied and pasted exactly what you said in the above post and the same message comes up: pg_restore: (archiver) input file does not appear to be a valid archive

What is the next step also with regards to my other questions on my last post

Thanks again
PokerBot
 
Posts: 260
Joined: Mon Feb 18, 2008 9:02 am

Re: Trying to restore Database

Postby WhiteRider » Sat Sep 20, 2008 6:17 pm

It's possible that the backup file made by PGAdmin needs to be restored using PGAdmin - I don't know how to do this but if you found how to backup in PGAdmin I'm sure restore will be similar, and you should be able to find it in the Help.

If you still have the original hand history files in the 'processed' folder (see the auto import tab for where this folder is), then you can run a Manual Import of that folder.

Again, I'll see if someone Kraada or someone else can have another look at this thread, although he's offline at the moment.
WhiteRider
Moderator
 
Posts: 54018
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Trying to restore Database

Postby PokerBot » Sat Sep 20, 2008 7:36 pm

I do not know how to restore using PG admin as the only way i managed to back up the database was to follow the instructions on this website i have no idea on how to go about this other than the information that i am giving from this site

My PC crashed so i don't have the old hand histories, so getting the hands from this file somehow are a must

Someone who is more attuned with postgres / PG Admin would be great to help resolve this issue and would be very much appreciated as this may be the only way to solve the issue

One thought, i tried to chance the file extention to .bak rather then .sql to see if it registers it but the same issue arises, the OK button never stops being translucent and i cannot click on it

Thanks
PokerBot
 
Posts: 260
Joined: Mon Feb 18, 2008 9:02 am

Re: Trying to restore Database

Postby Peligroso » Sun Sep 21, 2008 1:32 am

Create a new database in PT3. Open pgAdmin. Log on to your database server and right-click on the new database in the list on the left and choose "Restore...". Then browse your way to the file and click "Ok". That should do it.
Peligroso
 
Posts: 1483
Joined: Mon Dec 10, 2007 6:51 pm
Location: Sweden

Re: Trying to restore Database

Postby PokerBot » Sun Sep 21, 2008 7:49 am

I have tried this method numerous times and the same issue araises: i cannot find the file when "back up files" are selected in the search window so i have to scroll down and select "all files", when i select the correct file nothing happens, the ok buttong stays invisible so i cannot click on ok.

Somebody please help me
PokerBot
 
Posts: 260
Joined: Mon Feb 18, 2008 9:02 am

Re: Trying to restore Database

Postby WhiteRider » Sun Sep 21, 2008 7:56 am

I was just re-arranging the postgres FAQ, and I came across the instructions someone gave me before about restoring using PGAdmin. It says:

"With PT3 closed, run PGAdmin: Start -> Programs -> PostgreSQL -> PGAdmin.
Double-click PostgreSQL Database Server on the left hand side, and open the Databases list.
Right click the database and choose "Backup...".

To restore you will need to use PT3 to create a new database, then use the above method but choose "Restore..." to restore the backup into the new database."

I wonder if Doing it this way creates a properly structured database into which you can restore?

While you have been changing the backup file's name, you haven't actually edited it at all, have you? If you made any changes to it - or even if you didn't but re-saved it with notepad or wordpad or something you could have corrupted it.
WhiteRider
Moderator
 
Posts: 54018
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Trying to restore Database

Postby PokerBot » Sun Sep 21, 2008 8:07 am

I backed up the database exactly as said on the FAQ and as repeated above

I made a copy of the back up just in case, i have tried restoring with the back up and the same issue arises, the OK button is invisible on all options in the PG Admin program

What about the postgress specialists as we seem to be getting nowhere

Thanks

edit:

I think i know the issue, when backing up i selected the "plain" option rather then "compressed" because there was no detailed instructions in the FAQ on how to do it, i suspected that making a plain back up would be better then compressing it, faster too. So it may be the case that i cannot officially restore my database but surely i can still restore it through other means? Note that i tired to rename the extension to ".backup" and SQL sees the file this time but still cannot click on okay. At the very least i can still access the hands histories from it some how and then manually import them again from scratch, but how?
PokerBot
 
Posts: 260
Joined: Mon Feb 18, 2008 9:02 am

Re: Trying to restore Database

Postby WhiteRider » Sun Sep 21, 2008 8:59 am

Yes, I know you how you said you backed up.
Did you try creating a new DB in PT3 and then restoring in to that as I highlighted above?

When you first created the backup, what file extension did the file have?

You will not be able to get the hand histories out of the backup until you have restored the database - it's not just a big text file.

I'll get the others to look in again..
WhiteRider
Moderator
 
Posts: 54018
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Trying to restore Database

Postby kraada » Sun Sep 21, 2008 9:26 am

My apologies; I just did a little more digging and found this:

[Can't restore backup file created with pgAdmin III

I created a backup file using pgAdmin III, but when I try to restore it using pgAdmin III the OK button will stay grayed.

pgAdmin III uses PostgreSQL's pg_restore tool, which supports only the COMPRESS and TAR options of pg_dump which is used for backup creation. The PLAIN format can't be interpreted by pgAdmin III and pg_restore (it can be edited manually, and executed with psql and pgAdmin III's query tool in many cases), and thus isn't accepted as valid file.

We recommend using the COMPRESS format for daily backup tasks. The PLAIN format is for advanced manual processing before executing as SQL script, and has some restrictions (no blobs) which makes it less usable for standard backup tasks.


We'll change the FAQ to indicate you should use Compress or Tar for backup purposes.

However, by digging a bit more around their site, I found how you actually restore from a plain backup :)

Start --> Programs --> PostgreSQL --> Command Prompt. Replace "YourDbName" in the following commands with whatever you want your new database to be called. PT3DB or some such will work fine.

At the prompt, first:
Code: Select all
createdb -T template0 YourDbName

This will create a new database with the name you choose. The backup method you used can't create the database for you.

Then once you've created it:
Code: Select all
psql YourDbName < "infile"


where "infile" is the path to the backup you have ("C:\backup.sql" or some such).

This will spew out quite a bit of code at you, and by the end, your database should be backed up. I'm not 100% sure if this will bring in the PT3 schema or not. If you receive a lot of errors, run these commands, then try again:
Code: Select all
 psql YourDbName

Code: Select all
 \cd "C:\Program Files\PokerTracker 3\Data\Schemas\"

Code: Select all
 \i schema.postgres.sql

Code: Select all
 \q

Let it finish, then exit and run psql YourDb < infile again and it should work that time.
kraada
Moderator
 
Posts: 54431
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

PreviousNext

Return to PostgreSQL [Read Only]

Who is online

Users browsing this forum: No registered users and 26 guests

cron