smjaleel
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
trying this now
ASKER
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.
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
Recovering from a deleted log file on SQL Server
http://www.spaceprogram.com/knowledge/sqlserver_recover_from_deleted_log.html
>> 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.
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\
(FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
FOR ATTACH_REBUILD_LOG ;
GO
The Log file is going to be built automatically once you execute the above query.
ASKER
perfect fix
ASKER