DBCC CHECKDB,REPAIR_REBUILD,REPAIR_ALLOW_DATA_LOSS

The below piece of code is providing your the DBCC CHECKDB commands.
USE master
GO
ALTER DATABASE AdventureWorksDW2017 SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CHECKDB('AdventureWorksDW2017',REPAIR_REBUILD) 
ALTER DATABASE AdventureWorksDW2017 SET MULTI_USER
----------------------------------------------------------------
USE master
GO
ALTER DATABASE AdventureWorksDW2017 SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CHECKDB('AdventureWorksDW2017',REPAIR_ALLOW_DATA_LOSS) 
ALTER DATABASE AdventureWorksDW2017 SET MULTI_USER

Comments

Popular posts from this blog

System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out

Pre login Handshake or Connection Timeout Period

Transparent Data Encryption(TDE) with Master Key and Certificate in SQL Server