SQL Server Database Recovery from Raw Data Files

Microsoft SQL Server Database Recovery from Raw Data Files (.mdf & .ldf files):

Useful when the following situations,

1. Your Operating System (Windows) corrupted without recent database backup.
2. SQL Server Service Stopped Working and don’t have a recent backup.
3. Due to accidental system restart, the SQL Server Stopped Working.

I searched the internet and google nearly 2 hours to find a folution, but all are useless in above situation (second one is mine). So tried myself and found a solution in just 10 minutes.

Requirements:

1. Atleast one database backup (not required to be recent), if you don’t have the backup you should create a fresh new database with the same database structure.
2. SQL Server Raw Datafiles and Log Files (.mdf and .ldf files). Copy the files to a new location. It will required later to recover the database.

Here is the steps to recover your database in last stat without any data loss.

1. Uninstall SQL Server and Install again as new.
2. Open SQL Server Management Studio.
3. Restore your old backup database or create a new database with same database name and same database structure (if it’s different structure you can’t recover the database).
4. Close SQL Server Management Studio.
5. Open Windows Service Manager (Start–>>Control Panel–>>Administrative Tools–>>Services)
6. Stop SQL Server service.
7. Now Copy your old backuped Raw Data Files (that’s .mdf and .ldf files) to the current Data folder of SQL Server. It will ask to overwrite, just do overright.
8. Now start the SQL Server service.
9. Now Open SQL Server Management Studio, now you can see your database without any data loss.
10. That’s All & Happy Coding……

I welcome your comments…I am thinking to post more tips like this one…

If you have any type problem in the following technologies, feel free to write me, i will try my best to help….

Software Programming – Tips & Tricks. I will post tips and tricks of Programing. Technology will includes VB, Java, .NET, Windows Programming, ASP, ASP.NET, PHP, SQL Server, My SQL and Web.

© Senthil Kumar D.
| Technology, Gadgets, Tablets, Laptops, Software, Internet, Entertainment, Sports, Movies, World and All |