Search This Blog

Saturday, February 9, 2008

Restoring System databases when LDF files have gone for a toss ..

Problem -

--Due to some Hardware problem SAN drive having LDF files for all of the system database lost.

--Now you have recreated a new drive with same drive letter but contents are not there.

--You have database backup for all the system databases and other user databases.

--You have MDF file for system database as well.

Solution :

1) first use rebuildm utility .If that fails then ,
2) Restore all SYSTEM databases on a test instance of SQL with “new” as prefix.( remember you have backups :D )

--Detach those databases from the test instance.

--On original instance of SQL rename all the previous system MDF files with “old” as prefix.

--Copied all the MDF & LDF files from test instance to this actual instance folder and rename data file named to actual one (like master.mdf, model.mdf, msdbdata.mdf).and log files as well .

--Gave proper permissions to all of the newly copied files if needed .

--Start SQL server and it starts successfully.

--Attach all user database and everything will work fine.

Hope it helps :)

No comments: