August 7, 2009 at 9:40 am
hi guys,
one of our database 's log file is very big,then i attach the database,and delete log file,
now i only have mdf and ndf file,when i want to attach it, it show error.
it is in SQL 2008 system.
August 7, 2009 at 9:59 am
What error?
If it's complaining about the DB not been shut down cleanly then you should restore your latest backup.
If you don't have a backup (and why not), have a look at this blog post.
http://sqlinthewild.co.za/index.php/2009/06/09/deleting-the-transaction-log/
Going forward, ensure that your log backups are running properly and don't ever delete a transaction log.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
August 7, 2009 at 3:48 pm
:w00t:
Never!, never!, delete a Log File!
http://www.sqlservercentral.com/articles/Disaster+Recovery/63311/
August 8, 2009 at 4:46 pm
totally agree, NEVER delete a LDF file.
But in your case i would try the following statement:
CREATE DATABASE [dbname] ON
(NAME = Name, FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\db.mdf')
FOR ATTACH_REBUILD_LOG;
/mSc
August 9, 2009 at 2:00 am
msc (8/8/2009)
CREATE DATABASE [dbname] ON(NAME = Name, FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\db.mdf')
FOR ATTACH_REBUILD_LOG;
That only works if the database has been shut down cleanly. If it has not, any attempt to attach throws an error.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply