asterisk2billing.org
http://forum.asterisk2billing.org/

pg_dump error guidance required
http://forum.asterisk2billing.org/viewtopic.php?f=15&t=4646
Page 1 of 1

Author:  mushfiq [ Wed Dec 10, 2008 5:29 pm ]
Post subject:  pg_dump error guidance required

Hi ,

I want to transport all pin and information from old version of a2billing to new one. That old one in web interface there was no database backup
option which has in the new one. So option left in from psql database
pg_dump command.
But i fail to succeed to dump as it showing connection to database error.

Can any one guide me to dump the database file?

I tried with these command

first logged in as super user
su postgres
$ pg_dump -h serverip -v -u -f /home/db.sql a2billing
here a2billing is my existing database which i want to dump as db.sql
is it ok ? but this is huge i might need to gunzip it ok later we can think.

the error shows for this command connection to database a2billing failed
no pg_hba.conf entry for host server ip for user postgres database a2billing. and so in pg_hba.conf i add the line again
host all all serverip 255..... trust
but not work yet .

the simple way to be as i found other tutorial
pg_dump dbname | gzip > filename.gz

but it says also permission denied.

can any one help from the begining how i will solve the total thing?

Author:  stavros [ Wed Dec 10, 2008 6:18 pm ]
Post subject: 

Use the same credentials to connect to Postgres that A2B is using. For a reminder of these credentials try: head -n20 /etc/asterisk/a2billing.conf

Author:  mushfiq [ Wed Dec 10, 2008 8:54 pm ]
Post subject: 

Hello stavros again,
ok follow the same credentials you mean in a2billing.conf in database context whatever their i have to follow right?
so i use the as following

pg_dump -i -h localhost -p 5432 -U postgres -F -f /home/db.sql a2billing

this shows too many command line option

what i do now?

the next line what you said where will i execute that?

Author:  stavros [ Wed Dec 10, 2008 9:10 pm ]
Post subject: 

mushfiq wrote:
the next line what you said where will i execute that?
At a Bash prompt, the same as the other commands you're using.
I use this with no problems:
Code:
pg_dumpall -c -h localhost -U postgres | gzip > pgsql-backup.gz
To restore:
Code:
zcat pgsql-backup.gz | psql -h localhost -U postgres

Author:  mushfiq [ Wed Dec 10, 2008 9:27 pm ]
Post subject: 

In tutorial it says

- c, means –clean clean (drop) schema prior to create

is it not harmful? i do not want to destroy my existing one. Just for caution
i am asking these fool question .

ok by this command

pg_dumpall -c -h localhost -U postgres | gzip > pgsql-backup.gz

where my existing database a2billing have mentioned?
where this file will be saved ? in tmp ?
sorry i m asking too many question as i am totally blind in database.
your help is appreciated sir.

Added after 7 minutes:

i test the command without -c it still shows pin-back.gz: permission denied


where will i check this permission denied thing?

Author:  stavros [ Wed Dec 10, 2008 9:28 pm ]
Post subject: 

mushfiq wrote:
is it not harmful? i do not want to destroy my existing one.
It harmless during the backup; it won't drop anything. Only when you restore the backup will it drop the existing tables. Feel free to omit the '-c' if that's not what you want.
Quote:
where this file will be saved ? in tmp ?
It will be saved to the current directory. If you want to save elsewhere, simply change the filename 'pgsql-backup.gz'.
Quote:
i test the command without -c it still shows pin-back.gz: permission denied
That means you don't have permission to write to the current directory. Try writing the file to a directory that you do have write access to. I have a feeling you're logged in as the 'postgres' user; this is not necessary, you should be logged in as your usual day-to-day user.

Author:  mushfiq [ Wed Dec 10, 2008 11:33 pm ]
Post subject: 

You are genious . you are right i had no write permission in current folder and not suppose to not execute from postgres which i was doing actually and it did backed up.

But dont go away now i need to restore it in the new a2billing.
it should be easier right ? from web interface.

Added after 52 minutes:

problem again stavros.

Now i am restoring from a2billing web interface just selecting the file and upload command it says upload done but i dont see any pin of that database in this new server list customer

what is wrong?

Added after 34 minutes:

ok for restoring

i follow your command
zcat pgsql-backup.gz | psql -h localhost -U postgres

it shows lot of invalid command \.
and finally error at or near "1"
line 1 : 1 1 44 uk 0.2 0 0 0.3 0 0 0 0 0 0 0 0 2005-0.....

what is now to be done?

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/