Tuesday, December 27, 2011

How to troubleshoot SQL server Error 9002

-->
SQL server database mainly contains two files, one is data file & another is log file. Data file contains the information about data while log file contains the information about transactions in the database. In simple recovery model, log files are managed automatically but in case of bulk-logged & full recovery model database administrators are responsible to manage the size transaction log file. You can perform this by shrinking the transaction log file.

Sometimes, SQL server database generates an error message 9002 when it found insufficient log space. This error message will appear when SQL server database is online or in recovery mode. If database is online and struggling with log space problem then you can read the database but unable to do any update on it. If log fills during recovery then SQL server marks database in suspect mode. 

Space Full
-->
The log file for database '%.*ls' is full. Back up the transaction log for the database to free up some log space.

 
Work Around: As error message states, if the size of log file is full then immediately take the backup of database and issue some free space for the log file. Now the point comes in your mind, how to perform this. To do this follow the below given steps:
  • Backup the transaction log.
  • Issue some disk space.
  • Move the log file to a disk drive (secondary storage media) with sufficient space.
  • Enlarge the log file.
These are the possible user action required to perform the SQL server recovery. Detail description is given below:
Backup the transaction log: If you are using simple recovery model then backup of transaction log is not possible. Take the backup of transaction log file, if you are using bulk-logged or full recovery model.
Issue some disk space: Regardless of recovery models, freeing the disk space allow recovery system to enlarge the transaction log file automatically.
Move the log file to a disk drive: If you are unable to free some disk space to the transaction log file then move the log files to a disk drive with sufficient space.

Sunday, November 27, 2011

Unable to Start MS SQL Server Database

Database Users or administrators can start Microsoft SQL server database from the task bar. To start, go to the task bar, open sq server service manager and then click on the start button. Sometimes MS SQL server is not start through this method and give some error message like

2011-11-20 10:15:39.87 server Microsoft SQL Server 2000 - 8.00.760 (Intel X86)
Dec 17 2002 14:22:05
Copyright (c) 1988-2003 Microsoft Corporation
Desktop Engine on Windows NT 5.1 (Build 2600: Service Pack 2)

Most possible reason for the above error message is “model is corrupt”. To resolve this, you can create a new copy of tempdb. This will fix the starting problem of SQL server database. If you still face the same problem then first of all make the backup of all MDF & LDF files.

How to Make Backup when Unable to Start SQL Server? As we have discussed, you are unable to start sql server then take a backup of data & log files by below steps:

  • Set SQL server service manual by Windows control panel.
  • Reboots the windows.
  • Copy all the data and log file to the another computer or any removable media.

Attention: Don't try any methods until you have backup.

Have Backup? If Yes then use another copy of sql server with same version and level to restore model database using model.mdf & model.ldf. After restore, detach model database from new sql server and copy the data & log files to replace problem server. It is little bit messy to recover SQL server but not hard. In simple words, we can say that you will have to perform three steps:

        Restore-->Detach-->Copy (data & log files)

Doesn't Have Backup? If you don't have any backup of sql server database then it is recommended you to install a new copy of MS SQL server. When installation is complete the stop the service and copy the Model file to replace problem server.

Summary: SQL server database starting problem can be resolved by two method, one is restore-detach and another is new installation. Restore-detach method is hard in comparison of new installation method but it is effective.

Tuesday, November 1, 2011

Exploring the concept of Page Corruption in MS SQL Server databases


No matter how reliable your database seems to be, you always have issues on the performance grounds. More interestingly, I found out that many performance issues relate to page corruption in SQL Server. It would be good to understand here what exactly is meant by ‘BAD_PAGE_PROCESS’. It usually occurs when the background suspect page logger stops running after every five seconds because of a large number of suspect pages. If you want to checkout suspect pages, run the following T-SQL command:

“select * from msdb.dbo.suspect_pages”

I took the help of DBCC CHECKDB on a corrupt SQL database to find out the actual issue and whether it is able to resolve it. Ran the following command:

“DBCC CHECKDB () WITH ALL_ERRORMSGS, NO_INFOMSGS”

Got errors similar to this one:

“Table error: Allocation page (1:1002912) has invalid PFS_PAGE page header values. Type is 0. Check type, alloc unit ID and page ID on the page.”

The PFS pages can neither be deleted nor reconstructed as there is no easy way to examine which pages are allocated or not.

Now, I tried to view the contents of the page by using the ‘DBCC PAGE’ command as follows:

