Community Discussions and Support
Problems with GrayWall database

OK. Database restored from backup. Vacuum and reindex commands completed successfully. GW is working now.

 [:)]

Thank you for your help.

Jyrki

<P>OK. Database restored from backup. Vacuum and reindex commands completed successfully. GW is working now.</P><P> [:)]</P><P>Thank you for your help.</P><P>Jyrki</P>

Hi!

Yesterday Graywall started to write error messages in logfile:

! 20101021 000020.121 1739 Error executing SQL statement.
Error [11]: The database disk image is malformed.
"INSERT INTO gray (hash, ip, mfrom, mto, dtunlock, dtexpire, blcount) VALUES(:hash, :ip, :mfrom, :mto, :dt, :dte, 1)": database disk image is malformed
_ 20101021 000020.465 1739 (0)

I think mail messages are coming through now without grayfiltering. There is new error message for almost every new mail.

Is database corrupted, or what is going on? How to fix this?

Server: Windows Server 2003 SP2 with all hotfixes

Mercury/32 4.72.

Graywall version is 1.2.1.122

Regards

Jyrki Aarni.

Oulu, Finland.

<P>Hi!</P><P>Yesterday Graywall started to write error messages in logfile:</P><P>! 20101021 000020.121 1739 Error executing SQL statement. Error [11]: The database disk image is malformed. "INSERT INTO gray (hash, ip, mfrom, mto, dtunlock, dtexpire, blcount) VALUES(:hash, :ip, :mfrom, :mto, :dt, :dte, 1)": database disk image is malformed _ 20101021 000020.465 1739 (0)</P><P>I think mail messages are coming through now without grayfiltering. There is new error message for almost every new mail.</P><P>Is database corrupted, or what is going on? How to fix this?</P><P>Server: Windows Server 2003 SP2 with all hotfixes</P><P>Mercury/32 4.72.</P><P>Graywall version is 1.2.1.122</P><P>Regards</P><P>Jyrki Aarni.</P><P>Oulu, Finland.</P>

This is how to rebuild the database (based on instructions from Lukas Gebauer):

- Stop Mercury, backup database file

- Open a command window and enter this to open Sqlite console:

sqlite3.exe gray.db3

- Then type commands:
Vacuum;
Reindex;

This will read the original database and store data into a new file, repairing most errors.

 
It's probably a good idea to run chkdsk on the disk as well, though.
 

/Rolf

<p>This is how to rebuild the database (based on instructions from Lukas Gebauer):<i> </i></p><blockquote><p><i>- Stop Mercury, backup database file</i></p><p><i>- Open a command window and enter this to open Sqlite console:</i></p><p><i>sqlite3.exe gray.db3</i> </p><div><i>- Then type commands:</i></div><div><i>Vacuum;</i></div><div><i>Reindex;</i></div><i> </i><div><i>This will read the original database and store data into a new file, repairing most errors.</i></div></blockquote> <div> </div><div>It's probably a good idea to run chkdsk on the disk as well, though. </div><div> </div><p>/Rolf </p>

Thank you for the quick answer. Unfortunately that didn't help:

D:\MERCURY\graywall>sqlite3.exe gray.db3
SQLite version 3.6.13
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> vacuum;
SQL error: database disk image is malformed
sqlite> reindex;
SQL error: database disk image is malformed
sqlite>

Regards

Jyrki 

<P>Thank you for the quick answer. Unfortunately that didn't help:</P><P>D:\MERCURY\graywall>sqlite3.exe gray.db3 SQLite version 3.6.13 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> vacuum; SQL error: database disk image is malformed sqlite> reindex; SQL error: database disk image is malformed sqlite></P><P>Regards</P><P>Jyrki </P>

If it's that badly damaged, and you have no backup to revert to, I think you will need to remove the old database file and reinstall Graywall. Check the disk first, though.

/Rolf  

<p>If it's that badly damaged, and you have no backup to revert to, I think you will need to remove the old database file and reinstall Graywall. Check the disk first, though.</p><p>/Rolf  </p>

How about:

D:\MERCURY\graywall>sqlite3 gray.db3 .dump > gray.sql

D:\MERCURY\graywall>dir *.sql
 Volume in drive D is New Volume
 Volume Serial Number is C8C6-B349

 Directory of D:\MERCURY\graywall

22.10.2010  14:57         4 548 086 gray.sql
               1 File(s)      4 548 086 bytes
               0 Dir(s)  30 626 250 752 bytes free

D:\MERCURY\graywall>rename gray.db3 gray_old.db3

D:\MERCURY\graywall>sqlite3 gray.db3 < gray.sql

Is this OK?

I ran chkdsk before vacuum and reindex commands. It found five nonindexed files. Is this related to database corruption... I don't know.

Regards.

Jyrki

&lt;P&gt;How about:&lt;/P&gt;&lt;P&gt;D:\MERCURY\graywall&amp;gt;sqlite3 gray.db3 .dump &amp;gt; gray.sql&lt;/P&gt;&lt;P&gt;D:\MERCURY\graywall&amp;gt;dir *.sql &amp;nbsp;Volume in drive D is New Volume &amp;nbsp;Volume Serial Number is C8C6-B349&lt;/P&gt;&lt;P&gt;&amp;nbsp;Directory of D:\MERCURY\graywall&lt;/P&gt;&lt;P&gt;22.10.2010&amp;nbsp; 14:57&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;548&amp;nbsp;086 gray.sql &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 File(s)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;548&amp;nbsp;086 bytes &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 Dir(s)&amp;nbsp; 30&amp;nbsp;626&amp;nbsp;250&amp;nbsp;752 bytes free&lt;/P&gt;&lt;P&gt;D:\MERCURY\graywall&amp;gt;rename gray.db3 gray_old.db3&lt;/P&gt;&lt;P&gt;D:\MERCURY\graywall&amp;gt;sqlite3 gray.db3 &amp;lt; gray.sql&lt;/P&gt;&lt;P&gt;Is this OK?&lt;/P&gt;&lt;P&gt;I ran chkdsk before vacuum and reindex commands. It found five&amp;nbsp;nonindexed files.&amp;nbsp;Is this&amp;nbsp;related to database corruption... I don&#039;t know.&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;Jyrki&lt;/P&gt;

We don't know either, it could be.

As for recovery of a corrupted database the Sqlite3 site says:

Depending how badly your database is corrupted, you may be able to

recover some of the data by using the CLI to dump the schema and contents

to a file and then recreate. Unfortunately, once humpty-dumpty falls off

the wall, it is generally not possible to put him back together again.

/Rolf

&lt;p&gt;We don&#039;t know either, it could be.&lt;/p&gt;&lt;p&gt;As for recovery of a corrupted database the Sqlite3 site says:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;i&gt;Depending how badly your database is corrupted, you may be able to recover some of the data by using the CLI to dump the schema and contents to a file and then recreate. Unfortunately, once humpty-dumpty falls off the wall, it is generally not possible to put him back together again.&lt;/i&gt; &lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;/Rolf &lt;/p&gt;
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft