468,133 Members | 1,149 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,133 developers. It's quick & easy.

Unable to attach the database

I had to detach the database to delete the transaction log as it took
the hole disk space.

No I am trying to attach database, however I am not able to do so.

The engine is asking me whether I want to continue and create new log
file. I agree to it, however then I am receiving an error:

Error 1813: Could not open new database 'db_name'. CREATE DATABASE
aborted. Device activation error. The physical file name 'E:\SQL
Databases\MSSQL\Data\db_name.ldf' may be incorrect.

Then after I have message than attaching database failed.

In event viewer I have:

17204 :
FCB::Open failed: Could not open device E:\SQL Databases\MSSQL\Data
\db_name.MDF for virtual device number (VDN) 0.

In the error log I have:
2008-01-23 10:28:59.00 spid52 Starting up database 'db_name'.

Do you have any ideas where the problem is?

I have never had this problem before, only now. And I didn't have this
problem with other databases for which I have deleted the log file.
Jan 23 '08 #1
1 5438
(gr************@googlemail.com) writes:
I had to detach the database to delete the transaction log as it took
the hole disk space.
No, you did not have to. The correct action would have been to
backup the transaction and then shrink the log file. Or simply
switch to simple recovery.

BUT NEVER DELETE A LOG FILE! NEVER!
No I am trying to attach database, however I am not able to do so.
Of course not. You deleted half of the database.

If you have a clean backup of the database, restore the backup.

If you don't have a backup of the database, you are in trouble. There
are possibilities to create a new log file, so that you can access
the database, but the database is likely to be in bad shape, with
corruption in internal structures as well as inconsistencies in
application data.

If this is a database that you cannot afford to lose, I recommend that
you open a case with Microsoft. The methods to access the orphan MDF
depends on the SQL Server version. In any case, the methods requires
good understanding of SQL Server and how to work from this situation.
Which, to be honest, I don't trust someone who deletes his log file to be.
Whence, I recommend you to open a case with Microsoft, so that you have
a support person who ca guide you through the process.

Also, for the future, you need to learn some basics about how the log
file work. Either you go for simple recovery, or you back up your log
file regularly. The reduces the likelyhood for a log file swamping the
disk to a minimum.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jan 23 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Serdar Kalaycý | last post: by
2 posts views Thread by phil | last post: by
1 post views Thread by SenthilVel | last post: by
1 post views Thread by gcdp | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.