SQL Server Performance Forum – Threads Archive
I Lost Log File
I Have Lost Log File How Can i restore my Database Rai AsadCould you care to expand on your question?
- Was the log file deleted? How?
- Do you have a backup of your database that you want to restore?
Moderator
SQL-Server-Performance.com
yes log file hase been deleted.
and i haven’t backup to restore.
i have only .mdf file left.
now what to do?
Try using sp_attch_db to attach the database. Atleast u’ll have some of the data. Gaurav
Moderator
Man thrives, oddly enough, only in the presence of a challenging environment- L. Ron Hubbard
When you start SQL server, It will try to create a new log file for the DB if it is ‘attached’ to the server. Nathan H.O.
Moderator
SQL-Server-Performance.com
Try with sp_attach_single_file_db for more info see books online. Thanks. Rushendra
Make sure that file .MDF has been detached properly, otherwise you may not be able to attach as specified. _________
Satya SKJ
Moderator
SQL-Server-Performance.Com
After I made the previuos post, I thought about this. Isn’t it that the database has to be detached using sp_detach_db so that it can be attached using sp_attch_db? Or is it the case that this .mdf file mentioned in the problem can be attched just like that? Gaurav
Moderator
Man thrives, oddly enough, only in the presence of a challenging environment- L. Ron Hubbard
I reckon the following process in the event of Tlog .LDF file deletion: To rebuild the transaction log, issue the following statement in Query Analyzer:
Keep the database in emergency mode by executing the following statement from Query Analyzer: USE MASTER
GO
Update sysdatabases set status = 32768 where name = ‘databasename’ Now, stop and restart the server from Enterprise Manager by right-clicking the name of the server and selecting Stop/Start. dbcc rebuild_log(‘databasename’, ‘path’
(specify path as per your installation) You can now set the database back to normal mode by issuing the following statement in Query Analyzer: Update sysdatabases set status = 0 where name = ‘databasename’
This update statement will return the result: 1 row(s) affected. When you receive this message, stop and restart the server again.
_________
Satya SKJ
Moderator
SQL-Server-Performance.Com
]]>