From: Bob G. <bo...@rc...> - 2007-12-01 16:08:40
|
On Nov 29, 2007, at 19:34, Stuart Luppescu wrote: > On =E6=9C=A8, 2007-11-29 at 13:52 -0600, Stan Williams wrote: >> Hi. >> >> I'm using Sql-Ledger 2.8.8 and Postgres 8.1.9. Every night I do a >> database dump using the following command: >> >> pg_dump dataset =E2=80=93U username | gzip > filename.gz >> >> Today I dropped my database then recreated it in Sql-Ledger =20 >> Administration. >> >> When I try to resore the database using to following: >> >> psql dataset =E2=80=93U username < input file name > > I believe that if you're using pg_dump for the backup, you should use > pg_restore to restore it. I'm doing something like this: > > pg_dump -F t databasename > backupfile > > for the backup, and this: > > pg_restore -c -U sql-ledger -d databasename -F t backupfile > > I have found that you need the -c in there to wipe out the old =20 > database > so you don't get those annoying ``already exists'' messages. > > --=20 > Stuart Luppescu -=3D- s-luppescu .at. uchicago.edu > University of Chicago (^_^)/ CCSR > =E6=89=8D=E6=96=87=E3=81=A8=E6=99=BA=E5=A5=88=E7=BE=8E=E3=81=AE=E7=88=B6= -=3D-=3D- Kernel 2.6.20-gentoo-r > It takes a special kind of courage to face what we > all have to face. > If the other fixes mentioned have not solved the problem, you might =20 change your user to 'postgres' before executing the restore command. =20 As in: [root@bacstx ~]# su postgres [postgres@bacstx user]# psql bayarea < bayareadb The prompt on this last line might look different as bash-3.2$ This depends on your operating system and the preferences you have =20 chosen. If you do: [root@bacstx ~]# su - postgres You will get thrown into the postgres home directory - your backup =20 file is not there.. Have fun Bob G= |