Monday, March 26, 2012

Recovery from crash

Greetings,

I had a hard-drive failure this week and lost my root drive, with
operating system and SQL Server 2000.

Fortunately my data was on another volume and still exists.

I know about sp_attach_db, but looking at BOL, it says that sp_attach_db
only works with databases that were previously detached with
sp_detach_db.

How do I reattach my existing mdf and ldf files?

-- Rick

P.S. I know that the dbs are not corrupt because when the hard drive
failed SQL Server was offline.Guinness Mann (GMann@.dublin.com) writes:
> I had a hard-drive failure this week and lost my root drive, with
> operating system and SQL Server 2000.
> Fortunately my data was on another volume and still exists.
> I know about sp_attach_db, but looking at BOL, it says that sp_attach_db
> only works with databases that were previously detached with
> sp_detach_db.
> How do I reattach my existing mdf and ldf files?
> P.S. I know that the dbs are not corrupt because when the hard drive
> failed SQL Server was offline.

I would first try with sp_attach_db. If SQL Server was shut down cleanly,
I would expect the database files to be available.

If that fails, I would try sp_attach_single_file_db.

If that fails, there is an undocumented and unsupported method, that
I am not telling about in a newsgroup, because that methods is just
simply far too dangerous. I have no problem sharing it by mail. But
please try sp_detach_db first.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||In article <Xns93F5E2EFD74Yazorman@.127.0.0.1>, sommar@.algonet.se says...
> > I know about sp_attach_db, but looking at BOL, it says that sp_attach_db
> > only works with databases that were previously detached with
> > sp_detach_db.
> I would first try with sp_attach_db. If SQL Server was shut down cleanly,
> I would expect the database files to be available.

sp_attach_db worked great, Erland. Thank you.

-- Rick

No comments:

Post a Comment