Link to home
Start Free TrialLog in
Avatar of thcit
thcitFlag for United States of America

asked on

LOST LOG FILE! TRANSACTION LOG DELETED!

Please help everyone...

I deleted my transaction log file and do not have a backup.  I still have the mdf file for my database.  How do I get the DB back working again?


PANIC PANIC!
Avatar of EugeneZ
EugeneZ
Flag of United States of America image

but you can not delete any DB files if the DB is online.
Was it offline? or MSsqlserver service down?
Avatar of thcit

ASKER

Service was down.
I agree, try using attach, **BUT MAKE A COPY OF THE .MDF FIRST**, because attach makes changes to it, and if the attach fails you'll want to go back to a "fresh" copy for another recovery try.
Avatar of thcit

ASKER

The DB is in suspect mode right now is there anything I need to do before I try to attach the mdf?
Stop SQL Server;
Make a copy of the .MDF file;
Restart SQL Server.

Btw, be sure to attach using Query Analyzer *not* Enterprise Manager.
Avatar of thcit

ASKER

This is what I got.

Could not open new database 'asdm'. CREATE DATABASE is aborted.
Device activation error. The physical file name 'E:\Program Files\Microsoft SQL Server\data\MSSQL\data\ASDM_Log.LDF' may be incorrect.
Avatar of thcit

ASKER

I can get the DB to come up in Emergency Mode and I am able to read all tables, permissions, sp's, functions etc...  I happen to have a an older copy of the DB, is there anyway I can copy all of the objects from the Emergency DB to the older restored DB?
ASKER CERTIFIED SOLUTION
Avatar of EugeneZ
EugeneZ
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of thcit

ASKER

OK guys, luckily I figured this one out and got it to work.  Thanks for the great comments, although none of them seem to work in this scenario, thanks anyway.

Here is what I did for future reference.

>I allowed updates to the master DB and Set the flag for the suspect DB to Emergency Mode like EugeneZ displayed.
EXEC sp_configure 'allow updates', 1
RECONFIGURE WITH OVERRIDE
GO

BEGIN TRAN

UPDATE master..sysdatabases
SET status = status | 32768
WHERE name = 'MyDatabase'

>Then I performed a DTS Export of all data and objects of the suspect DB.
>I dettached the old DB in emergency mode.
>Then did a rename on the newly exported DB to the old DB's name.

NOTE***Only one thing to watch---Some of my Indexes were reset so I had to delete and recreate those indexes/constraint relationships.

Unless anyone objects I am granting points to EugeneZ for partial help in this solution. Although I figured a great deal out on my own I did use some of his code and one of his suggestions inspired an idea.  I am therefore granting him the points as a 'C'.  Not because of his lack of solution but because I believe he deserves some points rather than none at all.  I believe 1000 is adequate.  I am leaving this suggestion open for the next 4 days for any objections.

thcit



Avatar of thcit

ASKER

quick correction---I did not use the BEGIN TRAN for future researchers.
thcit:
What are you talking about - granting C,  you figured out your own,  he deserves, etc

Without my last post you would be in same situation without the database.
my 'partial help' <=> 90% of the result for your question

I see in your words big disrespect.


And good news for you thcit:
 I do not need your points- grant somebody else
 and keep your C for your self

One more thing keep in mind - EE experts help you for free in their free time
and if you plan to get help in future – be very nice and respectful


Avatar of thcit

ASKER

EugeneZ:

Sad to say that I had no idea that a C was such a big offense.  My appolgies.  After reconsidering the matter I am granting an A in effort to show appreciation of your time and quick response to the question.  Please accept and in future references I will be more cautious with my grades and more explanatory in my words.

thcit.
Accepted
Thanks