Wednesday, March 21, 2012

Restore database from a backup and specify a new log file name

Hi All,
I am trying to restore a database from a bak file and looking out for a way
if we can provide a new log file name while trying to restore. (I dont have
enought space on drive to accomodate the .ldf file existing in the bak file).
Thanks in advance..
Manoj
You can use the move option. Check BOL for restore database for more
details.
Adi
On Feb 5, 9:55 pm, xyz <x...@.discussions.microsoft.com> wrote:
> Hi All,
> I am trying to restore a database from a bak file and looking out for a way
> if we can provide a new log file name while trying to restore. (I dont have
> enought space on drive to accomodate the .ldf file existing in the bak file).
> Thanks in advance..
> Manoj
|||Hello,
We can give new path and new file name along with RESTORE DATABASE command.
RESTORE DATABASE <dbname> FROM Disk='D:\backup\dbname.bak'
With Move 'logical_mdf_name' to 'D:\mssql\dbname.mdf',
Move 'Logical_ldf_name' to 'K:\mssql\dbname_log.ldf', stats=5
Phisical file name and path can be chnaged based on your requirement.
Thanks
Hari
"xyz" <xyz@.discussions.microsoft.com> wrote in message
news:8CB7CFD5-1462-4E01-90EA-3FAC07A43302@.microsoft.com...
> Hi All,
> I am trying to restore a database from a bak file and looking out for a
> way
> if we can provide a new log file name while trying to restore. (I dont
> have
> enought space on drive to accomodate the .ldf file existing in the bak
> file).
> Thanks in advance..
> Manoj

No comments:

Post a Comment