Donate

Repair A SQL Server 2008 Suspect Database After Upgrading

Lately, I've installed SQL Server 2008 Developer Edition in my pc and migrated all sql server 2005 databases.

Upon attaching/restoring all databases, some were marked as suspect. Below is the sql script to repair those databases.
  EXEC sp_resetstatus 'Test';  
    ALTER DATABASE Test SET EMERGENCY  
    DBCC checkdb('Test')  
    ALTER DATABASE Test SET SINGLE_USER WITH ROLLBACK IMMEDIATE  
    DBCC CheckDB ('Test', REPAIR_ALLOW_DATA_LOSS)  
    ALTER DATABASE Test SET MULTI_USER  

But as a precautionary measure,I have back-up plans for each database,as to have another copy when things go wrong.

Test is the database name.

Source: how-to-repair-sql-server-2008-suspect

Comments

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

How To Insert Or Add Emojis In Microsoft Teams Status Message

TypeScript Error Or Bug: The term 'tsc' is not recognized as the name of a cmdlet, function, script file, or operable program.