All my week of work in database

June 29, 2018 93 views
Applications

I've been working with database on SQL Server 2016 during all this week. But I couple of hours ago when I opened .mdf file SQL Server viewed: "Database consistency errors reported by DBCC CHECKB". I tried to find any microsoft sql server database repair tool, but all what I found didn't work out. Now, I've lack of ideas what to do.

2 Answers

There might be other options out there. This is something that worked for me once but there are no guarantees that it will work at all times.
Another way might ms sql database repair tool or manuals in the following
https://docs.microsoft.com/en-us/sql/relational-databases/backup-restore/recovery-models-sql-server
https://www.mssqltips.com/sqlservertip/3658/how-to-fix-a-corrupt-msdb-sql-server-database/
https://www.repairtoolbox.com/sqlserverrepair.html
Stop SQL Server instance -> Copy MDF and LDF files to another location -> Delete original MDF and LDF files -> Start SQL Server instance again -> Create new database with exact same name and file names -> Stop SQL Server -> overwrite newly created MDF and LDF.
After this your database should be back online. If it is then go ahead and put it into EMERGANCY mode and SINGLE USER mode.
Finally go ahead and execute DBCC CHECKDB like this
DBCC CHECKDB (databaseName, REPAIRALLOWDATALOSS) WITH NOINFOMSGS
If you can get to this and execute last command successfully you should be good.

Have another answer? Share your knowledge.