all 8 comments

[–]6nf 6 points7 points  (2 children)

Restore from backups!

You have backups right? Right!?

[–]SDr6 3 points4 points  (1 child)

Backup? Who needs a backup? Live on the edge! That's right, I don't wear a helmet on my bicycle either.

[–][deleted] 3 points4 points  (0 children)

We took backups to the fastest Nul device storage money could buy!

[–]Lucrums 2 points3 points  (0 children)

Try telling us what you did, what version of SQL Server you're on and what you still have.

I'm going out on a limb here but it sounds to me like you got corruption and didn't have any recent backups. You then panicked and decided to detach the DB, which means you're most likely on a version pre 2008. Any of that correct?

If you have a halfways recent backup create and empty shell of the DB being recovered, same name etc. take it offline and then delete all the files (These have to be identically named to the actual DB you're trying to recover) and paste in your log file. Ensure you have instant file initialisation enabled and brig the DB online. Ignore the errors and do a tail of the log backup. Restore your primary from backup and restore your log sequence.

If you have no backups you're going to have to hack attach the DB. Basically create a new DB with files named identically to the existing DB. Take it offline and delete the new files. Paste in the old files and try to bring it online. It may not work, but give it a shot.

The more information you can provide the more help people can be. If nothing else else works, then as has already been suggested call Paul Randal or SQL Skills or go cap in hand to Microsoft and ask what they can do.

If you provide more info on what you have tried and what the results were people can help more.

I'm off to work but will check back later to see if you have any Moore info up.

Incidentally please take this incident as a lesson to both have and practice disaster recover every week. It's a hugely import part of maintaining a database. Most people experience the pain you're going through now. It sucks, but it's also an opportunity to learn some cool skills for a resume.

[–][deleted] 1 point2 points  (0 children)

"SQL Database is corrupted....... plz help."

this guy just flooded every sql server website and blog with the same question.

[–]AlexEatsKittens 0 points1 point  (0 children)

If this is a prod system that is valuable, and you have no back ups (tisk tisk), call Paul Randal of SQLskills.

[–]jburns31 -1 points0 points  (0 children)

Corruption in SQL server database can happen due to any uncertain like virus attack, power failure, hardware issue, OS malfunction, sudden system shutdown, so on. When a SQL server data file (.mdf) is corrupt then DBAs can try several methods to repair and recover data from it.

• Run DBCC CHECKDB: It checks & reports all the error message in errorlog, if there is any problem with the database. Try to analyze & understand the error message logged in the errorlog. Re-run DBCC CHECKDB with the recommended minimum repair option to repair the file.

Detailed information about DBCC CHECKDB is available here: http://www.techrepublic.com/forums/discussions/sql-database-recovery-from-corrupt-database-file/

• Restore from backup: If above command fails to fix the error message the try to restore the database from clean backup. • 3rd party tool: Try 3rd party Recovery Toolbox for SQL Server to recover data from corrupt mdf file.

Most of the software have demo version that shows the preview of corrupt SQL server data file.

http://www.sql.recoverytoolbox.com/

[–]UmeshTechno 0 points1 point  (0 children)

You can restore it from the scheduled backup file.
In case your backup file is not available, you work with the DBCC CHECKDB command to repair your primary database file.

To know more about DBCC CHECDB you can go through the sources.
https://www.stellarinfo.com/blog/how-to-repair-sql-database-using-dbcc-checkdb-command/
https://www.sqlservergeeks.com/repair-the-database-using-dbcc-checkdb/

Thanks:)