Showing posts with label laptop. Show all posts
Showing posts with label laptop. Show all posts

Monday, March 19, 2012

How to recover SQL database from a removed laptop hard drive?

Dear group:

I have removed my hard drive from my laptop (which is now toast) and
have managed to recover nearly all the data from it by installing the
drive into my desktop. I was hoping to reboot the dektop to see if I
could load the operating system on the laptop's hard drive so I could
do a manual backup of the SQL database on it. This does not work.

Does anyone know of a way to recover my SQL database and all its tables
given the circumstances above?

TIA
ISZNevermind... I found the answer. I was able to successfully use the
follwing transact...

EXEC sp_attach_db @.dbname = N'****',
@.filename1 = N'g:\Program Files\Microsoft SQL
Server\MSSQL$****\Data\****_DB_Data.MDF',
@.filename2 = N'g:\Program Files\Microsoft SQL
Server\MSSQL$****\Data\****_DB_Log.LDF'|||Nevermind... I found the answer. I was able to successfully use the
follwing transact...

EXEC sp_attach_db @.dbname = N'****',
@.filename1 = N'g:\Program Files\Microsoft SQL
Server\MSSQL$****\Data\****_DB_Data.MDF',
@.filename2 = N'g:\Program Files\Microsoft SQL
Server\MSSQL$****\Data\****_DB_Log.LDF'|||Nevermind... I found the answer. I was able to successfully use the
follwing transact...

EXEC sp_attach_db @.dbname = N'****',
@.filename1 = N'g:\Program Files\Microsoft SQL
Server\MSSQL$****\Data\****_DB_Data.MDF',
@.filename2 = N'g:\Program Files\Microsoft SQL
Server\MSSQL$****\Data\****_DB_Log.LDF'|||Restore from a backup. You do have backups of your laptop of course...?
:-)
--
David Portas
SQL Server MVP
--|||<q2face@.hotmail.com> wrote in message
news:1108162896.401884.268390@.l41g2000cwc.googlegr oups.com...
> Dear group:
> I have removed my hard drive from my laptop (which is now toast) and
> have managed to recover nearly all the data from it by installing the
> drive into my desktop. I was hoping to reboot the dektop to see if I
> could load the operating system on the laptop's hard drive so I could
> do a manual backup of the SQL database on it. This does not work.
> Does anyone know of a way to recover my SQL database and all its tables
> given the circumstances above?
> TIA
> ISZ

If you can recover the .mdf and .ldf files from the laptop hard drive, you
could try attaching the database with sp_attach_db (or
sp_attach_single_file_db if you only have the .mdf file). But this may not
work at all, and your best option is, as David said, to restore from a
backup of the database.

Simon