Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I recover my database from ldf and mdf files only?

Status
Not open for further replies.

hanchilicious

Programmer
May 23, 2002
156
GB
Hi,

I'm in a real panic here.

I was running some procedures on my server, none of which were completing. So, after killing off some heavy processes on the server, and doing some general housekeeping, I rebooted the server. The procedures would still not complete, when before now, they would run in a matter of minutes. SQL Server seemed to be running at a turtles pace. Then I realised that there was hardly any space on the c:\.

So, I went into the directory where a large backup of the database is produced and removed it for now, to free up some space on the local drive.

But then, when I went to SQL Enterprise Manager and clicked on Databases, or Query Analyzer and attempt to switch or otherwise call on databases on the server, they just indefinitely hang there. Now, I'm concerned that in my haste, I have deleted the databases .DAT file as well as the .BAK file, as now I cannot find it.

This is the reason why the list of databases to the server is no longer available, isn't it? The file was too big to fit in the recycle tray, and the backup is a few days out of date due to a move last week, so I can't use it.

Am I able to rebuild the database using only the ldf and mdf files? If so, how?

Please help if you can. I'm at my wits end!

Thank you very much.
<H>
 
A database consists of a mdf file (data) and ldf (log) file. If you have removed a .dat or .bak file you have NOT removed your database. When you open EM what is the state of your database? If you have a problem your db will be in suspect mode. If your server is out of disk space it will could cause the server to hang. In fact it will cause all kinds of problems. Clear up some room on you disks. Don't delete anything just move it off to another server.
After clearing everything up restart the SQL services.


- Paul [batman]
- If at first you don't succeed, find out if the loser gets anything.
 
Number one thing to check. Are the SQL Server services started? Check for MSSQLServer and SQLServerAgent services. The first one MUST be started and the second one SHOULD be started.

-SQLBill

Posting advice: FAQ481-4875
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top