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?
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
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.
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.
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.
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
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.
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.
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