我正在尝试在我的 Windows 7 x64 计算机上设置 SQL Server 2012 LocalDB (RTM, x64) 共享实例,但似乎无法连接到共享实例。我为所有设置使用管理员命令提示符。这是我创建实例的方法:
sqllocaldb create MyInstance
会产生以下响应:
LocalDB instance "MyInstance" created with version 11.0.
到目前为止一切顺利。现在我要分享这个实例:
sqllocaldb share "MyInstance" "MySharedInstance"
导致以下结果:
Private LocalDB instance "MyInstance" shared with the shared name: "MySharedInstance".
看起来仍然很好。此时,我使用info命令得到以下输出:
.\MySharedInstance
MyInstance
v11.0
当使用管理员或非管理员命令提示符从所有者帐户(即管理员)连接到实例时,似乎可以正常工作。 但是,当我以普通用户身份登录(而不是Windows管理员)并尝试连接时,事情就会失控:
sqlcmd -S (localdb)\.\MySharedInstance
结果为:
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : Named Pipes Provider: Could not open a connection to SQL Server [2]. .
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : Login timeout expired.
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..
使用“-l”开关增加登录超时时间没有帮助。我可以连接到默认的v11.0实例,该实例没有共享。非管理员用户的info命令与上面相同,只是没有“MyInstance”,因为它是由管理员用户拥有的命名实例。以下命令(适用于管理员用户/实例所有者):
sqllocaldb info ".\MySharedInstance"
同样会导致错误:
Windows API call "FileTimeToSystemTime" returned error code: -2147024809.
所以问题是为什么我的非管理员用户无法连接到共享实例?这似乎违背了共享实例的整个目的。而且当我尝试查询有关共享实例的信息时,“sqllocaldb info”命令为什么会抛出错误?