Page 1 of 1

How to back up the database on Ubuntu

Posted: Sat Nov 27, 2010 2:42 am
by MickG01
In preparation for an upgrade I wish to back up my TimeTrex Postgresql database but nowhere do I see instructions for doing this.

I have the timetrex.ini.php etc.

How does one backup and if neccesary restore the database?

O/S is Ubuntu 10.10

Re: How to back up the database on Ubuntu

Posted: Sat Nov 27, 2010 11:23 am
by shaunw
That depends on how you installed TimeTrex. Did you use our automated installer, or did you install from the manual .ZIP file?

Re: How to back up the database on Ubuntu

Posted: Sat Nov 27, 2010 5:18 pm
by MickG01
Zip file

Re: How to back up the database on Ubuntu

Posted: Sun Nov 28, 2010 12:48 pm
by shaunw
If you used the manual .ZIP file, then you need to read the PostgreSQL documentation on how to properly back it up.

This URL may be a good starting place:
http://www.postgresql.org/docs/8.2/inte ... -dump.html

Re: How to back up the database on Ubuntu

Posted: Sun Nov 28, 2010 3:33 pm
by MickG01
Except that I get this:

sudo psql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

Re: How to back up the database on Ubuntu

Posted: Wed Dec 01, 2010 8:31 pm
by MickG01
Ref my last post. Doesn't the result I'm getting suggest that PostgreSQL server is not running? If so how is TimeTrex accessing it?

Re: How to back up the database on Ubuntu

Posted: Thu Dec 02, 2010 10:03 am
by shaunw
No, it doesn't necessarily mean that PostgreSQL isn't running, it just means that the PostgreSQL client (psql) can't connect to it when you don't specify any connection settings. Its like trying to point your web browser to "www.google.com" without typing in a URL at all.

Re: How to back up the database on Ubuntu

Posted: Thu Dec 02, 2010 11:54 am
by MickG01
OK but Synaptec sees a postgresql client as installed but not the server.

what connection settings should I be using? timtrex.php.ini says port 5433 but nothing else.

If I install the postgresql server will it damage my TimeTrex database?

Will it see the timetrex database.

I never installed Postgresql, even the client. So that install must have been done by the TimeTrex install.

Re: How to back up the database on Ubuntu

Posted: Thu Dec 02, 2010 12:41 pm
by shaunw
You likely didn't use the manual .ZIP file to install TimeTrex from, but instead used our automated installer.

If that is the case then TimeTrex automatically dumps the database to the TimeTrex directory for you, so you all you need to do to perform a backup is copy the entire TimeTrex folder to your backup media. You can check by listing the files in the TimeTrex directory, you should see up to seven .SQL files dated for each day.

Re: How to back up the database on Ubuntu

Posted: Thu Dec 02, 2010 6:27 pm
by MickG01
As I said above My install was using the Zip file.

I had previously tried the automated installer but it didn't work correctly and you advised me to use the Zip.

I have a TimeTrex folder with those files dated Sept 18 through Sept 30th from that automated install attempt but my current install is in a (non-capitalized) timetrex folder which does not have any such .sql files.

Can I just install the postgresql server on my ubuntu system without compromising my data and if so will it let me access the timetrex database and back it up?

currently Synaptic Package Manager does not show the server as being installed.

Re: How to back up the database on Ubuntu

Posted: Thu Dec 02, 2010 8:26 pm
by MickG01
Wonderful!

Found out how to back up the database.

Tried upgrading from 3.0.8 to 3.3.1 it got to Upgrading database, please wait... 91% and froze there.

Should I have upgraded through intermediate versions?

Re: How to back up the database on Ubuntu

Posted: Fri Dec 03, 2010 9:39 am
by shaunw
I'm not sure what you've done if you have a partial install from the automated installer mixed in with a manual installation from the .ZIP file, thats recipe for disaster since they can conflict with one another.

As for the actual upgrade process, you can upgrade from any version of TimeTrex to any other version in a single step. The fact that it failed at 91% means something went terribly wrong and you will need to look through the TimeTrex/PHP/PostgreSQL logs to find the problem.

Re: How to back up the database on Ubuntu

Posted: Sun Dec 05, 2010 8:19 pm
by MickG01
I reinstalled 3.0.8 from the bin.

Restored my database using -h -p -U with Hostname Port and Username

Had to reset the User password to get in and all recovered.

So now I can just run the latest bin (after backing up the database) and it should update OK?

Re: How to back up the database on Ubuntu

Posted: Mon Dec 06, 2010 9:15 am
by shaunw
In theory yes.