#FAQ: 10131-EN, Date: 05/22/2009

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


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


Description
This procedure explains how to validate and repair the NewWayService 4 database when it has been damaged.

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_2_1\bin folder under Windows and in the /opt/firebird/bin folder under Unix/Linux.

4- Be sure that nobody is using NewWayService 4 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 4 database file (usually nws.fdb) before trying to repair it. 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 4 database.)

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

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

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

   gfix -v -full /home/newwayservice4/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 4 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 4 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 4 database:

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

(Replace nws.fdb by the full path to the NewWayService 4 database. Replace also nws.fbk by the full path to the NewWayService 4 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 4 database by typing the following command:

   gbak -rep -v nws.fbk nws.fdb

(Replace nws.fdb by the full path to the NewWayService 4 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 4 again.


Status
Information

See also FAQ 10130-EN



© 1996-2012 OroLogic Inc.