Monday, February 13, 2012

Attaching Database if log files missing

Hi.
Is it possible to attach a database if the log files have been lost?
I had a database with 1 .mdf file and 2 .ldf (or whatever is the extension
for the log file).
The oldest log fie has been lost (corrupted HD), so I wonder if it is possib
le to attach the database even if that file is missing (using the GU interfa
ce it seems impossible, but maybe there is a workaround).
Any suggestion?
Thank you,
MicheleHi,
Try to attach the database with a single mdf file using the below stored
procedure
sp_attach_single_file_db 'DBNAME', 'physical file name'
Thanks
Hari
MCDBA
"Michele" <anonymous@.discussions.microsoft.com> wrote in message
news:5A5320A4-57C5-4C47-9940-4D1D89D5FF25@.microsoft.com...
> Hi.
> Is it possible to attach a database if the log files have been lost?
> I had a database with 1 .mdf file and 2 .ldf (or whatever is the
extension for the log file).
> The oldest log fie has been lost (corrupted HD), so I wonder if it is
possible to attach the database even if that file is missing (using the GU
interface it seems impossible, but maybe there is a workaround).
> Any suggestion?
> Thank you,
> Michele|||I would be surprised if Hari's sp_attach_single_file_db suggestion works
here because of the multiple log files. Even with a single log file, an
attach may not work when the database was not cleanly detached.
Your best option is to restore from backup. If you have no backup and need
to salvage data, contact Microsoft PSS. There is some trickery you can use
to get the database online without the original log files but physical and
logical database integrity is questionable.
Hope this helps.
Dan Guzman
SQL Server MVP
"Michele" <anonymous@.discussions.microsoft.com> wrote in message
news:5A5320A4-57C5-4C47-9940-4D1D89D5FF25@.microsoft.com...
> Hi.
> Is it possible to attach a database if the log files have been lost?
> I had a database with 1 .mdf file and 2 .ldf (or whatever is the
extension for the log file).
> The oldest log fie has been lost (corrupted HD), so I wonder if it is
possible to attach the database even if that file is missing (using the GU
interface it seems impossible, but maybe there is a workaround).
> Any suggestion?
> Thank you,
> Michele|||Hi Dan,
Thanks for pointing it out. In this case of multiple Log files Michele need
to either contact MS PSS or restore from latest backup.
Thanks
Hari
"Dan Guzman" <danguzman@.nospam-earthlink.net> wrote in message
news:egMrizw8DHA.2812@.TK2MSFTNGP11.phx.gbl...
> I would be surprised if Hari's sp_attach_single_file_db suggestion works
> here because of the multiple log files. Even with a single log file, an
> attach may not work when the database was not cleanly detached.
> Your best option is to restore from backup. If you have no backup and
need
> to salvage data, contact Microsoft PSS. There is some trickery you can
use
> to get the database online without the original log files but physical and
> logical database integrity is questionable.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Michele" <anonymous@.discussions.microsoft.com> wrote in message
> news:5A5320A4-57C5-4C47-9940-4D1D89D5FF25@.microsoft.com...
> extension for the log file).
> possible to attach the database even if that file is missing (using the GU
> interface it seems impossible, but maybe there is a workaround).
>|||Hi,
thanks to you both.
Unfortunately I do not have any backup, that's why I needed a way to reattac
h the database using the "raw" files.
I will try to contact MS PSS as you suggested.
Thanks,
Michele

No comments:

Post a Comment