Tuesday, 10 January 2012

How to Rectify consistency problem in SQL Tables

Solution 1:
sp_dboption 'dbname', 'single user', 'true'
go

dbcc checkdb ('dbname', REPAIR_REBUILD)
go

sp_dboption 'dbname'single user', 'false'
go


Solution 2:
The second option is to run the query given by us through query analyser.This solution given may result in a certain degree of data loss proportionate to the corruption of data.The extent and amount of data loss cannot be determined before running the query. Run the query given below from SQL Query Analyser after taking a backup.

sp_dboption 'databasename', 'single user', 'true'
go

dbcc checkdb ('databasename', REPAIR_ALLOW_DATA_LOSS)
go

sp_dboption 'databasename, 'single user', 'false'
go

No comments:

Post a Comment