Recovering a corrupt SQL Server databasefile

c86crjj0  于 2023-08-02  发布在  SQL Server
关注(0)|答案(1)|浏览(72)

I have a SQL Server database which is corrupt. It doesn't have any backup and I don't think any checkpoint was set. A few hard disk sectors sectors went bad and the .MDF file (~45MB) is not usable. However, I have the full transaction log file ( .LDF ~125MB).

How do I rebuild the database using the corrupted .MDF and the full .LDF ? Note that I am able to view the database records using the demo versions of SQL Server recovery software.

t1qtbnec

t1qtbnec1#

(Hoping that this doesn't run foul of the no link-only answers policy but I don't how it's possible to include the gist of this here otherwise)

In the spirit of "Teach a man to fish..." note that Paul Randal of SQLSkills.com has numerous blog postings and articles on this very topic.

https://www.sqlskills.com/sql-server-resources/sql-server-demos/

I've attended a number of conferences and user group meetings where he has demoed this very problem and how to solve it (often using hex editors as part of the repair process).

The last one I saw was at SQLSaturday in Dublin this year (2017) and the demo scripts for session are on that page. Sadly the video of the session doesn't appear to be on the SQL Saturday page for the session but in general the T-SQL scripts are easy enough to follow.

相关问题