Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Retieveing data from a mdf without the ldf.
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Recouvrement
Divers
Thread ID:
00546560
Message ID:
00547207
Vues:
12
Here is the procedure I got from MS who were a big help. We purchased a support contract and it is great.

Steps to recover .mdf file with a corrupt .ldf file

Run the statements in Query analyzer and perform the other tasks in Enterprise manager and a command prompt/explorer.

1. Run the following statement once: sp_configure ‘allow updates’,1.
2. Run the following against master: sp_reconfigure with ‘override’.
3. Questioned database should be restored from backup if not already on server. Databases will show a loading or suspect attribute in the server tree window.
4. Detach corrupt files and rename to a safe name.
5. Create a new database, example ‘MDMars’, with size set to minimum default.
6. Stop SQL Server.
7. Rename the newly created database files to a safe name. Do not detach!
8. Rename the corrupt files ( .mdf, .ldf , and any .ndf’s) to the file names you just created in step #3.
9. Run a select statement against master database: select * from sysdatabases where name = ‘database name’. Status may reflect loading or other non-viable code.
10. Run the following: Update sysdatabases set status = 32768 where name = ‘database name’. This will set the status to emergency.
11. Stop and immediately restart SQL Server.
12. Rename log file or delete it with SQL running and do not detach.
13. Run the following: dbcc rebuild_log ( ‘database name’,’desired path and name of log file’). Example: dbcc rebuild_log ( ‘MDMars’,’f:\data\MdMars_Log.ldf’)
14. Optional: run dbcc checkdb(‘database name’).
15. Run the following: Update sysdatabases set status = 0 where name = ‘database name’. This will set the status to normal.
16. Optional: run sp_helpdb to check to database.

You should now be able to read the tables and retrieve your data.

Repeat step 3-16 as needed for file corruption.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform