Summary

This article explains the steps to repair a corrupted database using the SQL Server Management Studio 2005


More Information

Symptoms

When Solatech returns the message: Unable to save the order. It is possible that the database is corrupted.


Cause

SQL Databases can become corrupted not allowing to save new records or to update existing records.


Solution 1

To diagnose if a table is corrupted the command DBCC CHECKDB is used.


To this command is executed as a query in the SQL Management Studio.


Steps to run the command DBCC CHECKDB:

  1. Open a Query Window.Click on the button "New Query". Depending on the version, Management Studio might ask you to connect again to the database server.
  2. Select the company database on the drop down list on the tool bar.
  3. Type the command DBCC CHECKDB
  4. Click on the button Execute or select the option Execute on the menu Query, or press F5.
  5. The command will analize all the tables in the database. If there are no errors, will show the following statement on the messages section:

CHECKDB found 0 allocation errors and 0 consistency errors in database 'Database name'.

DBCC execution completed. If DBCC printed error messages, contact your system administrator.


Steps to repair the Database

If errors are found on the database, the database need to be repaired with the switch "repair_allow_data_loss".

In order to apply this command, the database needs to be in Single User mode.


Steps to set the database in Single User mode

  • On the Object Explorer section, Open the list of Databases and make a right click on the company database, on the short menu select the option Properties.
  • On the section "Select a Page", select "Options".
  • Scroll down on the list of options. On the category "State", change the "Restrict Access" option to "Single" or ("Single_Mode" depending on the version of Management Studio)
  • Click on OK to close the Properties window. The message "To change the database properties, SQL Server must close all other connection to the database. Are you sure you want to change the properties and close all other connections?". Click on Yes.
  • The name of the database on the list will include the text "(Single User)"


Execute the command to repair database

Type the command

Use database_name

DBCC CHECKDB (database_name, repair_allow_data_loss)


Where Database name is the name of the company database.

Example:

Use Budget_Blinds

DBCC CHECKDB (Budget_Blinds, rapair_allow_data_loss)


To Execute Click on the button Execute or press F5


The following message will report any errors found and repaired.

"CHECKDB found X allocation errors and X consistency errors in database

'Canadian_Blind_Manufacturing'.

DBCC execution completed. If DBCC printed error messages, contact your system administrator."

  • Since the query window is using the only connection available, you need to close the query window using the X button on the upper right corner of the query area.
  • Return the database to Multiple User (Multi_User) mode.


APPLIES TO

  • Solatech Window Covering Software 4.2