• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 190
  • Last Modified:

How would you bring back a SQL2005 database if the transaction log was deleted?

Question: if you detached your database, stopped your SQL service, and deleted the transaction log file in SQL 2005, how would you be able to recover - or even bring the database back online?
0
wendelina
Asked:
wendelina
  • 2
1 Solution
 
SQL_SERVER_DBACommented:
did you backup the database before you detached it?
0
 
ptjcbCommented:
Have you tried sp_attach_single_file_db
0
 
ptjcbCommented:
Example (from BOL)
USE master;
GO
EXEC sp_detach_db @dbname = 'AdventureWorks';
EXEC sp_attach_single_file_db @dbname = 'AdventureWorks',
    @physname = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_Data.mdf';

Can only be used with database with a single data file.
0
 
wendelinaAuthor Commented:
Create Database AdventureWorks
(Name=Adventureworks, file='C:\Program Files\Microsoft SQL Server\MSSQL.1\Data\AdventureWorks_Log.ndf
FOR ATTACH_REBUILD_LOG
is another one we are going over.
thank you ptjcb.
~W.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now