“dbcc traceon(3604)
go
dbcc page(,1,1002854,0)”

After looking at the content of the page, I found that there was some corruption in the next page pointers. This seemed to be a bit weird as initially the next page pointer was like:

“m_nextPage = (1: 1002855)”

When I decided to look at the next page and ran:

“dbcc traceon(3604)
go
dbcc page('GBLDataWarehouse',1,1002855,0)
go”

It was now pointing to page 0:

“m_nextPage = (0:0)” & “m_prevPage = (0:0)”

Finally, used a recent backup to restore the database and got it up and running once again. But again, it was wise to see where the issue occurred.

Monday, October 10, 2011

Transaction Log File & Recovery Models

SQL Server transaction log file is used to store recent database transactions. When you modify or alter any entity in SQL server database then it will be result in a write action in the transaction log file. Generally we do several activity on the SQL server database like add, delete, rename, update, insert and many more and this will also be the result of write action in the transaction log file but a read action on the SQL server database does not change the transaction log file.

Does recovery models affect transaction log? 
  • The answer is NO. Recovery models (simple, full & bulk-logged) do not affect what has written into the transaction log but it effects the time period of entries that present in the transaction log, detail description is as follows:
  1. Simple Recovery Model: In this recovery model, transaction log entries are keeping for the database integrity not for the database recovery purpose. When we run checkpoint operation on the transaction log files then all the inactive entries are deleted and space is ready for reuse. It is also the best way to manage the size of transaction log file but you can prefer another way also to manage size of transaction log file.
  2. Full Recovery Model: In this recovery model, entries are key for the both integrity as well as for database recovery purpose. All the entries are remains present in the transaction log file until a log backup does not perform on the file. Sometimes it difficult to manage the size of transaction log files through this recovery model.  
  3. Bulk-logged Recovery Model: It is almost same as full recovery model but in this recovery model bulk operations are minimally logged.

How to Monitor Size of Transaction log file?
  • You can monitor the size of transaction log file by DBCC SQLPERF command. When will you run this command then it returns information about amount of log space used currently and it also indicates when transaction log is in need to truncate. Log truncation frees the used disk space but does not reduce the size of physical transaction log file. To reduce transaction log file size, you will have to shrink the log file.

How to shrink transaction log file in full recovery model?
  • You can shrink the transaction log file manually by the using of DBCC SHRINKFILE command. This command may be differ for the different SQL server database.

Tuesday, September 20, 2011

How to Fix Error “Unable to attach database” In SQL server?

-->
Last Tuesday, we have faced a scary situation when my friend's hard drive has crashed and he has not maintain any backup for the database then he has used data recovery services offered by stellar data recovery and retrieve his database and log files. After retrieving database and log files, he came to me and ask how to fix error 5173 and 824.

After retrieving database and log files from the crashed server, he had tried to attach the SQL server database but got error messages 5173 & 824 and unable to access his database. He can't recover SQL database from backup because i have mentioned above he has not maintain any backup.

How to Fix: We have followed below steps to fix the errors.

  • We have created a database with same name and same SQL data files (MDF & NDF).
  • Make the file size identical as original SQL server database
  • Stop the SQL server database services.
  • Rename the old MDF to new one and copy the old MDF to new MDF location
  • Delete the LDF files.
  • Start SQL server database services
  • Our database has gone in suspect mode.
  • Update the sysdatabases to update to Emergency mode. This will not use LOG files in start up Sp_configure “allow updates”, 1
    go
    Reconfigure with override
    go
    Update sysdatabases set status = 32768 where name = “corruptDBName”
    go
    Sp_configure “allow updates”, 0
    go
    Reconfigure with override
    go
  • Now restart SQL server database.
  • Our database is in emergency mode.
  • Run DBCC CHECKDB on our database with repair_allow_data_loss, that will rebuild the log files and full repair.
  • Again restart SQL server database and now our database is online.    

Tuesday, August 23, 2011

How to Move SQL server user Database?

-->
Microsoft SQL server has two types of database, one is system database and another is user database. A system database is used by the SQL server for its own maintenance and management while a user database is used by the database administrator for storing user data. In this article, we will discuss about to “How to move SQL server user database within same instance”.

A database administrator can move data and log files of user database to a new location by specifying the new location in a filename clause of ALTER database statement. To move a SQL server user database follow the below steps:

  1. Set the database off-line through this command
ALTER DATABASE database_name SET OFFLINE;
  1. Move the files to a designation location
Run this command for each move file.
ALTER DATABASE database_name MODIFY FILE ( NAME = logical_name, FILENAME = ' new_path\os_file_name' );
  1. Now set the database online through this command
ALTER DATABASE database_name SET ONLINE;
  1. Verify the changes
SELECT name, physical_name AS CurrentLocation, state_desc
FROM sys.master_files
WHERE database_id = DB_ID(N'');

Note: The above method is applied to moving database within the same instance of SQL server database. To move database from one instance to another, you can try backup and restore method.

Example: Suppose we have a log file sqlserverdatabase and want to move in to a new location.

Use master;
Go
SELECT name, physical_name AS CurrentLocation, state_desc
FROM sys.master_files
WHERE database_id = DB_ID(N'sqlserverdatabase')
AND type_desc = N'LOG';
Go
ALTER DATABASE sqlserverdatabase SET OFFLINE;
GO
ALTER DATABASE sqlserverdatabase MODIFY FILE ( NAME = sqlserverdatabase_log, FILENAME = 'C:\NewLoc\sqlserverdatabase_Log.ldf');
Go
ALTER DATABASE sqlserverdatabase SET ONLINE;
GO
SELECT name, physical_name AS CurrentLocation, state_desc
FROM sys.master_files
WHERE database_id = DB_ID(N'sqlserverdatabase');
AND type_desc = N'LOG';

Friday, August 19, 2011

Restore SQL server Database in case of Corruption

MS SQL server database offers a high performance backup and restore facility to its database users for maintaining the backup of SQL server database and restore in case of corruption. SQL server database may be corrupt due to severely reasons like media failure, user errors, power failure, metadata structure corruption, virus attack and many more. High performance backup and restore facility enables database administrator to handle all above corruption issues in SQL server database. A well planed backup and restore strategy helps database administrator to protect their data in case of above mentioned failures. The point comes to describe backup.

Backup: A copied data that can be used in restoring the corrupted data is called backup.

How to make a backup of SQL server database? : A database administration can take a backup of SQL server database with the help of SQL server management studio. Below image is the screen-shot to make a backup in SQL server database.




Restore SQL server Database in case of Corruption?: A database administrator can restore corrupt SQL server database with the help of good backup but he/she will be also able to restore corrupt SQL database without any backup. In this article we will discuss about both two methods for restoring corrupt SQL server database.

Restore with Good Backup: A database administrator can use “backup & restore” method, if he has maintained a good backup for his database. Two machines are required in this method. One is source machine where corrupt database reside and another is designation machine where corrupted database will be restored. 

Note: Make sure following point before restoring the database
  • The designation machine has sufficient space to restore.
  • Directory structure on designation machine is must to exist.
  • Don't have same file name on the designation machine.
Restore without Backup: A database administrator is still able to restore corrupt SQL server data files without any good backup. In this situation, you should take help from any Microsoft gold certified SQL server recovery software. Stellar Phoenix SQL recovery software is a Microsoft gold certified partner that repairs corrupt SQL server data files and its objects. It is the most recommended software by the database expert to repair corrupt SQL server database.

Wednesday, July 27, 2011

How to fix Error “Open Failed” in SQL server

When you are trying to start the services of SQL server database and found the database is unavailable. At this situation you are unable to do any operation on the SQL server database like insert, delete, rename, update, and many more or even unable to open the SQL server database. You can open and see SQL server error log to know the reasons for the problem. After knowing the reason, you can take appropriate method to recover sql server database. When you open the error log got an error message. The error message is:

"FCB::Open failed: Could not open file for file number . OS error: 5(access denied)"

Possible Cause: There are tons of reasons for the above problem but we will discuss here about hardware failure problem and account access problem.

Hardware Failure Problem: Whenever you will get the above error message. It is recommended you to check the hardware component of your system first before try any other action. If you found any faulty hardware component then replace it with new one and fix the problem.

Account Access Problem: The account in which SQL server is running does not has permission to access the folder that contains data and log files.   

Follow Steps to Fix
: You can fix the above error message by following the below steps:
  • Click on the Start button of your system
  • Go to the programs and select SQL server
  • Click on the folder that contains one the database files
  • Right click on the folder
  • Select sharing and security
  • Now, select security button
  • Click on the Add button
  • A text box will be appear
  • Write qualified user-name of the service account in the text box
  • Check the allow column to ensure full control
  • Repeat these all steps for all other database and log folder.
  • Shutdown the SQL server database
  • Now, restart the SQL server database from configuration manager.

Tuesday, June 21, 2011

How to repair MS SQL server 2005 Database?

In this article, I have described about how to repair a corrupt “MS SQL server 2005 (compact edition) database” with the help of engine object repair methods.

MS SQL server 2005 compact edition database has several files and all these files are divided into four kilobytes unit each, these files are known as pages. SQL server compact edition database stores a checksum for all pages. If a page is corrupted or damaged then checksum of the page does not match with stored checksum. There are so many reasons for the corruption in the database file like Meta data structure corruption, virus attack, sudden system download, hardware failure and many more. If you have verified that there is a corruption in the database file then you can repair sql server database file by the engine object repair method.

You can verify corruption is the database file by calling system.data.sqlserverce.sqlceengine command. If this command returns a true value then there is no corruption in the database file and if this command returns a false value then there may be some corruption in the database file. The syntax for verifying the corruption is given below:

Syntax for verify

if (false == engine.Verify()) {...}

If a database file has been corrupted then you can recover database file by engine object repair methods. This method scans and fixes the corrupt database file. Engine object repair method provides two repair methods:

1)  repairoption.deletecorruptedrows
2) repairoption.recovercorruptedrows

Repairoption.Deletecorruptedrows: This method discards all the corrupted pages and recovers the database files but you may lose some data if corrupt database file contains the database schema.

Syntax for this method
engine.Repair(null, RepairOption.DeleteCorruptedRows);

Pros: Guaranteed that recovered database is free from logical corruption.
Cons: You may lose some data, if you will use this method.

Repairoption.recovercorruptedrows: This method tries to read more data from corrupted database files and recover more data as can possible.

Syntax for this method
engine.Repair(null, RepairOption.RecoverCorruptedRows);

Pros: Recover more data in comparison with repairoption.deletecorruptedrows.
Cons: Does not guarantee that recovered database is free from logical corruption.

Friday, May 27, 2011

Analyzing DBCC CHECKDB failure in severe corruption cases and MDF Database Recovery

The DBCC CHECKDB utility is used more often than not by almost all SQL database users. This eminent utility makes use of an internal database snapshot to obtain transactional consistency of the database. It uses this information to check and repair SQL database following a three stage process. In the first stage, it performs an allocation check. Then it checks all the critical system tables for consistency errors in the second stage. In the final stage, a consistency check of the whole database is performed. Sometimes due to severe corruption, the process cannot be completed. If the CHECKDB utility fails to repair corruption, you should go for SQL recovery through a reliable third-party software.

For instance, you use MS SQL Server 2000. While running CHECKDB on one of your important database files, you notice that the process terminates unexpectedly giving you the following error message:

Database 'DBNAME' consistency errors in sysobjects, sysindexes, syscolumns, or systypes prevent further CHECKNAME processing.”

Cause:
The CHECKDB utility encountered some errors in the second stage that it cannot repair. So, it simply aborts the process before reaching the third stage and throws the above specified error message. The completion of the second stage is necessary for executing the third stage.

This could have happened due to metadata corruption in the database system tables. Corruption may make all the components in your database inaccessible. You may use a backup to restore all the lost or inaccessible data. If the backup is missing, you should follow the below mentioned resolution steps to perform MDF file recovery.

Resolution:

Try the following methods to resolve the problem-

Check the SQL Server error log and the Windows application and system log to determine the cause of the problem. If hardware failure caused the problem, run the hardware diagnostics tool.
Run DBCC CHECKDB with proper repair clause to fix corruption.

If the problem still persists, you should take help of a SQL database recovery software. These software are capable of recovering the damaged SQL database components in their original form restoring all their properties and relationships with other components. They retrieve tables, views, queries, indexes, stored procedures, keys, constraints etc. from the corrupt database.

Tuesday, April 12, 2011

How to Recover Database When MDF file get corrupted ????

The data loss from the database is a very panic situation that occurs without any warning message. It can corrupt or damage our data stored on our hard drives or on any storage media. The database may be corrupted due to hardware failure, application failure, improper system shutdown, media read errors, software failure, power failure, virus attack and many other reasons. In such case you need to use an advanced database recovery software to recover and repair corrupted database. In case of MDF file corruption, you may face any of the given below error messages:-

Windows could not start the SQL Server”
“MDF is not a primary database file”
“Server can’t find the requested database table”
“Database Can’t Be Accessed”
“The file *.mdf is missing and needs to restore”
“The execution of a full-text query failed”.

Solution: To repair and restore corrupted .mdf file by any of the above error message follow given below steps:

Fix Hardware Issue: To fix the error message check your hardware setup if found any problem with the hardware then repair or replace it by new one and fix the problem.

Run DBCC CheckDB Command: If the problem is not related to hardware then run dbcc checkdb command without any clause and then run again dbcc checkdb command with the proper repair clause.

Restore from Backup: After running the dbcc checkdb command and you still getting an error message then restore database from the latest and updated backup. If you have no any backup then you should try an advanced mdf recovery utility to repair and restore corrupted .mdf file.

Thursday, February 10, 2011

Reliable mdf repair utility for risk-free recovery of your SQL server database

If you are using a Microsoft SQL database for storing your valuable business transactions and financial information, then, any instance of database corruption can be a huge blow to your business. The damage to the database can result in the complete inaccessibility of the data stored n it. In such cases, you can run ‘DBCC CHECKDB’ from the command-line, which can repair and fix the MS SQL database errors. If with higher degree of corruption, the database DBCC CHECKDB fails to resolve the problem, you can always run an reliable SQL repair utility to accomplish the job safely.

Following are some of the error messages, which you may encounter, while trying to fix them with DBCC CHECKDB command:

“Server: Msg 8905, Level 16, State 1, Line 0
Extent (1:6945928) in database ID 8 is marked allocated in the GAM, but no SGAM or IAM has allocated it.
Server: Msg 8905, Level 16, State 1, Line 0
Extent (1:6945936) in database ID 8 is marked allocated in the GAM, but no SGAM or IAM has allocated it.
Server: Msg 8905, Level 16, State 1, Line 0
Extent (1:6945944) in database ID 8 is marked allocated in the GAM, but no SGAM or IAM has allocated it.

The command fails to resolve the issues and further flashes the below messages:

Repairing this error requires other errors to be corrected first.
Repairing this error requires other errors to be corrected first.
Repairing this error requires other errors to be corrected first.
Repairing this error requires other errors to be corrected first.”

Cause:
The MS SQL Server database has been severely damaged and DBCC CHECKDB is unable to repair the same.

The best possible way to get the database and the data back is to restore it from a valid backup. If you have not taken any backup recently or there are any unresolved problem in restoring it from the backup server, then, you have to look for any good mdf repair utility.

These SQL recovery software are meant to repair the corrupt SQL database and recover the tables, schema, triggers, containers etc with their originality being intact.

Stellar Phoenix SQL Recovery is a trusted utility to safely repair SQL database and recover your data without any alteration to the database. This efficient utility is capable of repairing the MS SQL Server 2008, 20005, 2000 databases and is completely compatible with Windows 7, Vista, 2008, XP, 2003 and 2000 operating systems.

Sunday, February 6, 2011

Use Advanced SQL Recovery Tool to Repair MDF Files

If you are regularly using Microsoft SQL 2008, then you might have faced several situations wherein you are unable to mount a SQL Server database. Such cases are sometimes cause very serious problem such as database corruption or complete inaccessibility of the SQL database thereby making your database very insecure. These corruption scenarios can arise due to various reasons such as automatic system shutdown when the database is running, power failure, virus infections, hardware issues, human errors etc. In such cases, you should find the cause of database corruption and try to repair SQL. If you are unable to repair SQL(.MDF) file, then you should use an advanced MDF file repair software to perform SQL database recovery.

Consider a Practical scenario wherein you try to open a SQL database while using MS SQL Server 2008. However, database does not open. An error message appear as a result, which is:

"Database '%.*ls' cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server error log for details."

Cause:

The root cause of above error message is that the database could not be mounted because some resources or files are missing.

Resolution:

To resolve above error message, you should repair MDF file. To do this, you need to perform the given below methods:

Check Error log: Firstly, You should check error log to get the details about resources such as disk space, memory, permission failure, etc that may have caused the above problem.

Confirm the location of SQL Database files: You should check the location of MDF or LDF files and verify whether Database Engine account has required credentials to access these SQL Database files.

Restart Database: Finally, you should restart the SQL Server database with the help of ALTER DATABASE query. This query sets the SQL Server database to online.

Above described methods should be able to set the SQL database up. However, if you still are unable to mount the database then you should use a SQL repair tool to repair SQL Server database. Such MDF database repair software are read-only in nature.

