Page 1 of 1

disaster recovery

Posted: 2009-12-18 16:22
by ruffage
Had the ultimate in disasters happen. Server hosting hmailserver died a hardware death.

Managed to recover the HDD the server was using, but the partition with the backup on it is toast. Do have access to the original folder of hmailserver though.

Tried installing hmailserver on new server, stopping service and the coping old folder contents directly over newly created install.

Partially worked but had DB problems and mail was failing for most users.

I have fully stepped back out of that and am looking at a clean system, hmailserver wise.

Now I need a better way of recovering the old data and settings and am looking for direction. Any offerings?

I used the internal mssql server as my site is not all that large and would never grow that large.

Old system:
PIII-933Mhz, 512MB RAM, 250GB IDE drive running Windows 2000 SP4 Server.

New System:
Dual Core Xeon 2.8GHz, 2GB RAM, 2 x 80GB SATA drives running Windows 2003 R2 SP2 Server Std.

Re: disaster recovery

Posted: 2009-12-18 16:25
by sheffters
You'll need to be able to recreate the database so HMS knows what files belong to what users ... the mail paths are stored in the database.


Re: disaster recovery

Posted: 2009-12-18 16:35
by ruffage
I have the original DB. How do I "re-create"?

Manually build out the settings? Is there a way to read the old DB to find the settings?

Just in case it isn't totally clear, I am a complete DB neophyte.

Re: disaster recovery

Posted: 2009-12-18 16:37
by ruffage
oh, and one other thing, was using version hMailServer-5.1.2-B346 and still have the installer for it.

Re: disaster recovery

Posted: 2009-12-18 17:45
by sheffters

If you have a copy of the old database then you should be fine.

1. Install database
2. Install original version of HMS (whatever version you used to run).
3. Stop HMS service
4. Copy the data folder (the old email failes) to original location
5. Restore the database
6. Restart HMS service.
7. All users, settings blah blah should be originals.

If you want to know how to restore the database from a backup file, then let us know what database you had it installed on (MySQL, SQL Server etc).



Re: disaster recovery

Posted: 2009-12-18 17:59
by ruffage
I need to know how to use the non backed up DB to restore from. The backups went with the dodo when the second partition died. I used the default MS SQL CE that comes with HMS.

When I first started getting errors, I got a note saying I should update the schema because it was at 0 and needed to get to 5k something, but when I ran DBUpdater, it complained about not finding any MSSQLCE.sql's for the run.

Re: disaster recovery

Posted: 2009-12-18 19:07
by martin
I'm not sure what you mean by "I need to know how to use the non backed up DB to restore from". Do you mean your hMailServer production database?

If so, you need the following:

- Same build as you used before
- Same database as before
- A copy of your old hMailServer.ini

1) Install the same hMailServer version as before; the same version when you used the old production database.
2) Replace the hMailServer database with the copy of your old database.
3) Replace hMailServer.ini with a copy of your own hMailServer.ini.

The database password is stored in hMailServer.ini. If you just overwrite the database, hMailServer will try to connect using an invalid password which will fail.

Re: disaster recovery

Posted: 2009-12-18 19:23
by ruffage
That was exactly what I meant.

Followed the steps outlined and restarted the service and got this error when I ran the HMS Administrator:

Your Database is not up to date and needs to be upgraded.
Please run DBUpdater.exe to update the database.

Current database version: 0
Required database version: 5110

Then is kicks me to the connect screen.

Tried running the DBUpdater and go this:

Required file for upgrade not found:

As that file isn't in either the new install nor the old install. not sure what to do next.

Did try to copy the version of the sql with out the CE in it and renamed the copy to include the CE, but then I got same error for the next step sql.

Doesn't seem to complain about the password as I believe i used the same one for both installs.

Re: disaster recovery

Posted: 2009-12-18 19:57
by martin
Have you checked the hMailServer log to see what happens when you start Administrator?

If the DBUpdater tells you that the current version is zero, it means that hMailServer isn't able to connect to the database.

Have you copied your old hMailServer.ini?

Re: disaster recovery

Posted: 2009-12-18 20:50
by ruffage
This is the error when I start the admin:

"ERROR" 3156 "2009-12-18 13:45:57.765" "Severity: 2 (High), Code: HM5033, Source: DALRecordset::Open, Description: Source: SQLCEConnection::Execute, Code: HM10046, Description: Unknown error when executing SQL statement.
select * from hm_dbversion
Microsoft SQL Server Compact OLE DB Provider"

I did copy the old ini over the new one.

Got this entry when I restarted the service:

"ERROR" 4016 "2009-12-18 13:47:40.437" "Severity: 1 (Critical), Code: HM5098, Source: SQLCEConnection::Connect, Description: Database connection error. Source: Microsoft SQL Server Compact OLE DB Provider, Error: 25017, Description: Check database settings in hMailServer.ini."

From the looks of it, something has changed in the ini. If I have other possible passwords that were used, is it possible to make the changes?

Re: disaster recovery

Posted: 2009-12-18 20:55
by martin
Are you certain that the primary disk wasn't corrupted as well?

Is it possible for you to send me the old database file and the old database at

Re: disaster recovery

Posted: 2009-12-18 21:07
by ruffage
Its possible.

Files sent.

Re: disaster recovery

Posted: 2009-12-18 21:15
by martin
Not sure we've misunderstood eachother or something; I did the following.

1) Installed the build you were referring to; hMailServer-5.1.2-B346.
2) Stopped the service.
3) Copied the database you sent me to C:\Program Files\hMailServer\Database
4) Copied the ini file you sent me to C:\Program Files\hMailServer\Bin
5) Started the service again.

After this, I was able to access hMailServer Administrator, list the domains and accounts. Also tested to send 25 messages to one of the accounts (only locally here in my test installation) and that worked fine as well...

Re: disaster recovery

Posted: 2009-12-18 22:10
by ruffage
That's what I understood as well..

Wonder if Win7 did something during the upload?

Will try this again and see what happens.

Some time passes:

Frickin Windows 7.

I shared the old folder hosted on my Win7 system and accessed it directly from the mail server. Copied the two files in question over the two on the new install. (I did stop the service first)

Started the service, checked the log - no error, checked the logon from the admin app, also good.

More time passes:

Test emails seem to be going out.

Once again, thanks for the help.