Hi,
The dev deleted some of the ldf files mistakenly and are unable to attach the mdf file.
How can i re-create the db with the existing mdf file and a new ldf file. Can someone suggest.
Thanks,
Arzanhttp://www.sqlservercentral.com/scripts/scriptdetails.asp?scriptid=599
Restoring a .mdf
--
Andrew J. Kelly SQL MVP
"Arzan" <Arzan@.discussions.microsoft.com> wrote in message
news:8A81A4E5-F699-4552-A0C0-8310527A7EA5@.microsoft.com...
> Hi,
> The dev deleted some of the ldf files mistakenly and are unable to attach
the mdf file.
> How can i re-create the db with the existing mdf file and a new ldf file.
Can someone suggest.
> Thanks,
> Arzan|||Hi,
Try using the procedure "sp_attach_single_file_db" to attach the database
with specifying the MDF file only.
EXEC sp_attach_single_file_db 'dbname', 'c:\mssql\data\dbname.mdf'
THis will create a new database with exiting mdf and new ldf file.
This command will fail in below scenarios:-
1. If the database is not detached using sp_detach_db
2. If you have multiple LDF files in your old database.
If your sp_attach_single_file_db command fails then probaly you have to
restore the database from good backup available.
Thanks
Hari
MCDBA
"Arzan" <Arzan@.discussions.microsoft.com> wrote in message
news:8A81A4E5-F699-4552-A0C0-8310527A7EA5@.microsoft.com...
> Hi,
> The dev deleted some of the ldf files mistakenly and are unable to attach
the mdf file.
> How can i re-create the db with the existing mdf file and a new ldf file.
Can someone suggest.
> Thanks,
> Arzan
Friday, February 17, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment