Link to home
Start Free TrialLog in
Avatar of smjaleel
smjaleelFlag for Trinidad and Tobago

asked on

SQL lost ldf files

Here is the problem.
SQL server freaked out. all the ldf files on a drive disappeared.

I have the mdf and ndf files for the db. How can i recreate the log file or get my database back up and running.

Yes i usually have backups. we moved to a new server a few days ago. The maintenance plans were not setup here so we dont have anything to fall back on.

Running sql server 2008 enterprise

All suggestions welcome.
Avatar of smjaleel
smjaleel
Flag of Trinidad and Tobago image

ASKER

no one from sql in tonight ?
ASKER CERTIFIED SOLUTION
Avatar of ProjectChampion
ProjectChampion
Flag of United Kingdom of Great Britain and Northern Ireland 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
trying this now
i did the first part created the db and now waiting for it to go into suspect mode... but nothing... should i just proceed to set it to emergency and run the  dbcc
If the db has come up and is ready just run the dbcc check db (without repair) to see if there are any problems at all. If it comes back with error messages the follow up with repair option as per my previous post. If on the other hand dbcc returns with no errors start enjoying your recovered DB.
Avatar of Anthony Perkins
This is an old article (for SQL Server 2000) it may help:
Recovering from a deleted log file on SQL Server
http://www.spaceprogram.com/knowledge/sqlserver_recover_from_deleted_log.html
Avatar of geek_vj
geek_vj

>> I have the mdf and ndf files for the db. How can i recreate the log file or get my database back up and running.

You can use Create database with Attach_rebuild_log option. Here is the sample syntax for the same:

CREATE DATABASE EE
      ON (FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\EE.mdf'),
      (FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\EE_dev.ndf')
      FOR ATTACH_REBUILD_LOG ;
GO

The Log file is going to be built automatically once you execute the above query.
perfect fix