Hi @Cory Riddell,
What about creating a batch file containing only the command starting SQL Server Express and schedule a task via Task Scheduler.
Regards,
Zoe Hui
If the answer is helpful, please click "Accept Answer" and upvote it.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have an application that uses LocalDB. The named instance "PrivDb" is owned by whatever account installed the application. Part of the setup process is to grant "NT AUTHORITY\Authenticated Users" the sysadmin role so that any authenticated user can connect and the instance is shared as "SharedDb".
When another user on the machine tries to connect to the shared instance, it fails with this error:
If I manually start the instance as the user who installed it, other users on the machine can connect to the instance.
I'm running SQL Server Express 2022 with cumulative update 15 installed.
Is there something else that I have to configure so that the shared instance will automatically start when other users connect to it?
My problem seems identical to this one:
https://support.microsoft.com/en-us/topic/kb5003342-fix-sql-server-express-localdb-can-t-start-or-connect-to-shared-instances-of-sql-server-express-localdb-2019-or-2017-29147198-d431-47a4-80f0-ece917f28859
except I'm on the 2022 release.
Hi @Cory Riddell,
What about creating a batch file containing only the command starting SQL Server Express and schedule a task via Task Scheduler.
Regards,
Zoe Hui
If the answer is helpful, please click "Accept Answer" and upvote it.
The server name "(LocalDB).\ShareDB" is wrong, exactly the addition slash+dot, remove "." =>
"(LocalDB)\ShareDB"
I ended up writing a simple service to start the LocalDB instance. It creates a named pipe that clients can send a message over to start the instance.
Unfortunately it doesn't work when running as SYSTEM. I'm calling LocalDBStartInstance and it returns S_OK, however the instance isn't actually started.
If I modify the service to run as the user who owns the database, it works. This isn't a viable workaround though because it's too fragile. For example, if AD is configured to force users to change their password, the service will break because the stored password is now stale.
When I use Process Monitor I can see my service starting SQLLocalDB and I can see it find the shared instance in the registry, find the owner and name of the instance, then it basically ends.
Either I totally misunderstand shared instances and they are not intended to automatically start for other users on the machine, or it's a bug similar to the on in KB5003342. Is there any way to contact the developers who worked on that KB fix?