question

AdriannaRobinson avatar image
AdriannaRobinson asked

Table Corruption Error - How can I extract the data?

I rarely use Microsoft SQL 2014, and therefore I do not understand much about it. But for work I needed to translate some data into mdf format. I crashed while working and now I can not extract a fragment of the material due to an error: SQL Server Table Corruption Error. How can I extract the data as soon as possible?
errorcorruption
2 comments
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

What was the corruption error?
0 Likes 0 ·
Can you tell us what you mean by "as soon as possible"?
0 Likes 0 ·
MikeMeyers avatar image
MikeMeyers answered
[ https://www.mssqltips.com/sqlservertutorial/112/recovering-a-database-that-is-in-the-restoring-state/][1] **How to repair [sql][2] database file WITH RECOVERY** As mentioned above this option is the default, but you can specify as follows. - RESTORE DATABASE AdventureWorks FROM DISK = 'C:\AdventureWorks.BAK' - WITH RECOVERY - GO **Recover a database that is in the "restoring" state** - The following command will take a database that is in the "restoring" state and make it available for end users. - RESTORE DATABASE AdventureWorks WITH RECOVERY - GO **Restore multiple backups using WITH RECOVERY for last backup** - The first restore uses the NORECOVERY option so additional restores can be done. The second command restores the transaction log and then brings the database online for end user use. - RESTORE DATABASE AdventureWorks FROM DISK = 'C:\AdventureWorks.BAK' WITH NORECOVERY - GO - RESTORE LOG AdventureWorks FROM DISK = 'C:\AdventureWorks.TRN' WITH RECOVERY - GO [1]: https://www.mssqltips.com/sqlservertutorial/112/recovering-a-database-that-is-in-the-restoring-state/ [2]: http://www.mssqlserver.repair/
1 comment
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

While this is handy, the corruption (depending on what it is) could exist in the backup. The OP needs to clarify what the corruption is to determine the course of action.
1 Like 1 ·
jason_clark03 avatar image
jason_clark03 answered
The issue occurs as there is corruption in your database. Run DBCC CHECKDB ('YourDatabase') WITH NO_INFOMSGS to specify the details of the error. Or if you have backup of your database, you can perform [Table level restore from backup][1] and if you dont have any backup you can try SysTools SQL Database Repair Tool. [1]: http://www.sqlmvp.org/table-level-recovery-for-selected-tables/
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

SmithSean avatar image
SmithSean answered

In the case of database corruption, first, you should restore the database from the updated backup. If your backup is not updated then, you need to repair SQL database to get all the data. To repair corrupt SQL database, you need to find the exact reason for the corruption.

If it is clustered index then, you need to repair it. If it is related to non-clustered then, you can rebuild it.

Check this article: https://www.infosecurity-magazine.com/blogs/repairing-sql-database-corruption/

10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.