Database Administrators
Q&A for database professionals who wish to improve their database skills
Latest Questions
18
votes
11
answers
84582
views
Cannot start SqlLocalDB instance with my Windows account
I'm the administrator and simply run the command: sqllocaldb start v11.0 Result: Start of LocalDB instance "v11.0" failed because of the following error: Error occurred during LocalDB instance startup: SQL Server process failed to sta rt. Event viewer log Event ID: 528 > Windows API call WaitForMult...
I'm the administrator and simply run the command:
sqllocaldb start v11.0
Result:
Start of LocalDB instance "v11.0" failed because of the following error:
Error occurred during LocalDB instance startup: SQL Server process failed to sta
rt.
Event viewer log
Event ID: 528
> Windows API call WaitForMultipleObjects returned error code: 575.
> Windows system error message is: {Application Error} The application
> was unable to start correctly (0x%lx). Click OK to close the
> application. Reported at line: 3621.
I tried another (user and administrator) accounts, there were no problems with them.
I uninstalled & reinstalled 2012 version of SQLLocalDB.msi but I had no luck. Do you have any idea & fix?
Nime Cloud
(351 rep)
Dec 13, 2012, 04:19 PM
• Last activity: Jul 10, 2025, 02:27 PM
-1
votes
2
answers
76
views
How to find out what is adding a login trigger to my MSSQLLocalDB?
I keep having trouble with logging into (localdb)\MSSQLLocalDB. It gives the error: > Logon failed for login 'Domain\user' due to trigger execution. > Changed database context to 'master'. > Changed language setting to us_english. When in this state I can't do much diagnostics because I can't log in...
I keep having trouble with logging into (localdb)\MSSQLLocalDB. It gives the error:
> Logon failed for login 'Domain\user' due to trigger execution.
> Changed database context to 'master'.
> Changed language setting to us_english.
When in this state I can't do much diagnostics because I can't log into it. I've been getting out of this with the following shell command.
SqlLocalDb stop MSSQLLocalDB -k
SqlLocalDb delete MSSQLLocalDB
I can then create a new database by logging into the database again, but obviously all data is lost. Trouble is that a few days later the same thing happens again. I'm fairly certain I'm not adding any login triggers. I work on a corporate network and wouldn't be at all surprised if some rogue security tool is doing it.
I'm wondering if there is any way of seeing the trigger or capturing diagnostics without being able to login?
Martin Brown
(728 rep)
Jun 28, 2024, 02:31 PM
• Last activity: Apr 1, 2025, 12:40 PM
2
votes
2
answers
126
views
Error while connecting Local DB 2012 in Windows 7 PC using SSMS
I am trying to access LocalDB 2012 on my Windows 7 SP1 PC. I have successfully installed LocalDB and started the instance using the command line, and it is currently running. However, when I attempt to connect to this LocalDB instance using SQL Server Management Studio (SSMS), I receive the followin...
I am trying to access LocalDB 2012 on my Windows 7 SP1 PC.
I have successfully installed LocalDB and started the instance using the command line, and it is currently running.
However, when I attempt to connect to this LocalDB instance using SQL Server Management Studio (SSMS), I receive the following error.
> A network-related or instance-specific error occurred while
> establishing a connection to SQL Server. The server was not
> found or was not accessible. Verify that the instance name
> is correct and that SQL Server is configured to allow remote
> connections.
> (provider: SQL Network Interfaces, error: 26 -
> Error Locating Server/Instance Specified)
> (.Net SqlClient Data Provider)
I have verified the following configurations, and they seem to be working correctly as mentioned in the Link
- TCP port is enabled.
- SQL Server Configuration Manager is installed.
- SQL Browser service is running.
- Port 1433 is open.
Also note that I have tried connecting using the following instance names, but without success:
I have attempted to log in using Windows Authentication.
(localdb)\v11.0
(localdb)\mssqllocaldb
Given all of this, what could be the cause of the issue.? How can I solve this issue?
RD Seeker
(35 rep)
Oct 16, 2024, 07:13 AM
• Last activity: Oct 22, 2024, 04:41 AM
0
votes
1
answers
648
views
Installing/Repairing SQL Server installation fails
I am installing a local instance of SQL Server. During setup the database engine fails. What others steps can make sure the installation succeeds? What I've tried: 1. Installing two times. 2. Repairing installation two times. 3. Turning off firewall. 4. Running installation as admin. 5. The database...
I am installing a local instance of SQL Server.
During setup the database engine fails. What others steps can make sure the installation succeeds?
What I've tried:
1. Installing two times.
2. Repairing installation two times.
3. Turning off firewall.
4. Running installation as admin.
5. The database engine keeps failing. And the SQL Server service fails to start.
Am I correct to assume that this fails because the SQL Server service can't start because database engine is not installed?
Detailed results:
Feature: Master Data Services
Status: Passed
Feature: Database Engine Services
Status: Failed
Reason for failure: An error occurred during the setup process of the feature.
Next Step: Use the following information to resolve the error, and then try the setup process again.
Component name: SQL Server Database Engine Services Instance Features
Component error code: 0x84B40002
Error description: The SQL Server feature 'SQL_Engine_Core_Inst' is not in a supported state for repair, as it was never successfully configured. Only features from successful installations can be repaired. To continue, remove the specified SQL Server feature.
2024-05-12 00:10:43.24 Server Microsoft SQL Server 2022 (RTM) - 16.0.1000.6 (X64)
Oct 8 2022 05:58:25
Copyright (C) 2022 Microsoft Corporation
Developer Edition (64-bit) on Windows 10 Home Single Language 10.0 (Build 22631: ) (Hypervisor)
2024-05-12 00:10:43.24 Server UTC adjustment: 8:00
2024-05-12 00:10:43.24 Server (c) Microsoft Corporation.
2024-05-12 00:10:43.24 Server All rights reserved.
2024-05-12 00:10:43.24 Server Server process ID is 119848.
2024-05-12 00:10:43.24 Server System Manufacturer: 'ASUSTeK COMPUTER INC.', System Model: 'ROG Strix G513QC_G513QC'.
2024-05-12 00:10:43.24 Server Authentication mode is WINDOWS-ONLY.
2024-05-12 00:10:43.24 Server Logging SQL Server messages in file 'C:\Program Files\Microsoft SQL Server\MSSQL16.LOCALSQLSERVER\MSSQL\Log\ERRORLOG'.
2024-05-12 00:10:43.24 Server The service account is 'NT Service\MSSQL$LOCALSQLSERVER'. This is an informational message; no user action is required.
2024-05-12 00:10:43.24 Server Registry startup parameters:
-d C:\Program Files\Microsoft SQL Server\MSSQL16.LOCALSQLSERVER\MSSQL\DATA\master.mdf
-e C:\Program Files\Microsoft SQL Server\MSSQL16.LOCALSQLSERVER\MSSQL\Log\ERRORLOG
-l C:\Program Files\Microsoft SQL Server\MSSQL16.LOCALSQLSERVER\MSSQL\DATA\mastlog.ldf
2024-05-12 00:10:43.24 Server Command Line Startup Parameters:
-s "LOCALSQLSERVER"
-m "SqlSetup"
-Q
-q "SQL_Latin1_General_CP1_CI_AS"
-T 4022
-T 4010
-T 3659
-T 3610
-T 8015
2024-05-12 00:10:43.24 Server SQL Server detected 1 sockets with 8 cores per socket and 16 logical processors per socket, 16 total logical processors; using 16 logical processors based on SQL Server licensing. This is an informational message; no user action is required.
2024-05-12 00:10:43.24 Server SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.
2024-05-12 00:10:43.24 Server Detected 32158 MB of RAM. This is an informational message; no user action is required.
2024-05-12 00:10:43.24 Server Using conventional memory in the memory manager.
2024-05-12 00:10:43.24 Server Detected pause instruction latency: 65 cycles.
2024-05-12 00:10:43.24 Server Spin divider value used: 1
2024-05-12 00:10:43.24 Server Page exclusion bitmap is enabled.
2024-05-12 00:10:43.40 Server Buffer Pool: Allocating 1048576 bytes for 833096 hashPages.
2024-05-12 00:10:43.40 Server Default collation: SQL_Latin1_General_CP1_CI_AS (us_english 1033)
2024-05-12 00:10:43.42 Server Buffer pool extension is already disabled. No action is necessary.
2024-05-12 00:10:43.44 Server CPU vectorization level(s) detected: SSE SSE2 SSE3 SSSE3 SSE41 SSE42 AVX AVX2 POPCNT BMI1 BMI2
2024-05-12 00:10:43.44 Server Perfmon counters for resource governor pools and groups failed to initialize and are disabled.
2024-05-12 00:10:43.46 Server Query Store settings initialized with enabled = 1,
2024-05-12 00:10:43.46 Server The maximum number of dedicated administrator connections for this instance is '1'
2024-05-12 00:10:43.46 Server This instance of SQL Server last reported using a process ID of 117212 at 12/05/2024 12:10:41 am (local) 11/05/2024 4:10:41 pm (UTC). This is an informational message only; no user action is required.
2024-05-12 00:10:43.46 Server Node configuration: node 0: CPU mask: 0x000000000000ffff:0 Active CPU mask: 0x000000000000ffff:0. This message provides a description of the NUMA configuration for this computer. This is an informational message only. No user action is required.
2024-05-12 00:10:43.47 Server Using dynamic lock allocation. Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node. This is an informational message only. No user action is required.
2024-05-12 00:10:43.47 Server Lock partitioning is enabled. This is an informational message only. No user action is required.
2024-05-12 00:10:43.47 Server In-Memory OLTP initialized on lowend machine.
2024-05-12 00:10:43.48 Server [INFO] Created Extended Events session 'hkenginexesession'
2024-05-12 00:10:43.48 Server Database Instant File Initialization: enabled. For security and performance considerations see the topic 'Database Instant File Initialization' in SQL Server Books Online. This is an informational message only. No user action is required.
2024-05-12 00:10:43.48 Server Total Log Writer threads: 2, Node CPUs: 8, Nodes: 1, Log Writer threads per CPU: 1, Log Writer threads per Node: 2
2024-05-12 00:10:43.50 Server Database Mirroring Transport is disabled in the endpoint configuration.
2024-05-12 00:10:43.50 Server clwb is selected for pmem flush operation.
2024-05-12 00:10:43.50 spid42s Warning ******************
2024-05-12 00:10:43.50 spid42s SQL Server started in single-user mode. This an informational message only. No user action is required.
2024-05-12 00:10:43.50 Server Software Usage Metrics is disabled.
2024-05-12 00:10:43.50 spid42s Starting up database 'master'.
2024-05-12 00:10:43.51 spid42s There have been 256 misaligned log IOs which required falling back to synchronous IO. The current IO is on file C:\Program Files\Microsoft SQL Server\MSSQL16.LOCALSQLSERVER\MSSQL\DATA\master.mdf.
2024-05-12 00:10:43.51 spid42s 05/12/24 00:10:43 Stack Overflow Dump not possible - Exception c00000fd EXCEPTION_STACK_OVERFLOW at 0x00007FFE0AA1F009
2024-05-12 00:10:43.51 spid42s SqlDumpExceptionHandler: Address=0x00007FFE0AA1F009 Exception Code = c00000fd
2024-05-12 00:10:43.51 spid42s Rax=0000000000001118 Rbx=00000000fb49a180 Rcx=000000000741e040 Rdx=0000000008099000
2024-05-12 00:10:43.51 spid42s Rsi=0000000008099000 Rdi=0000000000004000 Rip=000000000aa1f009 Rsp=000000004c613060
2024-05-12 00:10:43.51 spid42s Rbp=000000004c612060 EFlags=0000000000010206
2024-05-12 00:10:43.51 spid42s cs=0000000000000033 ss=000000000000002b ds=000000000000002b
es=000000000000002b fs=0000000000000053 gs=000000000000002b
2024-05-12 00:10:43.57 Server CLR version v4.0.30319 loaded.
2024-05-12 00:10:43.61 Server Common language runtime (CLR) functionality initialized using CLR version v4.0.30319 from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\.
2024-05-12 00:10:43.62 spid42s Frame 0: 0x00007FFE07D95F16
2024-05-12 00:10:43.62 spid42s Frame 1: 0x00007FFE08CCD6B6
2024-05-12 00:10:43.62 spid42s Frame 2: 0x00007FFE07D958A0
2024-05-12 00:10:43.62 spid42s Frame 3: 0x00007FFE10539C16
2024-05-12 00:10:43.62 spid42s Frame 4: 0x00007FFE104D4BDC
2024-05-12 00:10:43.62 spid42s Frame 5: 0x00007FFE104D4E5B
2024-05-12 00:10:43.62 spid42s Frame 6: 0x00007FFED89DF8F5
2024-05-12 00:10:43.62 spid42s Frame 7: 0x00007FFED89D3DA0
2024-05-12 00:10:43.62 spid42s Frame 8: 0x00007FFED89D37A1
2024-05-12 00:10:43.62 spid42s Frame 9: 0x00007FFED89D46EC
2024-05-12 00:10:43.62 spid42s Frame 10: 0x00007FFED89E04B1
2024-05-12 00:10:43.62 spid42s Frame 11: 0x00007FFEF347440F
2024-05-12 00:10:43.62 spid42s Frame 12: 0x00007FFEF33EE466
2024-05-12 00:10:43.62 spid42s Frame 13: 0x00007FFEF34733FE
2024-05-12 00:10:43.62 spid42s Frame 14: 0x00007FFE0AA1F009
2024-05-12 00:10:43.62 spid42s Frame 15: 0x00007FFE0BBBA79F
2024-05-12 00:10:43.62 spid42s
2024-05-12 00:10:43.62 spid42s TotalPhysicalMemory = 33720791040, AvailablePhysicalMemory = 10920484864
2024-05-12 00:10:43.62 spid42s AvailableVirtualMemory = 140692328562688, AvailablePagingFile = 5082546176
2024-05-12 00:10:43.62 spid42s Stack Signature for the dump is 0x00000000CFAEA995
2024-05-12 00:10:44.25 spid42s External dump process return code 0x20000001.
External dump process returned no errors.
2024-05-12 00:10:44.27 spid42s Unable to create stack dump file due to stack shortage (ex_terminator - Last chance exception handling)
2024-05-12 00:10:44.27 spid42s Stack Signature for the dump is 0x0000000000000000
2024-05-12 00:10:44.27 spid42s CDmpClient::ExecuteAllCallbacks started.
2024-05-12 00:10:44.27 spid42s XE_DumpCallbacks is executing...
2024-05-12 00:10:44.28 spid42s DumpCallbackSOS is executing...
2024-05-12 00:10:44.28 spid42s DumpCallbackEE is executing...
2024-05-12 00:10:44.28 spid42s DumpCallbackSE is executing...
2024-05-12 00:10:44.28 spid42s DumpCallbackSEAM is executing...
2024-05-12 00:10:44.28 spid42s DumpCallbackSSB is executing...
2024-05-12 00:10:44.30 spid42s DumpCallbackQE is executing...
2024-05-12 00:10:44.30 spid42s DumpCallbackFullText is executing...
2024-05-12 00:10:44.30 spid42s DumpCallbackSQLCLR is executing...
2024-05-12 00:10:44.30 spid42s DumpCallbackHk is executing...
2024-05-12 00:10:44.30 spid42s DumpCallbackRepl is executing...
2024-05-12 00:10:44.30 spid42s DumpCallbackPolyBase is executing...
2024-05-12 00:10:44.30 spid42s CDmpClient::ExecuteAllCallbacks completed. Time elapsed: 0 seconds.
2024-05-12 00:10:44.95 spid42s External dump process return code 0x20000001.
External dump process returned no errors.
Update :
C:\Windows\System32>fsutil fsinfo ntfsinfo C:
NTFS Volume Serial Number : 0x62906c9f906c7c03
NTFS Version : 3.1
LFS Version : 2.0
Total Sectors : 950,846,094 (453.4 GB)
Total Clusters : 118,855,761 (453.4 GB)
Free Clusters : 57,541,365 (219.5 GB)
Total Reserved Clusters : 663,939 ( 2.5 GB)
Reserved For Storage Reserve : 655,360 ( 2.5 GB)
Bytes Per Sector : 512
Bytes Per Physical Sector : 4096
Bytes Per Cluster : 4096 (4 KB)
Bytes Per FileRecord Segment : 1024
Clusters Per FileRecord Segment : 0
Mft Valid Data Length : 1.23 GB
Mft Start Lcn : 0x00000000000c0000
Mft2 Start Lcn : 0x0000000000000002
Mft Zone Start : 0x0000000004878280
Mft Zone End : 0x000000000487fc00
MFT Zone Size : 121.50 MB
Max Device Trim Extent Count : 256
Max Device Trim Byte Count : 0xffffffff
Max Volume Trim Extent Count : 62
Max Volume Trim Byte Count : 0x40000000
Resource Manager Identifier : 955798FB-21A8-11EC-9FBF-04421AD07687





