I have been told that my database is corrupt, what do I do now?

Note: We will sunset inFlow v2 on July 31, 2024. This means inFlow v2 will no longer be offered for download and we will no longer be hosting its Knowledge Base and support articles.

Your database getting corrupted is a rare circumstance that does not happen very often. Most commonly, it’s a result of hardware failure on your computer, like a bad hard drive. Before proceeding, please be sure that an inFlow representative has confirmed with you that the problem is in fact database corruption, and not, for example, incorrect products or prices entered into the system.

Unfortunately database corruption is bad news, it means that there is a serious problem with your inFlow database, and that you may lose some or all of what you’ve entered into inFlow.

Behind the scenes, inFlow relies on a Microsoft SQL Server database to store its data, like your products and orders. If SQL Server is reporting that the database is corrupted in some way, then this is beyond our expertise to solve. We recommend that you hire a local database administrator (DBA) with expertise in data recovery in SQL Server to take a look at the issue and maximize the chance that your data can be recovered.

Here is some technical information that may be useful:

inFlow installs a separate instance of SQL Server called INFLOWSQL. By default, inFlow uses SQL Server 2008 R2 on Windows 8 and SQL Server 2005 on other operating systems. The inFlow database contains all of the important data (the product list, etc.). The inFlowMeta and inFlowSample databases are not important — if only these databases are corrupted it can be corrected by making a backup of the inFlow database, then uninstalling and reinstalling the inFlow program, then restoring the backup. inFlow creates some automatic backup files in C:\ProgramData\inFlow Inventory\Backup (or C:\Documents and Settings\All Users\Application Data\inFlow Inventory\Backup on older versions of Windows) and the database files are stored in C:\ProgramData\inFlow Inventory.

Here are some troubleshooting routines that you may want to run. These can be done with the assistance of a DBA or possibly on your own.

Search your inFlow backups for the last good one

Start by finding the backup files that inFlow created automatically for you. The backup files are in  C:\ProgramData\inFlow Inventory\Backup (or C:\Documents and Settings\All Users\Application Data\inFlow Inventory\Backup on older versions of Windows).

If you have created your own backups, include those too. The basic procedure we will do is start with the newest backup and try to restore it and see if there are any problems. If that fails, try the next newest backup until we either run out of backups or find one that works. You will still need to re-enter any data entered since the last successful backup, but this approach may save most of your data.

  1. Open a command prompt as an administrator. On Windows XP as an administrator, click Start, Run, then type in “cmd” and press enter. On Vista or 7, click Start, type in “cmd” then right click cmd.exe and select Run as administrator. On Windows 8, hit the Windows Key + X, hit A, and then select Yes to allow permission to run as an administrator.
  2. Copy the line below:
    sqlcmd -S .INFLOWSQL
    then right click the command prompt window, hit Paste, then hit Enter in the command prompt.
  3. It should show you a prompt that looks like 1>. Enter the following command
    RESTORE DATABASE [inFlow] FROM DISK = N'C:\ProgramData\inFlow Inventory\Backup\inFlow_autobak_2013_01_01__12_00.ifi' WITH RECOVERY, FILE = 1
    replacing the filename with the correct one, and press Enter.
  4. It should show you a prompt that looks like 2>. Enter the following command
    GO
    then press Enter. It should show you some text with a successful message including “RESTORE DATABASE successfully processed" and then the 1> prompt again.If there are errors shown, double check that you’ve entered the command correctly. If you entered the filename incorrectly, the error message will include something like “The system cannot find the file specified”.

    If you entered the command incorrectly, it will typically say something like “Incorrect syntax near…”.

    Otherwise, for any other errors, this backup file may still have problems, so you may want to try restoring the next oldest backup file.

  5. If the previous step worked properly, you should check that the restored database has no errors.
    Copy the line below:
    DBCC CHECKDB([inFlow]) WITH NO_INFOMSGS, ALL_ERRORMSGS
    then right click the command prompt window, hit Paste, then hit Enter in the command prompt.
  6. It should show you a prompt that looks like 2>. Enter the following command
    GO
    then press enter. If the database is fine, then it should just show you the 1> prompt again. Otherwise, error messages will be printed. If there are error messages, try the above steps with the next oldest database file.

If inFlow is still partially usable, export and re-import your data

If the database is corrupted but still usable (i.e. you can still run inFlow and perform most operations), you may want to consider exporting your data out of inFlow into CSV format (Main Menu -> General -> Export Data), reinstalling inFlow, and then importing the data back. This is an imperfect option since much of your information will be lost (e.g. full transaction history, company settings, picking or shipping data, etc.).

Other Recovery Procedures

There are other recovery procedures that are beyond our expertise but that you may attempt with the aid of a database administrator. Here are some links to suggestions that may be useful starting points:
http://stackoverflow.com/questions/2470692/recovering-transaction-log-from-corrupt-sql-database
http://www.sql-server-pro.com/dbcc-checkdb.html

Yun Ling
Archon Systems
w,
+1.866.923.4974
260 Carlaw Ave #397
Toronto, ON, M4M 3L1
Canada
April 7, 2017