# Error Restoring: Logical File Name Already In Use (slightly different behaviour)

**URL:** <https://forum.sambapos.com/t/error-restoring-logical-file-name-already-in-use-slightly-different-behaviour/8721>\
**Category:** V5 Question\
**Created:** [December 27, 2015, 3:46am UTC](https://forum.sambapos.com/t/error-restoring-logical-file-name-already-in-use-slightly-different-behaviour/8721 "2015-12-27T03:46:25Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![markjw](https://forum.sambapos.com/user_avatar/forum.sambapos.com/markjw/32/9942_2.png) [@markjw](https://forum.sambapos.com/u/markjw)\
**Post date:** [December 27, 2015, 3:46am UTC](https://forum.sambapos.com/t/error-restoring-logical-file-name-already-in-use-slightly-different-behaviour/8721/1 "2015-12-27T03:46:25Z")

</div>

Continuing the discussion from [Error Restoring: Logical File Name Already In Use](http://forum.sambapos.com/t/error-restoring-logical-file-name-already-in-use/4591/2):

> [@Error Restoring: Logical File Name Already In Use](https://forum.sambapos.com/t/error-restoring-logical-file-name-already-in-use/4591/2):
>
> Try enabling `Allow overwrite...` setting. Don’t forget to backup current state if you may want to roll back to current.
> 
> Also please update to latest version if you didn’t do so…

I got same problem today in 5.1.56, using LocalDB. I already have the `Allow overwrite...` setting enabled. After the error, the database appears to still restore successfully, but there is no auto logout and prompt to login again.

Concerned though that it might not have restored everything properly?

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [December 27, 2015, 3:13pm UTC](https://forum.sambapos.com/t/error-restoring-logical-file-name-already-in-use-slightly-different-behaviour/8721/2 "2015-12-27T15:13:37Z")

</div>

If it said “already in use” restore not completed.

Drop that database (the one that have the same name) and restore again.

---

<div class="post-metadata">

**Author:** ![markjw](https://forum.sambapos.com/user_avatar/forum.sambapos.com/markjw/32/9942_2.png) [@markjw](https://forum.sambapos.com/u/markjw)\
**Post date:** [December 27, 2015, 10:39pm UTC](https://forum.sambapos.com/t/error-restoring-logical-file-name-already-in-use-slightly-different-behaviour/8721/3 "2015-12-27T22:39:33Z")

</div>

How is the best way to do that for LocalDB? Since I am using 2 systems (client’s POS and my laptop), databases are named same. When I restore to another machine (my PC in office), I don’t get this error coming up and is same SambaPOS 5 configuration.

In LocalDB, as I am using default instance and also the default SambaPOS5 database name, if I drop it using management studio, then SambaPOS won’t open, or it will recreate a sample DB on startup.

So is the only option to restore using management studio in this case? I prefer to just use database backup feature as it’s much faster 😉

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [December 27, 2015, 11:06pm UTC](https://forum.sambapos.com/t/error-restoring-logical-file-name-already-in-use-slightly-different-behaviour/8721/4 "2015-12-27T23:06:30Z")

</div>

So it says database in use. I don’t know why database is in use but it makes sense to stop restoration in this case. If it is an issue caused by SambaPOS and if it can be reproducible I’ll be glad to fix that.

> [@markjw](#):
>
> In LocalDB, as I am using default instance and also the default SambaPOS5 database name, if I drop it using management studio, then SambaPOS won’t open, or it will recreate a sample DB on startup.

I expect it to regenerate sample db…

---

<div class="post-metadata">

**Author:** ![markjw](https://forum.sambapos.com/user_avatar/forum.sambapos.com/markjw/32/9942_2.png) [@markjw](https://forum.sambapos.com/u/markjw)\
**Post date:** [December 27, 2015, 11:12pm UTC](https://forum.sambapos.com/t/error-restoring-logical-file-name-already-in-use-slightly-different-behaviour/8721/5 "2015-12-27T23:12:00Z")

</div>

I think it might be an issue on my laptop, as it’s running quite slow these days, possibly it hasn’t closed connection to database fast enough before it tries to overwrite it.

I’ll just try deleting database, let it create sample db then restore to that. If failing that, I’ll just do it on management studio. I’m not using this laptop every day anyway so it’s not a huge concern for me.

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [December 27, 2015, 11:16pm UTC](https://forum.sambapos.com/t/error-restoring-logical-file-name-already-in-use-slightly-different-behaviour/8721/6 "2015-12-27T23:16:00Z")

</div>

Seeing whole error message might give a better idea…

From your topic title I guess… LocalDB directly creates mdf files under c:\Users[user name]\ folder. If you try to restore a database and if there is another database with that name… that may create an issue.

---

<div class="post-metadata">

**Author:** ![markjw](https://forum.sambapos.com/user_avatar/forum.sambapos.com/markjw/32/9942_2.png) [@markjw](https://forum.sambapos.com/u/markjw)\
**Post date:** [December 27, 2015, 11:19pm UTC](https://forum.sambapos.com/t/error-restoring-logical-file-name-already-in-use-slightly-different-behaviour/8721/7 "2015-12-27T23:19:39Z")

</div>

Error message was identical to the one in the linked topic (that was for V4) so I didn’t mention it again. It was just a one line windows dialog.

Yeah anyway I think it isn’t any issue with SambaPOS, if I experience it on other systems I’ll let you know.

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [December 27, 2015, 11:21pm UTC](https://forum.sambapos.com/t/error-restoring-logical-file-name-already-in-use-slightly-different-behaviour/8721/8 "2015-12-27T23:21:08Z")

</div>

> [@markjw](#):
>
> if I experience it on other systems I’ll let you know.

OK. When it happens also check your C:\Users[User Name] folder and let me know mdf files located there.

---

<div class="post-metadata">

**Author:** ![markjw](https://forum.sambapos.com/user_avatar/forum.sambapos.com/markjw/32/9942_2.png) [@markjw](https://forum.sambapos.com/u/markjw)\
**Post date:** [December 27, 2015, 11:24pm UTC](https://forum.sambapos.com/t/error-restoring-logical-file-name-already-in-use-slightly-different-behaviour/8721/9 "2015-12-27T23:24:55Z")

</div>

> [@emre](#):
>
> let me know mdf files located there.

I know in c:\Users[user name]\ folder the filenames will be same as those from the one I am restoring from, just default names of SambaPOS5.mdf and SambaPOS5\_log.ldf. Because I had the option ticked to allow overwrite it usually works. Actually I should be naming them differently but I only recently started using LocalDB on single terminal setups, before was using CE for that, or SQL Express. Just being lazy not to change the connection string 😛

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [December 27, 2015, 11:33pm UTC](https://forum.sambapos.com/t/error-restoring-logical-file-name-already-in-use-slightly-different-behaviour/8721/10 "2015-12-27T23:33:27Z")

</div>

> [@markjw](#):
>
> Actually I should be naming them differently

It should work without renaming but as it says “already in use” there is something unexpected there. It shouldn’t say it for actually used database as we handle it during restoration. This is what I mean…

Assume you have both SambaPOS5 and SambaPOS4 mdf files in that folder. You received SambaPOS4.bak and want to restore it to SambaPOS5 and enabled overwrite… However as you also have SambaPOS4.mdf as a separate database, restoration should break as it should overwrite SambaPOS4 (not actually used one) database. We shouldn’t change SambaPOS4 database while you try to restore it on SambaPOS5.

---

<div class="post-metadata">

**Author:** ![markjw](https://forum.sambapos.com/user_avatar/forum.sambapos.com/markjw/32/9942_2.png) [@markjw](https://forum.sambapos.com/u/markjw)\
**Post date:** [December 27, 2015, 11:42pm UTC](https://forum.sambapos.com/t/error-restoring-logical-file-name-already-in-use-slightly-different-behaviour/8721/11 "2015-12-27T23:42:09Z")

</div>

> [@emre](#):
>
> Assume you have both SambaPOS5 and SambaPOS4 mdf files in that folder.

No I am not upgrading. I am just using SambaPOS5. I was restoring a backup database from client’s POS terminal to my laptop, but both would be using SambaPOS5.mdf. Like you say it’s unexpected so I don’t think we need to worry about it right now.

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [December 27, 2015, 11:46pm UTC](https://forum.sambapos.com/t/error-restoring-logical-file-name-already-in-use-slightly-different-behaviour/8721/12 "2015-12-27T23:46:06Z")

</div>

Haha I know you’re not upgrading just wanted to give an example we’re familiar with. At least if it is the case I know you’ll quickly remember this 😉

---

<div class="post-metadata">

**Author:** ![markjw](https://forum.sambapos.com/user_avatar/forum.sambapos.com/markjw/32/9942_2.png) [@markjw](https://forum.sambapos.com/u/markjw)\
**Post date:** [December 28, 2015, 7:38am UTC](https://forum.sambapos.com/t/error-restoring-logical-file-name-already-in-use-slightly-different-behaviour/8721/13 "2015-12-28T07:38:30Z")

</div>

Actually I turned off this feature:

 ![](https://forum.sambapos.com/uploads/default/original/3X/9/9/99d6c731c0d7d90c364e8c8f03c3d5a41d1922fa.png)

Then it restored successfully. Bit unexpected.

Both current database and database in backup was using same filename of SambaPOS5.mdf.

---

<div class="post-metadata">

**Author:** ![devloic](https://forum.sambapos.com/user_avatar/forum.sambapos.com/devloic/32/10735_2.png) [@devloic](https://forum.sambapos.com/u/devloic)\
**Post date:** [November 19, 2020, 4:15am UTC](https://forum.sambapos.com/t/error-restoring-logical-file-name-already-in-use-slightly-different-behaviour/8721/14 "2020-11-19T04:15:23Z")

</div>

unchecking this setting worked for me too on 5.1.57.
