Re: file system level backup

From: iztech <rashantha(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: file system level backup
Date: 2008-06-13 04:53:19
Message-ID: e9f13f42-8c3d-48ee-8726-59454b47952d@d1g2000hsg.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

@craig

i am on mac os x 10.5 and i installed via macports using robby russel
pg install guide.

here is the initdb...

Init your new PostgreSQL database with: initdb -D pgdata
Start up PostgreSQL with: pg_ctl -D pgdata -l pgdata/psql.log start
Create a new database with: createdb argon_development
Test the new database with: psql argon_development
Did it load up your new database? If so, great! If not… check your
steps… :-)

so i read the pg manual and figured the db path should be what i tried
and then replace the path from another instruction.

which didn't work.

i also tried the tar db path and move it to the new location. that
worked but i think it changes the ownership. i did chown posgres
(user) on the folder, but i don't think it applies to the contents of
the folder. that could be my problem.

i will look at the .conf file and then try the pg_dump and pg_restore.

once you do a pg_dump will it leave the current db at it states. i was
concerned that it might do some damage and then my data would be
destroyed.

i also read about -o during pg_dump but frankly i didn't understand
it. yes, i am using foreign keys in ruby.

i really don't understand the 2nd half pg_restore, do you copy the
file and move it to the new server, if so where, before you run
pg_restore.

thanks.

On Jun 12, 5:54 pm, cr(dot)(dot)(dot)(at)postnewspapers(dot)com(dot)au (Craig Ringer) wrote:
> iztech wrote:
> > On Jun 12, 6:31 am, iztech <rashan(dot)(dot)(dot)(at)gmail(dot)com> wrote:
> >> i have just switched to posgresql and installed for use with ruby.
>
> >> i need to move my app and database to a new server. since i can shut
> >> down the server i think it will be easier for me to do a file system
> >> level back up.
>
> pg_dump and pg_restore should be just as good. If you're having trouble
> manging postgresql they're probably a safer bet.
>
> >> when i try to shut the server down i get this message
>
> >>  sudo -u postgres pg_ctl -D /opt/local/var/db/postgresql82/defaultdb
> >> stop
> >> pg_ctl: PID file "/opt/local/var/db/postgresql82/defaultdb/
> > can anyone let me know how i can tell where the db are located?
>
> You've left out some key information, like your operating system, OS
> version, postgresql version, and how you installed postgresql.
>
> In general you should use the OS init script if provided to start and
> stop postgresql. With most packaged Pg installs you can find the data
> directory by examining the data_directory parameter in postgresql.conf,
> which will normally be in a 'postgresql' directory under /etc .
>
> If you hand-installed it (which looks like the case based on your
> command line, above) then you should really know where the data
> directory is because you had to run initdb to create it.
>
> The -D argument on the command line above is the path to your data
> directory. It's not clear whether that command is just copied & pasted
> from somewhere else, because I'm a bit confused as to why you'd be
> asking where the data directory was if you understood that. Check
> postgresql.conf to confirm that the -D argumenet above is actually correct.
>
> >> this is my first time attempting this. can someone suggest an easy
> >> tutorial on this.
>
> If you're new to Pg, just get the packages for your operating system if
> they're reasonably recent. You can then use the OS init scripts and
> normal management tools to handle Pg.
>
> >> i have set up the new server with the same permissions so i should be
> >> able to move the db to the new location.
>
> Maybe. The version must be the same except for the patchlevel, eg
> "8.2.1" is compatible with "8.2.3" but not "8.3.1". In general it is
> MUCH SAFER to just use pg_dump and pg_restore to migrate your data.
>
> --
> Craig Ringer
>
> --
> Sent via pgsql-general mailing list (pgsql-gene(dot)(dot)(dot)(at)postgresql(dot)org)
> To make changes to your subscription:http://www.postgresql.org/mailpref/pgsql-general

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Niederland 2008-06-13 14:02:37 Re: Win32 8.3.3 install fail (sufficient privileges to install system services).
Previous Message Craig Ringer 2008-06-13 00:54:34 Re: file system level backup