#FAQ: 10102-EN, Date: 05/23/2007

How to validate and repair the NewWayService 3 database with the Firebird "gbak" and "gfix" command line utilities.


The information in this article applies to :
NewWayService 3.x (English)
NewWayService 3.x (French)


Description
This procedure explains how to validate and repair the NewWayService 3 database when it has been damaged. A database could become damaged in circumstances such as:

- Abnormal termination of the NewWayService application or the Firebird server.

- Write errors in the operating system or hardware.

- Hardware failures.


Here are some examples of error messages you can receive in such cases:

- "I/O error for file ..."
- "Error while trying to read from file ..."
- "Database file appears corrupt"
- "Database corrupted"

WARNING: Assistance of a qualified technician is strongly recommended to use the Firebird "gbak" and "gfix" utilities. For more information about command line utilities of Firebird, refer to the Firebird documentation.


Solution
1- Logon directly to the server console where Firebird is installed on. If the server is a Windows server, open an "MS-DOS" session. If the server is a Unix/Linux server, open a command shell session.

Important notice: If you are using a Windows server, commands below will only work if they are run directly from the Windows server concole. They will not work if you are accessing the Windows server console through a client terminal server session.

2- Define the following two variables (by doing this, you do not have to type in the user name and password every time you issue a command).

   SET ISC_USER=SYSDBA
   SET ISC_PASSWORD=masterkey

(If you have changed the password for the SYSDBA Firebird user, affect this new password to the ISC_PASSWORD variable instead of masterkey)

3- Go to the folder where the Firebird command line utilities are located. Usually these utilities are in the C:\Program Files\Firebird\Firebird_1_5\bin folder under Windows and in the /opt/firebird/bin folder under Unix/Linux.

4- Be sure that nobody is using NewWayService 3 while you are trying to repair the database else the operation will fail.

5- It is strongly recommended to make a copy of the NewWayService 3 database file (usually nws.fdb) before trying to repair it. Use the operating system to make a copy of the database (Under Windows use Windows Explorer or the copy command. Under Unix/Linux use the cp command). By doing this, you ensure to have a copy of your database before any modification to this one.

6- Type the following command line to check for database corruption:

   gfix -v -full nws.fdb

(Replace nws.fdb by the full path to the NewWayService 3 database.)

For example, under Windows, if the full path to the database is C:\Program Files\OroLogic\NewWayService3\nws.fdb enter:

   gfix -v -full "C:\Program Files\OroLogic\NewWayService3\nws.fdb"

Under Unix/Linux, if the full path to the database is /home/newwayservice3/nws.fdb, enter:

   gfix -v -full /home/newwayservice3/nws.fdb

Note: Use quotation marks only under Windows and only if the database path contains spaces.

7- The previous command should indicate thay the database contains errors. To repair these errors type the following command:

   gfix -mend -full -ignore nws.fdb

(Replace nws.fdb by the full path to the NewWayService 3 database)

8- Now check to see if the corruption has been repaired by typing the following command:

   gfix -v -full nws.fdb

(Replace nws.fdb by the full path to the NewWayService 3 database)

9- If you still see errors, you should now do a full backup and restore with the gbak utility.

Type the following command to make a backup of the NewWayService 3 database:

   gbak -backup -v -ignore nws.fdb nws.fbk

(Replace nws.fdb by the full path to the NewWayService 3 database. Replace also nws.fbk by the full path to the NewWayService 3 database but be sure to keep the .fbk extension.)

If gbak falls over because it is having trouble with garbage collection, then use the following command:

   gbak -backup -v -ignore -garbage nws.fdb nws.fbk

If there is corruption in record versions of a limbo transaction, then you may need to include the -limbo switch:

   gbak -backup -v -ignore -garbage -limbo nws.fdb nws.fbk

10- Now restore the NewWayService 3 database by typing the following command:

   gbak -replace -v nws.fbk nws.fdb

(Replace nws.fdb by the full path to the NewWayService 3 database. Replace also nws.fbk by the full path to the database but be sure to keep the .fbk extention)

11- The restore is now completed. Verify that the database has been fixed by typing the command indicated at step 6. The gfix utility should not indicate any errors.

12- Now you can run NewWayService 3 again.


Status
Information



© 1996-2012 OroLogic Inc.