How to back up the database on Ubuntu

Ask your questions regarding TimeTrex installation here.
Locked
MickG01
Posts: 144
Joined: Mon Nov 09, 2009 11:48 am

How to back up the database on Ubuntu

Post 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
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: How to back up the database on Ubuntu

Post by shaunw »

That depends on how you installed TimeTrex. Did you use our automated installer, or did you install from the manual .ZIP file?
MickG01
Posts: 144
Joined: Mon Nov 09, 2009 11:48 am

Re: How to back up the database on Ubuntu

Post by MickG01 »

Zip file
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: How to back up the database on Ubuntu

Post 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
MickG01
Posts: 144
Joined: Mon Nov 09, 2009 11:48 am

Re: How to back up the database on Ubuntu

Post 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"?
MickG01
Posts: 144
Joined: Mon Nov 09, 2009 11:48 am

Re: How to back up the database on Ubuntu

Post 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?
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: How to back up the database on Ubuntu

Post 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.
MickG01
Posts: 144
Joined: Mon Nov 09, 2009 11:48 am

Re: How to back up the database on Ubuntu

Post 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.
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: How to back up the database on Ubuntu

Post 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.
MickG01
Posts: 144
Joined: Mon Nov 09, 2009 11:48 am

Re: How to back up the database on Ubuntu

Post 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.
MickG01
Posts: 144
Joined: Mon Nov 09, 2009 11:48 am

Re: How to back up the database on Ubuntu

Post 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?
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: How to back up the database on Ubuntu

Post 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.
MickG01
Posts: 144
Joined: Mon Nov 09, 2009 11:48 am

Re: How to back up the database on Ubuntu

Post 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?
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: How to back up the database on Ubuntu

Post by shaunw »

In theory yes.
Locked