How to Backup and Restore in XP.

General support regarding TimeTrex, such as
configuring policies/taxes or processing payroll.
Locked
bad8174
Posts: 29
Joined: Tue Aug 28, 2007 2:03 pm

How to Backup and Restore in XP.

Post by bad8174 »

Hey guys and gals. I just installed TimeTrex from the Windows installer, so it installed PostgreSQL and Apache right into the TimeTrex Program folders. How do I go about backing up and restoring the DB in case of failure? Ive never used PostgreSQL, so any info would be great.
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

We plan on adding a backup script to the installer in the next version. Until then you will need to run pg_dump manually from the PostgreSQL directory to dump the TimeTrex database.
bad8174
Posts: 29
Joined: Tue Aug 28, 2007 2:03 pm

Restore?

Post by bad8174 »

Thanks guys. Whats the restore method? Also, what file name does the pg_dump, dump to?
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

Until we release the next version with built-in backup scripts you will need to consult the PostgreSQL manual on backup/restore.

http://www.postgresql.org/docs/8.2/inte ... ackup.html
bad8174
Posts: 29
Joined: Tue Aug 28, 2007 2:03 pm

Default DB name?

Post by bad8174 »

What is the default DB name? Is it "postgre", or does it default to another name during the install?
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

The TimeTrex database name is: "timetrex".

v2.1.0-rc2 was released this afternoon, it contains a backup script now.
bad8174
Posts: 29
Joined: Tue Aug 28, 2007 2:03 pm

easy upgrade?

Post by bad8174 »

Is the upgrade easy?
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

Yes, it should just be a matter of pointing the installer to your current TimeTrex directory.

The backup scripts will probably need manual adjusting to add the correct password though if you are upgrading from RC1.
bad8174
Posts: 29
Joined: Tue Aug 28, 2007 2:03 pm

Install failed miserably

Post by bad8174 »

I downloaded the windows installer for rc-2. Pointed the installer to the current directory. E:\\program files\timetrex, the install looked like it completed. However on the launch to finish the install I get a "Page Cannot Be Displayed. Also. the TimeTrexApache service is failing with a error message as follows: The TimeTrexApache service failed to start with service specific error 1.
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

During the upgrade process the Apache service shouldn't have been modified at all. So you're going to need to check log files and figure out why its not starting.

A good place to start might be to edit the timetrex/start.bat file, and copy the command out of their and run it manually from the command prompt so you can see if any error messages appear at that time.
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

I think I may have found out what is causing this. Please check your Apache conf file located in:

c:\program files\TimeTrex\apache2\conf\httpd.conf

At the very end of that file, does it contain two instances of PHPIniDir on the same line? Something like this:

Code: Select all

PHPIniDir "c:\program files\timetrex\php\"PHPIniDir "c:\program files\timetrex\php\"

If so, delete everything after the second instance of PHPIniDir including PHPIniDir itself, so it looks like this:

Code: Select all

PHPIniDir "c:\program files\timetrex\php\"
bad8174
Posts: 29
Joined: Tue Aug 28, 2007 2:03 pm

trying a test restore

Post by bad8174 »

Shaun, Im trying to do a test restore, but not having much luck. Ive installed TT on my workstation(XP sp2) using the Windows Installer. Im going to use this to run TT test on. I was able to do a restore using pg_dump by running the following statements from the command prompt:
1. SET PGPASSWORD="Password from your backup_database.bat"
2. SET PGDATABASE=timetrex
3. "C:\program files\timetrex/postgresql\bin\pg_dump.exe" -d -f C:\timetrexbu2.sql - h localhost -U timetrex -p 5433

However I cannot restore the DB. Here are the steps Im doing.

1. See Above
2. See above
3. "C:\program files\timetrex/postgresql\bin\psql.exe" timetrex -p 5433 < C:\timetrexbu2.sql

I get a return of Failure: password authentication failed for %username%

Can you give me the correct syntax that I should use?
Also, is it possible to restore a DB from one machine to another?
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

Try using pg_restore.exe to restore the dump.

Something like this should work:

Code: Select all

"C:\program files\timetrex/postgresql\bin\pg_restore.exe" -d timetrex -h localhost -U timetrex -p 5433 C:\timetrexbu2.sql 
gherghel
Posts: 16
Joined: Thu Dec 18, 2008 6:53 am
Location: Romania

Post by gherghel »

shaunw wrote:We plan on adding a backup script to the installer in the next version. Until then you will need to run pg_dump manually from the PostgreSQL directory to dump the TimeTrex database.
It`s easy to backup a postgresql 8.2 DB in TT (there is a script named backup_database)
but it is hard for me to restore the same database on another machine or after reinstalling on the same machine (there is a lack of a such kind of script)
For instance:
dumping woks with:
SET PGPASSWORD=[Password from your backup_database.bat]
SET PGDATABASE=timetrex
"D:\Program Files\TimeTrex/postgresql\bin\pg_dump.exe" -d -f timetrex_database_%date%.sql -h localhost -U timetrex -p 5433
gherghel
Posts: 16
Joined: Thu Dec 18, 2008 6:53 am
Location: Romania

Re: Restore?

Post by gherghel »

bad8174 wrote:Thanks guys. Whats the restore method? Also, what file name does the pg_dump, dump to?
restore doesn`t work with:
"C:\program files\timetrex/postgresql\bin\pg_restore.exe" -d timetrex -h localhost -U timetrex -p 5433 C:\..........\timetrex_database_18.12.2008.sql
on another machine or after reinstalling on the same machine
The answer from CP is
...The systeem cannot find the path specified
There is also another problem when installing TT on another machine or after reinstalling on the same machine: the password of the new DB before restoring the old one is different and do not match.
gherghel
Posts: 16
Joined: Thu Dec 18, 2008 6:53 am
Location: Romania

Post by gherghel »

shaunw wrote:Try using pg_restore.exe to restore the dump.

Something like this should work:

Code: Select all

"C:\program files\timetrex/postgresql\bin\pg_restore.exe" -d timetrex -h localhost -U timetrex -p 5433 C:\timetrexbu2.sql 
It`s easy to backup a postgresql 8.2 DB in TT (there is a script named backup_database)
but it is hard for me to restore the same database on another machine or after reinstalling on the same machine (there is a lack of a such kind of script)
For instance:
dumping woks with:
SET PGPASSWORD=[Password from your backup_database.bat]
SET PGDATABASE=timetrex
"D:\Program Files\TimeTrex/postgresql\bin\pg_dump.exe" -d -f timetrex_database_%date%.sql -h localhost -U timetrex -p 5433
but
restore doesn`t work with:
"C:\program files\timetrex/postgresql\bin\pg_restore.exe" -d timetrex -h localhost -U timetrex -p 5433 C:\..........\timetrex_database_18.12.2008.sql
on another machine or after reinstalling on the same machine
The answer from CP is
...The system cannot find the path specified
There is also another problem when installing TT on another machine or after reinstalling on the same machine: the password of the new DB before restoring the old one is different and do not match.
Locked