Delicious      Technorati      Blinklist      Furl      Reddit

TimeTrex Time and Attendance

TimeTrex Time and Attendance


* FAQ    * Search
* Login   * Register

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Database Won't Restore, Help!
PostPosted: Tue Mar 09, 2010 7:26 pm 
Offline

Joined: Tue Mar 09, 2010 7:09 pm
Posts: 3
My technician was supposed to ghost my dying hard drive to a new hard drive and he accidently ghosted on the wrong drive. He treid to do a data recovery and found the files, however they were corrupted. We had another backup but only the sql file and not the timetrex.ini.php.

So the delema i am in is i have the sql database and i don't have the salt for the timetrex.ini.php to restore the database.

Is there a way to restore the database without the timetrex.ini.php file?

My error that comes up is psql: fatal: password authentication failed for user "postgres"

I have been trying to play with the pg_hba timetrx/postgresql/pg_hba file and give trust to give permission, however it isn't working.

Is there anything i can do to restore my database?

thanks


Top
 Profile  
 
 Post subject: Re: Database Won't Restore, Help!
PostPosted: Wed Mar 10, 2010 9:50 am 
Offline

Joined: Tue Sep 19, 2006 2:22 pm
Posts: 3559
If you look at the .SQL file, near the top you should find the passwords for the different users, which you can then put in your timetrex.ini.php file.

You won't be able to recover the SALT, which means you will need to reset the passwords for each user, as the old passwords will definitely not work.

_________________
Shaun Walpole


Top
 Profile  
 
 Post subject: Re: Database Won't Restore, Help!
PostPosted: Wed Mar 10, 2010 10:27 am 
Offline

Joined: Tue Mar 09, 2010 7:09 pm
Posts: 3
I tried what you told me and it still is coming up with
psql: fatal: password authentication failed for user "postgres"
The only passwords that i see are below on my post. What am i doing wrong?
thanks

In my database sql i have

--
-- PostgreSQL database cluster dump
--

\connect postgres

SET client_encoding = 'WIN1252';
SET standard_conforming_strings = off;
SET escape_string_warning = 'off';

--
-- Roles
--

DROP ROLE postgres;
CREATE ROLE postgres;
ALTER ROLE postgres WITH SUPERUSER INHERIT CREATEROLE CREATEDB LOGIN PASSWORD 'md54cae4126cb302f4a3f75165187*****';
DROP ROLE timetrex;
CREATE ROLE timetrex;
ALTER ROLE timetrex WITH SUPERUSER INHERIT CREATEROLE CREATEDB LOGIN PASSWORD 'md56f3f442254d2b0101ce9f37c3b*****' VALID UNTIL 'infinity';


;
; Database connection settings. These can be set from the installer.
;

[database]
database_name=timetrex
; type = postgres8
host=localhost:5433
password=md54cae4126cb302f4a3f75165187*****
password=md56f3f442254d2b0101ce9f37c3b*****
type=postgres8
user=timetrex


Top
 Profile  
 
 Post subject: Re: Database Won't Restore, Help!
PostPosted: Wed Mar 10, 2010 11:07 am 
Offline

Joined: Tue Sep 19, 2006 2:22 pm
Posts: 3559
Sorry, I guess PostgreSQL encrypts the passwords as well.

At this point the only real option is to change the pg_hba.conf file to enable TRUST authentication, restart the database service so those changes take effect, then using the restore_database.bat file as an example, run psql to connect to the database as the postgres user. Once you've done that you can reset the passwords for each user and hopefully gain access to the data again.

A quick Google search turned up this URL which may help:
http://www.issociate.de/board/post/272215/Fwd:_resetting_superuser_password.html

_________________
Shaun Walpole


Top
 Profile  
 
 Post subject: Re: Database Won't Restore, Help!
PostPosted: Wed Mar 10, 2010 11:53 am 
Offline

Joined: Tue Mar 09, 2010 7:09 pm
Posts: 3
Would this work?

If i created a brand new database by reinstalling timetrex and then backing up that database and then grabbing the encrypted password and copying over that encrypted password into the old database and then trying to restore the old database.

I tried to manually click on the batch file and it gives me a 0kb sql backup? I know it should automatically backup but what is the time that it does this?

thanks


Top
 Profile  
 
 Post subject: Re: Database Won't Restore, Help!
PostPosted: Wed Mar 10, 2010 12:02 pm 
Offline

Joined: Tue Sep 19, 2006 2:22 pm
Posts: 3559
You could copy the encrypted password from your current backup to a fresh TimeTrex database, but that doesn't help you, since you still don't know the password, which is needed for TimeTrex to be able to connect to it.

You need to be extremely familiar with PostgreSQL and TimeTrex to attempt a recovery when you don't know all the necessary information. I would recommend purchasing an extended support package from us so one of our technical support representatives can do the recovery for you.

_________________
Shaun Walpole


Top
 Profile  
 
 Post subject: Re: Database Won't Restore, Help!
PostPosted: Wed Mar 31, 2010 6:12 pm 
Offline

Joined: Mon Jan 11, 2010 6:54 pm
Posts: 11
Ok.. one issue is with the restore_database.bat file, it was written wrong to start off with. Rewrite as follows to get the correct username for the database.

Code:
@echo off

IF "%1" == "" GOTO NOFILE
    echo.
    echo Attempting to restore SQL dump file: %1
    echo.
    echo.
    echo -----WARNING-----WARNING-----WARNING-----WARNING-----
    echo.
    echo RESTORING THIS FILE WILL COMPLETELY OVERWRITE ALL EXISTING DATA...
    echo.
    echo ARE YOU SURE YOU WANT TO DO THIS?
    echo.
    echo -----WARNING-----WARNING-----WARNING-----WARNING-----
    echo.

    pause
    echo.
    echo NO REALLY, ALL EXISTING DATA WILL BE DELETED.
    echo.
    echo ARE YOU REALLY SURE YOU WANT TO DO THIS?
    echo.
    pause

    "C:/TimeTrex/postgresql\bin\psql.exe" -1 -f "%1" -h localhost -U timetrex -W -p 5433 

template1
    echo Done.
    echo.

    GOTO END
:NOFILE
  echo.
  echo ERROR: Please specify the SQL dump file that you wish to restore.
:END


The original was trying to connect to the wrong username and didn't prompt for password entry. Now just grab the passwords as Shawn mentioned and you should work fine.


Top
 Profile  
 
 Post subject: Re: Database Won't Restore, Help!
PostPosted: Wed Mar 31, 2010 6:31 pm 
Offline

Joined: Mon Jan 11, 2010 6:54 pm
Posts: 11
Here is an option also to try to help. If you have to copy / paste from the backup to the new database, so be it.. its better then losing all that payroll data. This is the main reason why I don't upgrade the software very often. Its a huge hassle.

Goto http://www.razorsql.com and download the SQL tool. Helps tons.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron


Time and Attendance




Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group