guradio
(95 rep)
May 19, 2024, 08:36 AM
• Last activity: Aug 4, 2024, 04:13 PM
10
votes
1
answers
38509
views
How do I connect to localDB from SQL Server 2014 Express
I downloaded both the LocalDB and Management Studio for MS SQL Server 2014 Express so that I can practice on my local machine. However, when I open Management Studio and try to browse to localDB to connect to start created databases I can't locate the localDB. May someone please assist me with this?
I downloaded both the LocalDB and Management Studio for MS SQL Server 2014 Express so that I can practice on my local machine. However, when I open Management Studio and try to browse to localDB to connect to start created databases I can't locate the localDB.
May someone please assist me with this?
J.S.Orris
(203 rep)
Nov 15, 2015, 04:41 PM
• Last activity: Sep 13, 2023, 12:03 AM
2
votes
0
answers
358
views
What to do when can't find Microsoft SQL Server error explanation
Following this doc [View or Change the Default Locations for Data and Log Files][1] for SQL Server 2016. I am attempting a simple change of location for data/log/backup files in MSSM. - `Connect` in Object Explorer - Login to `localdb` - Right-click on `localdb` instance and choose `Properties` - Ch...
Following this doc View or Change the Default Locations for Data and Log Files for SQL Server 2016. I am attempting a simple change of location for data/log/backup files in MSSM.
-
Connect
in Object Explorer
- Login to localdb
- Right-click on localdb
instance and choose Properties
- Choose Database Settings
- Attempt to change file paths (single/multiple instances) to a subfolder (with rights) of default folder
Logged into database using Windows Authentication using the following credentials:
- (localdb)\MSSQLLocalDB
- Laptop\user
I am using the following version of Microsoft SQL Server Management SQL (Have tried this both in standard/(Administrator) modes)
Server Management Studio 15.0.18424.0
SQL Server Management Objects (SMO) 16.100.47021.0+7eef34a564af48c5b0cf0d617a65fd77f06c3eb1
Microsoft Analysis Services Client Tools 15.0.19750.0
Microsoft Data Access Components (MDAC) 10.0.19041.2604
Microsoft MSXML 3.0 6.0
Microsoft .NET Framework 4.0.30319.42000
Operating System 10.0.19044
Error message from here:
===================================
Alter failed for Settings 'Microsoft.SqlServer.Management.Smo.ObjectKeyBase'. (Microsoft.SqlServer.Smo)
------------------------------
For help, click: https://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=16.100.47021.0&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Alter+Settings&LinkId=20476
------------------------------
Program Location:
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.AlterImpl()
at Microsoft.SqlServer.Management.SqlManagerUI.ServerPropDBSettings.SendDataToServer()
at Microsoft.SqlServer.Management.SqlManagerUI.ServerPropDBSettings.OnRunNow(Object sender)
at Microsoft.SqlServer.Management.SqlMgmt.PanelExecutionHandler.Run(RunType runType, Object sender)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.DoPreProcessExecutionAndRunViews(RunType runType)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.ExecuteForSql(PreProcessExecutionInfo executionInfo, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.Microsoft.SqlServer.Management.SqlMgmt.IExecutionAwareSqlControlCollection.PreProcessExecution(PreProcessExecutionInfo executionInfo, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.ViewSwitcherControlsManager.RunNow(RunType runType, Object sender)
===================================
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
Program Location:
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType, Boolean retry)
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(StringCollection sqlCommands, ExecutionTypes executionType, Boolean retry)
at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQuery(StringCollection queries, Boolean retry)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.ExecuteNonQuery(StringCollection queries, Boolean includeDbContext, Boolean executeForAlter)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.AlterImplFinish(StringCollection alterQuery, ScriptingPreferences sp)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.AlterImplWorker()
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.AlterImpl()
===================================
RegCreateKeyEx() returned error 5, 'Access is denied.' (.Net SqlClient Data Provider)
------------------------------
For help, click: https://docs.microsoft.com/sql/relational-databases/errors-events/mssqlserver-22002-database-engine-error
------------------------------
Server Name: (localdb)\MSSQLLocalDB
Error Number: 22002
Severity: 16
State: 1
------------------------------
Program Location:
at Microsoft.SqlServer.Management.Common.ConnectionManager.ExecuteTSql(ExecuteTSqlAction action, Object execObject, DataSet fillDataSet, Boolean catchException)
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType, Boolean retry)
Results from error message help suggestions
- first "For help" link leads to advertising
- second database errors results in 404 error
- follow links of 404 page
to database errors listed by number
- using quoted error number Error Number: 22002
for SQL Server 2016 I find there isn't one?
Even using the provided script for doc Database Engine events and errors (22000 to 22999) does not produce an explanation for Error Number: 22002
Does anyone have an idea for what more I could do? Any would be appreciated.
Dave
(121 rep)
Mar 5, 2023, 04:21 AM
5
votes
2
answers
6314
views
DROP DATABASE statement cannot be used inside a user transaction
Not really sure if this question belongs here, but I hope someone could help me out. I've made integration tests going all the way down to the database (using mssql localDB). I want each test to run independently with it's own data - I want to reseed the database with my fake data before each test i...
Not really sure if this question belongs here, but I hope someone could help me out.
I've made integration tests going all the way down to the database (using mssql localDB). I want each test to run independently with it's own data - I want to reseed the database with my fake data before each test is running. I tried to implement it with transactions without success. Here is how I tried to pull it off:
public class TestDbInitializer : DropCreateAlways()
{
public static List Items;
public override Seed(DbContext context)
{
Items = new List();
// Adding items
// ..
Items.ForEach(x => context.Add(x));
context.SaveChanges();
}
}
public class BaseTransactionsTests
{
private TransactionScope _scope
[TestInitialize]
public void Initialize()
{
_scope = new TransactionScope();
}
[TestCleanup]
public void Cleanup()
{
_scope.Dispose();
}
}
[TestClass]
public class IntegrationTests : BaseTransactionsTests
private IDependenciesContainer _container;
public static void AssemblyInit(TestContext context)
{
Database.SetInitializer(new TestDbInitializer());
_container = new DependenciesContainer();
// Registers all my application's dependencies
_container.RegisterAll();
}
[TestInitialize]
public void Initialize()
{
using (var context = new MyContext("TestsDatabase"))
{
context.Initialize(true);
}
}
[TestMethod]
public void TestAddItem()
{
var controller = _container.Resolve();
var result = controller.AddItem(new Item({Name = "Test"}))
var goodResult = result as OkNegotiatedResult();
if (result == null)
Assert.Fail("Bad result")
using (var context = new MyContext("TestsDatabase"))
{
Assert.AreEqual(context.Items.Count, TestDbInitializer.Items.Count + 1)
}
}
I use my dependency injector in my tests, registering all dependencies once (AssemblyInitialize).
I created a DB instance for testings, and a specific DropCreateAlways initializer with a fake data Seed method, which I set as the initializer in the AssemblyInitialize as well.
I want to reseed the database with my fake data before each test run. For that case I implemented the base class which holds a transaction scope.
When I run my tests, the following exception is thrown when Seeding the database in the TestInitialize:
DROP DATABASE statement cannot be used inside a user transaction
How should I deal with it? Moreover, what do you think of my implementation of those integration tests? What could be improved?
S. Peter
(185 rep)
Apr 5, 2016, 05:22 PM
• Last activity: Jan 1, 2023, 09:45 AM
7
votes
3
answers
5136
views
Can't connect to SQL Server 2017 Local DB shared instance
I cannot connect to a SQL Server 2017 (14.0.1000.169) **Local DB** shared instance. I tried on a laptop that previously had some SQL Server Express and stuff that I all have uninstalled. And also on a fresh Win10 VM. Both always have the same error: >Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL S...
I cannot connect to a SQL Server 2017 (14.0.1000.169) **Local DB** shared instance.
I tried on a laptop that previously had some SQL Server Express and stuff that I all have uninstalled. And also on a fresh Win10 VM.
Both always have the same error:
>Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Named Pipes Provider: Could not open a connection to SQL Server [2] . .
>
>Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.
>
>Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : 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..
This error is from
SQLCMD
but I've also tried with SSMS and Visual Studio connection string.
I tried connecting with the owner of the instance and could not. Also tried with a SQL Login with *sysadmin* right and could not.
**I can only connect with the pipe name.**
I also tried everything from:
* Why can't I connect to a SQL Server 2012 LocalDB shared instance? on Stack Overflow
* SQL 2016 sp1 SQLLocalDB versions errors with "Windows API call "RegGetValueW" returned error code: 0." on MSDN Forums
Why can't I connect?
Leojet
(73 rep)
Sep 18, 2019, 08:04 PM
• Last activity: Dec 29, 2022, 11:25 AM
0
votes
0
answers
291
views
Connection String requires AttachDbFilename property
I'm trying to use SQL Server **LocalDb** to store the database by connection string. During first connection to the database I have an error about connecting to the database. In SSMS it is opening. To fix it I need to add **AttachDbFilename** with full path to the **.mdf** file in connection string,...
I'm trying to use SQL Server **LocalDb** to store the database by connection string. During first connection to the database I have an error about connecting to the database. In SSMS it is opening. To fix it I need to add **AttachDbFilename** with full path to the **.mdf** file in connection string, despite that I already have **Initial Catalog** property. After first connection I can remove **AttachDbFilename** and then connecting will work also perfectly fine. Reproduces only on the Windows Server OS. On Windows 10 everything works fine. What can be the fix of this issue without adding **AttachDbFilename** during first connection?
Roman DotNetDev
(3 rep)
Dec 9, 2022, 09:47 PM
0
votes
0
answers
178
views
Windows server localdb issue
I'm trying to deploy a database to a Windows Server machine. The database is a SQL Server LocalDB. When I deploy it to a Windows machine, everything works correctly. When I try to deploy the same database, but to a Windows Server machine, everything is also ok, DB is created, but when I try to work...
I'm trying to deploy a database to a Windows Server machine.
The database is a SQL Server LocalDB. When I deploy it to a Windows machine, everything works correctly. When I try to deploy the same database, but to a Windows Server machine, everything is also ok, DB is created, but when I try to work with this database (Get account user data), I got an error:
> Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration."
I guess changing
AutomaticMigrationsEnabled
to true is not a solution, as after trying to make it I got the other errors.
Also, when I use SQL Server Express Database, everything works without any issues. The issue is only when I use LocalDB together with a Windows Server.
Are there any ways to solve this issue?
Roman DotNetDev
(3 rep)
Dec 6, 2022, 10:30 AM
• Last activity: Dec 6, 2022, 12:41 PM
0
votes
0
answers
201
views
LocalDB build and Memory Optimized table types
We have a DevOps pipeline for our DB Build/Release process and we're using VS SQL Database projects. We have one DB which makes extensive use of memory optimized table variables. Used for transfering data to/from a Calc Engine & DB. I know that LocalDB doesn't support FILESTREAM (needed for MO table...
We have a DevOps pipeline for our DB Build/Release process and we're using VS SQL Database projects. We have one DB which makes extensive use of memory optimized table variables. Used for transfering data to/from a Calc Engine & DB. I know that LocalDB doesn't support FILESTREAM (needed for MO tables), but I'm not looking to nail up a LocalDB.
QUESTION: can LocalDB handle DB build/release process for validation purposes? If no, will I need a permanent Azure SQL DB for this purpose?
SqlNightOwl
(45 rep)
Nov 22, 2022, 05:16 PM
6
votes
2
answers
7746
views
Access SQL Server Express LocalDB from Local Area Network
I am developing a software which requires SQL Server. But for a 50MB application it is not a good idea to tell customers to install SQL Server. So I think it's better to use SQL Server Express LocalDB. I want to give feature of accessing my app from Local Area Network. But I am not getting any relat...
I am developing a software which requires SQL Server. But for a 50MB application it is not a good idea to tell customers to install SQL Server. So I think it's better to use SQL Server Express LocalDB.
I want to give feature of accessing my app from Local Area Network. But I am not getting any related topics to do this.
Is it possible to access SQL Server Express LocalDB on Local Area Network?
What are the limitations of SQL Server Express LocalDB compared to SQL Server?
IT researcher
(3178 rep)
Jul 5, 2016, 11:23 AM
• Last activity: Mar 30, 2022, 02:10 PM
9
votes
1
answers
11674
views
Error starting localDb on Windows 11
I installed Windows 11 on a brand new NUC, then installed all updates. Installed `Visual Studio 2022 CE` and `SSMS (v 18.10)` I attempted to start the localDB which is assume was installed as part of Visual Studio 2022/ SSMS and when entering `(localdb)\mssqllocaldb` in SSMS it get the error...
I installed Windows 11 on a brand new NUC, then installed all updates. Installed
Visual Studio 2022 CE
and SSMS (v 18.10)
I attempted to start the localDB which is assume was installed as part of Visual Studio 2022/ SSMS and when entering (localdb)\mssqllocaldb
in SSMS it get the error
Cannot connect to (localdb)\mssqllocaldb.
SQL Network Interfaces, error: 50 - Local Database Runtime error occurred.
Error Number: -1983577846
I then verified/attempted to start the instance as below
sqllocaldb stop mssqllocaldb
sqllocaldb delete mssqllocaldb
sqllocaldb start "MSSQLLocalDB"
When typing the last command i received the error
*Start of LocalDB instance "MSSQLLocalDB" failed because of the following error:
Cannot create an automatic instance. See the Windows Application event log for error details.*
I looked at the log file found under
*....\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\MSSQLLocalDB*
and see a few error files and select the most latest one by date.
It contains info and the last line is
2021-12-11 10:48:42.67 spid10s There have been 256 misaligned log IOs which required falling back to synchronous IO. The current IO is on file C:\Users\....\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\MSSQLLocalDB\master.mdf.
The file is pretty short but i dont see an entry with **Error** anywhere and most lines end with *This is an informational message; no user action is required.*
**Windows log states**
*Windows API call WaitForMultipleObjects returned error code: 575. Windows system error message is: {Application Error}
The application was unable to start correctly (0x%lx). Click OK to close the application.
Reported at line: 3714.*
Opened up services and can see SQL Services VSS Writer with status of running and no other SQL service.
Does anyone have any recommendations for me to try?
Computer
(193 rep)
Dec 11, 2021, 11:13 AM
• Last activity: Feb 19, 2022, 08:51 AM
0
votes
2
answers
5082
views
Can no longer connect to localdb after updating from Sql Server 2016 to 2019
I need to restore a backup for an assignment, but SMSS said I was running v13 while the backup was made in v15. So I downloaded and installed SQL Server Express 2019 and uninstalled the older version. However, SMSS can't connect anymore to `(localdb)\MSSQLLocalDB`. I read somewhere to add a firewall...
I need to restore a backup for an assignment, but SMSS said I was running v13 while the backup was made in v15. So I downloaded and installed SQL Server Express 2019 and uninstalled the older version.
However, SMSS can't connect anymore to
(localdb)\MSSQLLocalDB
.
I read somewhere to add a firewall rule for sqlservr.exe
. When I try to run that file manually, it says the SQL Server installation is corrupt.
So I ran the Repair from SQL Server Installation Center, everything was okay in the output log but still no luck.
I'm pretty clueless, any help is appreciated.
The available services:
Status | Name | DisplayName
------ | ---- | -----------
Running | MSSQL$SQLEXPRESS | SQL Server (SQLEXPRESS)
Stopped | SQLAgent$SQLEXP... | SQL Server Agent (SQLEXPRESS)
Stopped | SQLBrowser | SQL Server Browser
Running | SQLTELEMETRY$SQ... | SQL Server CEIP service (SQLEXPRESS)
Running | SQLWriter | SQL Server VSS Writer
The list of LocalDb instances:
-none
PS C:\Program Files\Microsoft SQL Server\150\Tools\Binn> SqlLocalDb.exe i
MSSQLLocalDB
PS C:\Program Files\Microsoft SQL Server\150\Tools\Binn> SqlLocalDb.exe s "MSSQLLocalDB"
Start of LocalDB instance "MSSQLLocalDB" failed because of the following error:
Cannot create an automatic instance. See the Windows Application event log for error details.
Event viewer details:
> LocalDB parent instance version is invalid: MSSQL13E.LOCALDB
FDM
(101 rep)
Feb 28, 2021, 08:13 PM
• Last activity: Oct 12, 2021, 04:04 AM
0
votes
1
answers
126
views
Detect what version of SQL Server Express engine is available before connection?
I would like to detect what version of SQL Server Express engine is available so that I can connect either to the (localdb)\v.11 (SQL Server 2012 per https://learn.microsoft.com/en-us/previous-versions/sql/sql-server-2012/hh510202(v=sql.110)?redirectedfrom=MSDN#Anchor_1) or (localdb)\MSSQLLocalDB (S...
I would like to detect what version of SQL Server Express engine is available so that I can connect either to the (localdb)\v.11 (SQL Server 2012 per https://learn.microsoft.com/en-us/previous-versions/sql/sql-server-2012/hh510202(v=sql.110)?redirectedfrom=MSDN#Anchor_1) or (localdb)\MSSQLLocalDB (SQL Server 2014 and up per https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/sql-server-express-localdb?view=sql-server-ver15&redirectedfrom=MSDN&viewFallbackFrom=sql-server-2014#Anchor_1) instance name when attempting to attach a file in the connection string using the AttachDBFileName= mechanism.
I would most likely want to do it from Powershell in some manner, but whatever method is reliable, I can use. I do know that sometimes a LocalDB connection can be a bit slow as it attaches the file and starts up on demand, so I have in the past been pretty lenient on the connect timeout for these LocalDB connections compared to the real SQL Server connections, so I would prefer not trying to connect and waiting for timeout, since I think I've already got an exaggerated timeout just for normal successful connection.
Cade Roux
(6684 rep)
Jul 13, 2021, 09:41 PM
• Last activity: Jul 13, 2021, 10:33 PM
18
votes
3
answers
40324
views
Where to download SQL Server 2019 Express LocalDB Installer MSI from
SQL Server 2019 is released but I there doesn't appear to be a LocalDB version available for download. Does anyone know if there will be a LocalDB release or if 2017 is the last version?
SQL Server 2019 is released but I there doesn't appear to be a LocalDB version available for download. Does anyone know if there will be a LocalDB release or if 2017 is the last version?
Simon
(283 rep)
Dec 5, 2019, 05:22 AM
• Last activity: Jul 2, 2021, 09:58 AM
0
votes
1
answers
4753
views
Installation of SQL Server Express LocalDB 2017
I want to install Microsoft SQL Server LocalDB 2017 on my system. I downloaded SQL Server Express Setup (about 5.1 MB). Then I opened it and chose 'Download Media' option and then chose LocalDB. Then it downloaded SqlLocalDB.msi setup (about 45.9 MB). I ran the setup and installed it on my computer....
I want to install Microsoft SQL Server LocalDB 2017 on my system. I downloaded SQL Server Express Setup (about 5.1 MB). Then I opened it and chose 'Download Media' option and then chose LocalDB. Then it downloaded SqlLocalDB.msi setup (about 45.9 MB). I ran the setup and installed it on my computer. I don't know what to do next. Can someone help me, please?
Output of Running "SqlLocalDb info" command:
C:\WINDOWS\system32>sqllocaldb info "MyInstance"
Name: MyInstance
Version: 14.0.1000.169
Shared name:
Owner: XXXXX
Auto-create: No
State: Stopped
Last start time: 05-11-2018 04:07:11 PM
Instance pipe name:
Sam
(9 rep)
Nov 4, 2018, 02:14 PM
• Last activity: Jul 2, 2021, 07:43 AM
13
votes
1
answers
13808
views
Move folder of SQL Server LocalDB instances from the default location
I get multiple errors with `LocalDB` ([startup error][1], [can't create DB from SQL Server Management Studio][2] and also [multiple][3] [issues][4] when trying to restore a backup) and none of the fixes I found are helping anything. It seems to me that all errors have their root in permissions not s...
I get multiple errors with
LocalDB
(startup error , can't create DB from SQL Server Management Studio and also multiple issues when trying to restore a backup) and none of the fixes I found are helping anything. It seems to me that all errors have their root in permissions not set up correctly.
Now a simple DDL table creation script works fine from SQL Server Management Studio and creates the database in the root of my user account's folder (as explained here ). The Instances folder however (located at D:\Users\[My name]\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances
despite when installing the SQL Server Express with Advanced Services I specified the DATA folder in another location - where only standard SQL Server Express .mdf
files are stored, but not LocalDB
instances) seems problematic regarding permissions (in contrary to the account root) therefore and also for having my DB files in a location among my projects I'd like to move the Instances folder to another place. Is this possible? I haven't even found a corresponding registry entry.
I'm using SQL Server Express 2012 and also SSMS of the same version (latest updates installed).
---
The Database Settings page threw an error for me, not being able to edit nor see any configuration there. I let Windows Update check for updates again and there were some updates for SQL Server Express that weren't installed (although I'm sure I selected everything to install before), so I installed them. This made it possible for me to go to the settings page.
I've tried to set up the LocalDB instance's root folder to somewhere else but I get an access denied error for every folder I tried, namely
> Alter failed for Settings
> 'Microsoft.SqlServer.Management.Smo.ObjectKeyBase'.
> (Microsoft.SqlServer.Smo)
>
> ------------------------------ ADDITIONAL INFORMATION:
>
> An exception occurred while executing a Transact-SQL statement or
> batch. (Microsoft.SqlServer.ConnectionInfo)
>
> ------------------------------
>
> RegCreateKeyEx() returned error 5, 'Access is denied.' (Microsoft SQL
> Server, Error: 22002)
I get this even if the folder has Full control set for Everyone! Even more amusing the only folder that works, one that is set as a default (the user account's root) has no special permissions applied - just the ones my user has (just as any other folder I tried to set). In effect this means that all my LocalDB databases' files are saved to my account's root folder.
Piedone
(233 rep)
Apr 6, 2013, 09:07 PM
• Last activity: Jun 15, 2021, 08:22 AM
0
votes
0
answers
1886
views
Local Postgres Server on Mac Pw Auth Fail
Disclaimer: I am new to MacOs. Haven't found any useful related question. After successfully installing postgresql 13.2 via homebrew on MacOs 11.2.1 (BigSur) i run into the following problem: Use terminal for the command psql postgres Prompts user pwd of my standard Mac user account. Returns: psql:...
Disclaimer: I am new to MacOs. Haven't found any useful related question.
After successfully installing postgresql 13.2 via homebrew on MacOs 11.2.1 (BigSur) i run into the following problem:
Use terminal for the command
psql postgres
Prompts user pwd of my standard Mac user account.
Returns:
psql: error: FATAL: password authentication failed for user "standarduser"
Try:
sudo psql postgres
Now asks standard user pwd and accepts it.
Then asks root user pwd and rejects it with the same error as before:
Returns:
psql: error: FATAL: password authentication failed for user "root"
What am I missing?
Google Google
(1 rep)
Apr 16, 2021, 08:35 PM
2
votes
0
answers
234
views
Is there a way to prevent SQL Server resetting itself back to read-write mode?
I'm working on a desktop app which is installed along with a database, and then connects to the database using SQL Server LocalDB when a user runs the app. The workflow is: 1. When the app starts, it creates and starts a named, user-specific SQL LocalDB instance. 2. When the user chooses a database,...
I'm working on a desktop app which is installed along with a database, and then connects to the database using SQL Server LocalDB when a user runs the app. The workflow is:
1. When the app starts, it creates and starts a named, user-specific SQL LocalDB instance.
2. When the user chooses a database, the corresponding MDF and LDF files get attached to the instance.
3. The app connects to the database to run queries and get data.
A key paradigm in the app is that "a database is just a set of files on disk", much like SQLite or MS Access. So, one should be able to change the files in the database folder, start the app again, and it would work the same, but would now be getting data from the new database.
Some database files may be in a central location, so multiple users on the same computer could in theory all have the app open at the same time, pointing to the same database.
Luckily, the app does not need to write to the database and there is a "read-only" setting in SQL Server which happens to allow multiple SQL LocalDB instances to all attach and connect to the same database at the same time, as long as they don't write to it. The app can set this by running
ALTER DATABASE MyDatabase SET READ_ONLY
.
The problem is that by default, "auto-close" is on, meaning that when the app disconnects from the instance and reconnects, the database gets set back to read-write mode.
A further complication is that when a user logs out and back in again, the SQL LocalDB instance is stopped, and when the app starts it up again, the database *still* gets set back to read-write, *even if auto-close is off*.
Is there any way to keep the database in read-only mode and not have SQL Server "forget"?
Notes:
* I doubt using a shared LocalDB instance would be feasible because of how LocalDB permissions are tied to file system permissions.
* The drive to use LocalDB is strong, given that the installation and configuration needs to be as automated and hassle-free as possible.
Update: I am going to make the app set the read-only attribute on the MDF and LDF files before it tries to attach them. I think this solves the issue.
A Kubiesa
(121 rep)
Jan 23, 2021, 01:27 AM
• Last activity: Feb 1, 2021, 02:20 PM
Showing page 1 of 20 total questions