Page 1 of 2
moving postgress to other drive.

Posted:
Sat Mar 21, 2009 12:02 pm
by catcher70
C drive choked with 12 gig. Need to move to an existing drive(X),that is already in use for all things poker. Have copied postgress over but I cant work out how to address it so it will be found in new location.This probably been answered a thousand times already, but any help would be much appreciated. Cheers
Re: moving postgress to other drive.

Posted:
Sat Mar 21, 2009 12:38 pm
by kraada
Follow the walkthrough in
this post and it should help you get things setup properly.
Re: moving postgress to other drive.

Posted:
Sat Mar 21, 2009 7:40 pm
by catcher70
followed walkthru to the letter but after entering "\i schema.postgre.sql" ,get "no such file or directory". Read thru and tried suggestions in the post but still no joy. Substituted "W" for "D" where applicable and copied and pasted all commands so typos shouldnt be an issue. I can see the file on my W drive.
Re: moving postgress to other drive.

Posted:
Sun Mar 22, 2009 5:30 am
by WhiteRider
Did all the previous commands complete ok with no errors?
I'll get Kraada to take a look at this when he comes on later.
Re: moving postgress to other drive.

Posted:
Sun Mar 22, 2009 9:04 am
by kraada
Try specifying the file completely. If the file is in W:/pt3/ for example, use \i W:/pt3/schema.postgres.sql and see if that works (it should).
Re: moving postgress to other drive.

Posted:
Sun Mar 22, 2009 9:50 am
by catcher70
Thanks for your help so far but still no go. Post text here. Maybe you can see what im doing wrong.
Folder is named"pg_data" and is just sitting in my W drive. Not inside any other folder . If I cant get it to work,could I just back up all the data,then re-install postgres to W ,then import all my data back in? Housekeeping wont run to finish coz there isnt enough space. Have deleted all I could. All thats left on HD is postgres and windows OS. If i can just back it up, any pitfalls i need to know about. thanks again.
Password for user postgres:
Welcome to psql 8.3.4, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
Warning: Console code page (850) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
postgres=# CREATE TABLESPACE spare_disk LOCATION 'W:\\pg_data';
WARNING: nonstandard use of \\ in a string literal
LINE 1: CREATE TABLESPACE spare_disk LOCATION 'W:\\pg_data';
^
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.
ERROR: tablespace "spare_disk" already exists
postgres=# CREATE DATABASE pt3_newdb TABLESPACE spare_disk;
ERROR: database "pt3_newdb" already exists
postgres=# \connect pt3_newdb;
You are now connected to database "pt3_newdb".
pt3_newdb=# \cd W:
pt3_newdb=# \i schema.postgre.sql
schema.postgre.sql: No such file or directory
pt3_newdb=# \i W:/schemas.postgres.sql
W:/schemas.postgres.sql: No such file or directory
pt3_newdb=# \i W:/schemas.postgre.sql
W:/schemas.postgre.sql: No such file or directory
pt3_newdb=#
Re: moving postgress to other drive.

Posted:
Sun Mar 22, 2009 11:28 am
by WhiteRider
Did you read the "Notes for Windows users"?
It is complaining about the double backslash which sounds like it might be relevant.
I'll get kraada to take another look and see if he can spot anything else.
Re: moving postgress to other drive.

Posted:
Sun Mar 22, 2009 11:36 am
by kraada
It looks like you're part done: the database is created, and it's using the tablespace, we just need to set it to use the PT3 schema and then PT3 can connect to it and you'll be all set.
One thing: the file is schema.postgres.sql not schemas.postgres.sql. Change that and it should most likely fix the issue for you. (I apologize, that typo was my fault, I've edited the post now for the future).
If that doesn't fix it: connect to the database vis psql and after typing \cd W: and hitting enter, type \! cd and hit enter, then copy and paste the output here, as well as the output from the: \! dir command.
I'm not sure why it's not finding the postgres schema but that will tell us if the directory changed properly and if the schema.postgres.sql is actually in the directory we're currently in.
Edited to add: If you didn't move the file, just copied it, \i C:/Program Files/PokerTracker 3/Data/Schemas/schema.postgres.sql should also do the trick.
Re: moving postgress to other drive.

Posted:
Sun Mar 22, 2009 6:48 pm
by catcher70
still stuck.Not entirely sure what you meant by this "then copy and paste the output here, as well as the output from the: \! dir command.
". Inside pg_data folder on W is another folder "56354". Now if I cut this out and then try to connect I get the DETAIL listed below. Put it back in and i connect. Its prolly something that im doing. Not to computer savvy. Last time I tried to update windows I made a satellite drop from orbit. Any more advice would be much appreciated. Cheers
Password for user postgres:
Welcome to psql 8.3.4, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
Warning: Console code page (850) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
postgres=# \connect pt3_newdb;
FATAL: database "pt3_newdb" does not exist
DETAIL: The database subdirectory "pg_tblspc/56353/56354" is missing.
Previous connection kept
postgres=# \connect pt3_newdb;
You are now connected to database "pt3_newdb".
pt3_newdb=# \cd W:
pt3_newdb=# \! cd
W:\
pt3_newdb=# \i schema.postgres.sql
schema.postgres.sql: No such file or directory
pt3_newdb=# \i schema.postgre.sql
schema.postgre.sql: No such file or directory
pt3_newdb=# \i C:/Program Files/PokerTracker 3/Data/Schemas/schema.postgres.sql
C:/Program: No such file or directory
pt3_newdb=# \! cd
W:\
pt3_newdb=#
Re: moving postgress to other drive.

Posted:
Sun Mar 22, 2009 7:01 pm
by WhiteRider
Just in case it's relevant, try using backslashes instead of forward slashes - maybe even double back-slashes.
I think kraada wanted you to execute the command \! dir and then paste the output here (as you have for the other output).