Remote Tech Support

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Saturday, 31 July 2010

Corrupted MDF Solution

Posted on 10:46 by Unknown
Corrupted MDF solution

Procedure for recover MDF files when the LDF files are not available or corrupted. Detaching and Attaching are not possible normally.


  • Copy the original mdf file to a secure place.
  • Create a new database with the same name and same .mdf & .ldf file names.
  • Stop the SQL Server.
  • Replace the Corrupted .mdf with newly created .mdf file and Delete the .ldf file of the Database.
  • Restart the SQL Server.
  • See in Enterprise Manager the Database is in Suspect Condition.
  • Update the sysdatabases to update to Emergency mode. This will not use LOG files in start up
Run the query in Query Analyser using Master Database.

Sp_configure "allow updates", 1
GO
Reconfigure with override
GO
Update sysdatabases set status = 32768 
where name = ‘BadDbName’
GO
Sp_configure "allow updates", 0
GO
Reconfigure with override

GO
  • Stop & Restart SQL server. Now the database will be in emergency mode, Check in Enterprise Manager.
  • Now execute the undocumented DBCC to create a log file.
DBCC REBUILD_LOG(BadDbname,'c:\BadDbname.ldf') 
-- Undocumented step to create a new log file.
(Replace the BadDbname and log file name based on your requirement)
  • Execute :
sp_resetstatus <BadDbname>
  • Restart SQL Server. See in Enterprise Manager the Data base is in online. If there is any situation like <DBO Only> Just Detach and attach the mdf in normal process.
  • The Currupted Database Mdf file is now repaired and You can browse through the tables. Check for any missing records.

Try it when You are in trouble to attach a mdf file seeing the error message like 

< Server: Msg 5173, Level 16, State 1, Line 1
Cannot associate files with different databases.
Server: Msg 1813, Level 16, State 1, Line 1
Could not open new database 'dbABC'. CREATE DATABASE is aborted.
Log file 'D:\Microsoft SQL Server\MSSQL\Data\dbABC_log.LDF' does not match the primary file. 
It may be from a different database or the log may have been rebuilt previously.>
Email ThisBlogThis!Share to XShare to Facebook
Posted in Recovery Tips | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Windows Server 2008 Core Command Guide
    Windows Server 2008 Core Command Guide What Command Set DNS IP Netsh int ipv4 set dns “local area connection” stat...
  • USB Disk Security 5.4.0.12
    USB Disk Security -  Download 100% protection against any threats via USB storage USB Disk Security is a top-rated antivirus utility that pr...
  • GDS COMMITTEE IMPLEMENTATION ORDERS RELEASED BY DIRECTORATE TODAY
    GDS COMMITTEE IMPLEMENTATION ORDERS RELEASED BY DIRECTORATE TODAY POSTAL DIRECTORATE ISSUED ORDERS TODAY FOR IMPLEMENTING THE GDS COMMITTEE ...
  • (no title)
    POSTAL RATES INDEX Letters / Book Post Registered Articl...
  • Most Useful Websites
           The list primarily highlights the lesser-known or undiscovered websites and misses out all-time favorites like Google Docs, Wikipedia...
  • Commands in Windows Vista
    Windows Vista Command Line List and Reference The list of commands available in the command line shell for Windows Vista is similar to that ...
  • Save queries in Windows Server 2003's Active Directory Users and Computers tool
    Windows Server 2003 administrators can’t live without the Active Directory Users and Computers tool. Here’s a quick look at the saved querie...
  • PDF into Word ( Document) converter
    PDF into Word ( Document) Converter         PDF2Word(pdf to word) software enable export the text, images and other contents from pdf docume...
  • THIRUKKURAL PDF DOWNLOAD (தமிழ் )
    CLICK HERE TO DOWNLOAD THIRUKKURAL (தமிழ்)    or CLICK HERE TO DOWNLOAD THIRUKKURAL (TAMIL & ENGLISH)    or CLICK HERE TO DOWNLOAD THIR...
  • How to shutdown computer automatically at a specific time
    Trick 1: Start > Run Type ' shutdown -s -t 1800 ' without quotes Click OK A dialog will appear showing the countdown t...

Categories

  • Computer Guidelines
  • Customer Care
  • DB Tools
  • Drivers
  • Entertainments
  • FAQ
  • For System Administrators
  • FTP
  • General Informations
  • General Knowledge
  • Guidelines
  • Hardwares
  • Health Tips
  • Internet Tips
  • Latest Software Updates
  • Network Trouble shooting
  • Printer Trouble shooting
  • Printing Tips
  • Recovery Tips
  • Registry Tips
  • Registry Tools
  • Security Guidelines
  • Security Tips
  • Software Tips
  • Softwares
  • SQL
  • Technology
  • Tips and Tricks
  • Tools
  • Trouble shooting
  • Useful Softwares
  • Utilities
  • Virus Solutions
  • Websites
  • windows 7
  • Windows Server
  • Windows Tips
  • Windows Vista
  • Windows XP FAQ

Blog Archive

  • ►  2011 (138)
    • ►  May (32)
    • ►  April (24)
    • ►  March (29)
    • ►  February (15)
    • ►  January (38)
  • ▼  2010 (241)
    • ►  December (55)
    • ►  November (40)
    • ►  October (21)
    • ►  September (35)
    • ►  August (39)
    • ▼  July (23)
      • Configuration of Broadband and leased line in Switch
      • Corrupted MDF Solution
      • SOP for Address Proof ID Card in TN.doc
      • Ho to Instal Hindi Font (Mangal Font) in all Compu...
      • Complete list of IE (Internet Explorer) Keyboard S...
      • System Errors in Networking Meaning & Solutions
      • Hardware Troubleshooting Tips
      • Windows XP - Frequently Asked Questions and Solutions
      • Windows Vista Frequently Asked Questions and Solut...
      • All of u know that Our India had New Rupee Symbol.
      • Improve your Windows server's performance: 10 tips
      • Dear frustrated SAs,
      • Proposed indefinite strike from 13.07.2010 deferred
      • Information on batch files
      • Windows - Useful Tips
      • Problems & Solutions In Windows XP
      • PC Troubleshooting Guide
      • General security Measures
      • System Administration Tips
      • Basic Security Tips
      • common security issues for non-technical computer ...
      • Today New MM 6.6 Service Pack 4 is released & avai...
      • KIND ATTENION SYSTEM ADMINISTRATORS
    • ►  June (5)
    • ►  May (2)
    • ►  April (12)
    • ►  March (4)
    • ►  February (2)
    • ►  January (3)
  • ►  2009 (26)
    • ►  December (5)
    • ►  November (3)
    • ►  October (4)
    • ►  September (5)
    • ►  August (3)
    • ►  July (5)
    • ►  June (1)
Powered by Blogger.

About Me

Unknown
View my complete profile