The file ‘F:\data\DB05_log.ldf’ cannot be overwritten. It is being used by database ‘test’.

First I took a backup of DB05
BACKUP DATABASE DB05 TO DISK='F:\backup\DB05_20190131.BAK'

Then I restored this DB05 as test

RESTORE DATABASE test from DISK='F:\backup\DB05_20190131.BAK'

My test DB is working fine. But when I am trying to Restore
the same backup as DB05, I faced an Error

Troubeshooted and found a Solution is to move datafile
(Rename datafile) while Restoring DB05.

RESTORE DATABASE db05 FROM DISK = 'F:\backup\DB05_20190131.BAK'
with file=1,
Move N'DB05' to N'F:\data\DB05\DB05.mdf',
Move N'DB05_log' to N'F:\data\DB05\DB05_log.ldf',

And it is completed without any issue.


About Sher khan

Senior Oracle DBA, Oracle 10g , Oracle 11g OCE ,Oracle 12C and Oracle 11g OPN certified Specialist, OCP Certified in Oracle 9i,10g , 11g and 12C. I am working in Oracle technology since 2004. Currently working in U.A.E Email:
This entry was posted in SQL Server. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.