I read several forums questions related to SQL database corruption. As we all know, backup is the best way to repair SQL database. What a user will do when backup copy is also corrupted or updated bacjup is not available?

Is DBCC CHECKDB Repair option (Repair_Allow_Data_Loss) safe?

Yes, it is safe. Go to manual process:

DBCC CHECKDB (Name_of _corrupt _database)

Case 1: If index ID > 1, drop it and create it again.

Case 2: If index ID is either 0 or 1, then run DBCC CHECKDB again with the appropriate repair options like repair_rebuild, repair_fast, or repair_allow_data_loss.

DBCC CHECK (name_of_corrupt_database, repair_fast)
DBCC CHECK (name_of_corrupt_database, repair_rebuild)
DBCC CHECK (name_of_corrupt_database, repair_allow_data_loss)

Now, to ensure zero corruption, execute DBCC CHECKDB and a message is displayed i.e. DBCC CHECKDB displays 0 allocation errors and 0 consistency errors in name_of_your_corrupt_database.

I hope you get the best solution here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.