Stellar Phoenix SQL Database Recovery software is an SQL database repair tool that repairs MDF file and NDF file alike. Specifically designed for MSSQL Server 2000, 2005, 2008 and 7.0. This MDF file repair tool restores various database objects such as collations, tables, stored procedures, triggers, defaults and many more. In addition, this repair mdf software preserves the relationship among the database tables.

Friday, January 28, 2011

Binary Tree Corruption cause Data Loss in SQL Server

Microsoft SQL Server database supports binary tree indexes for fast query. The pages of Binary tree index are known as index nodes, the top node of binary tree is known as root node. However, the middle nodes are known as branch nodes and bottom nodes are known as leaf nodes. If table indexes get damaged, SQL Server database shows an error message and you unable to access your SQL database. To resolve such situations, you should use your most latest backup and restore the lost data. Sometimes, backup fails to restore the database and thus, you need to use SQL database recovery software.

You are working on SQL Server database wherein, You might get below error message:

Server: Msg 8936, Level 16, State 1, Line 1
Table error: Object ID O_ID, index ID I_ID. B-tree chain linkage mismatch. P_ID1->next = P_ID2, but P_ID2->Prev = P_ID3.

Root Cause of Problem:

The above error message appears when SQL Server database find a break in logical page chain at any level of Binary tree. It can happen at any level of binary tree including root, middle and leaf nodes.

Resolution:

For solving the above error message, you should follow the given below steps:

Run the hardware diagnostics as above problem could occur due to hardware problems. Fix the hardware problems, if any.
If the problem persists still then restore the corrupted SQL Server database from a latest and clean backup.
In case of unavailability of valid SQL server backup, you could run DBCC CHECKDB command to find the amount of corruption and note the repair clause. Again run DBCC CHECKDB command with suggested repair clause.
If database still unaccessible, you should use an advanced SQL database recovery tool.

These SQL database recovery tools are advanced tools that can effectively repair and restore corrupted SQL databases. Such tools are equipped with rich GUI, to-the-point documentation. You can freely use these software for repairing and restoring corrupted or damaged SQL Server database in any case of SQL database corruption.

The most trusted SQL Database recovery tool by the many database administrator is Stellar Phoenix SQL Recovery tool. It is a complete repair software for damaged or corrupted SQL Server databases. This software supports mdf recovery for SQL Server 2008, 2005 and 2000. It is available with advanced graphical user interface and restores all database objects like tables, triggers, user defined data types, stored procedures, collation views, rules and many more. The software is compatible with Windows Vista, XP, 2003, 2000, NT and 7.0.

Thursday, January 20, 2011

Recover SQL Server Database from Corrupted Table

Sometimes when you want to update or delete SQL server database table and got an error message that shows your SQL server database table has been corrupted. This may happen by the several reasons some of them are improper system shutdown, virus attack, hardware failure, power failure and many more. At this situation you will be unable to access your SQL server database table. For fixing this problem you should use an advanced SQL server recovery software that will repair and restore your damaged SQL server database table.

Consider a practical scenario wherein, you may encounter the given below error messages while your are trying to update, delete or open an SQL server database table:

“Error: 644, Severity: 21, State: 5
Could not find the index entry for RID '1613b1000000100' in index page (1:189), index ID 7, database 'TestDB'..
Error: 8646, Severity: 21, State: 1
The index entry for row ID was not found in index ID 7, of table 2009058193, in database 'test644'.”

Particularly the above error message occur on the non-clustered index of Microsoft SQL server database but sometimes this problem also occurs with the clustered SQL server database database.

Resolution: For restoring corrupt SQL server database table, you have four option which are given below:

Fix Hardware Issue: Check the hardware of the system if you find any faulty hardware then replace it with the new one.
Restore from Backup: Restore it from the latest backup, if backup is clean and updated.
Run DBCC CHECKDB: Run this command to fix the problem.
Re-built Indexes: If possible then rebuilt indexes of table but it is not the better idea.

After performing three above steps and you are still unable to fix the problem then the best idea is to buy an advanced third party SQL recovery software to fix the problem.

Stellar Phoenix SQL Database Recovery is an MDF recovery software that is able to repair MDF as well as NDF files from all instances of corruption. It repairs corrupted MDF, NDF files created in SQL Server 2000, 2005, and 2008. This MDF file repair tool is capable of recovering various database components such as tables, stored procedures, views, collations, queries, triggers, etc. It is compatible with Windows 7, Vista, Server 2003, XP, and 2000.