SQL Server Always Encryption - Query Stuck in Executing State - sql-server

We are on - Microsoft SQL Server 2019 (RTM-CU9) (KB5000642) - 15.0.4102.2 (X64) Jan 25 2021 20:16:12 Copyright (C) 2019 Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2019 Standard 10.0 (Build 17763: ) (Hypervisor)
Configured Always Encryption successfully on the DB server. As part of testing, we removed the cert from the windows cert store and ran the select query with the "Column Encryption Setting=enabled" setting, the query is throwing an error in the message as expected but the query keeps running until I kill it. This is happening in the DB server and from other servers too. Has anyone seen this issue before? Thanks in Advance!

This was happening because we had symmetric Key Column level Encryption on the same table. We had multiple Symmetric keys, certs from previous testing. Once we removed all of those, the above issue disappeared. I am not sure what the old Symmetric keys had to do with the above issue as it was on another column on the same table but cleaning them up it resolved it.

Related

MS Access ODBC pass-through query to SQL Server appears complete on client side but still runs on server side

Microsoft® Access® for Microsoft 365 MSO (Version 2202 Build 16.0.14931.20888) 64-bit
Microsoft SQL Server 2019 - 15.0.4261.1 (X64) Copyright (C) 2019 Microsoft Corporation Standard Edition (64-bit) on Windows Server 2016 Datacenter 10.0
System Type 64 bit operating system, x64-based processor
I've created an ODBC 64-bit file DSN connection for a MS Access Pass-Through Query to a SQL Server database. I've got a large query that runs on the client side in around five minutes; the query appears to run and correctly return the requested records. The ODBC Timeout is set to 540 (seconds). The problem is that the server shows that the query ran for over forty-five minutes before I was contacted by a DBA. I terminated Access and that severed the connection.
Would anyone know why this might happen or how I could troubleshoot?
You can trace a query to see when different phases of the query complete.
Typically, when something impossible seems to be going on, when you look closer there's some easy explanation. Is there a transaction that's left open? Does running the query trigger updating statistics? Why does the DBA think the query keeps running? There's nothing unique about ODBC querying the database that would allow it to keep running without terminating. A first step might be to just run the query directly within SQL Studio and see if you can reproduce.
https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/performance/troubleshoot-never-ending-query?tabs=2008-2014

How to know who has updated the table in SQL server?

I want to know who has modified the table in the SQL server, But I couldn't find any authentic solution for this.
I tried function fn_dblog, but it is not allowing me due to some permission issue.
SELECT * FROM fn_dblog(NULL, NULL)
Error Message:
Msg 229, Level 14, State 5, Line 1 The SELECT permission was denied on
the object 'fn_dblog', database 'mssqlsystemresource', schema 'sys'.
I refereed this article, but the link for the fndblog2 function expired.
Basically, I want to get the list of users who have updated the given table, if it is modified in SSMS then user details and if it is modified by some .net application then .net application name.
SSMS details: Microsoft SQL Server 2019 (RTM-CU10) (KB5001090) - 15.0.4123.1 (X64) Mar 22 2021 18:10:24 Copyright (C) 2019 Microsoft Corporation Developer Edition (64-bit) on Windows Server 2019 Datacenter 10.0 (Build 17763: ) (Hypervisor)
Note: Privelleged Permission can't be given to me due to securities issues. I am fine with writing a C# application. I am ok with writing C# appication if it is possible in C#.

Enable File Stream SQL Server 2017

I am trying to enable file stream on Microsoft SQL Server 2017, on a Windows Core 2019 Server.
I have changed the registry settings at the following location to enable it as there is no GUI. I set the value to 3
ServerName\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL14.InstanceName\MSSQLServer\Filestream.EnabledLevel
After This I restarted
I have also installed the latest Cumulative update (20) as I know there where issues with Driver signing.
After This I restarted
I am seeting the following Errors in the log file at C:\Program Files\Microsoft SQL Server\MSSQL14.InstanceName\MSSQL\Log
<{781FAE78-09AB-4EE5-B051-67747BDB19E3}>RsFxMgmtInitialize failed (the RsFx device is not found. Check if RsFx driver is started.): Error 0x80070002 (-2147024894)
2020-04-21 08:56:03.94 spid5s FILESTREAM: failed to connect to kernel driver RsFx0503.
<{1038F43D-3391-45F7-B1B3-BADF26459429}>Failed to initialize CFsaShareFilter: Error 0x80070002 (-2147024894)
<{1038F43D-3391-45F7-B1B3-BADF26459429}>Failed to initialize CFsaShareFilter: Error 0x80070002 (-2147024894)
2020-04-21 08:56:03.94 spid5s FILESTREAM: effective level = 0, configured level = 2.
2020-04-21 08:56:03.94 spid5s FILESTREAM feature could not be initialized. The operating system Administrator must enable FILESTREAM on the instance using Configuration Manager.
SELECT ##VERSION
Microsoft SQL Server 2017 (RTM-CU20) (KB4541283) - 14.0.3294.2 (X64) Mar 13 2020 14:53:45 Copyright (C) 2017 Microsoft Corporation Standard Edition (64-bit) on Windows Server 2019 Standard 10.0 <X64> (Build 17763: ) (Hypervisor)
I got this working on one server and cannot get it working on the second one.
There is also a version of sql 2019 on this box
Any help? Also any advice on getting this working on a cluster
I used "computer management" and remotly connect to your core server. From there, you can enable FileStream and configure it.
This seemed to work better that the registry method

SSDT Data comparison, login failed

When ever I try to proceed to the second step in the comparison, it displays a message saying that it cannot connect with the login I provided (sqlAuth not win).
Note A: It will let me run queries and even do a schema comparison, but no luck with data comparison.
Note B: localhost works fine.
Versions:
Remote:
Microsoft SQL Server 2012 - 11.0.2100.60 (X64) Feb 10 2012 19:39:15
Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on
Windows NT 6.1 (Build 7601: Service Pack 1) (Hypervisor)
Local:
Microsoft SQL Server 2014 (RTM-CU14) (KB3158271) - 12.0.2569.0 (X64)
May 27 2016 15:06:08 Copyright (c) Microsoft Corporation Express
Edition (64-bit) on Windows NT 6.3 (Build 10586: )
There have been a number of connection-related fixes in the latest SSDT 16.5 release. I just worked through a similar issue with a partner building SSDT demos, and updating to latest resolved issues in Data and Schema compare for SQL Authentication with them. Specifically, there were issues where the "Remember Password" checkbox wasn't preserved which was causing issues, so you may need a one-time action to enter the password so that it's re-saved correctly.
Disclosure: I work on the SQL Server tools team.
I'm having similar issues with SQL Server auth.
Possible answers are listed on this similar question: https://dba.stackexchange.com/questions/102605/azure-sql-database-login-failed-for-user-in-application-but-works-fine-in-ssm
Which links to https://social.msdn.microsoft.com/Forums/sqlserver/en-US/74d2b7f0-09f2-4ef3-935b-e0a1e0e8fb82/schema-compare-target-unavailable?forum=ssdt

SCCM 2012 R2 and SQL, which SQL license to use

I've got SCCM 2012 R2 installed at a client with SQL Server 2012 SP1 installed in evaluation mode (as the client could not find their install key). I've heard that SQL Server licensing is included with System Center these days, but when the client (a smaller education institution) accesses their licensing, they see a large list of SQL Server versions listed, but every version says 'This version of the product does not require a key'.
Now I'm concerned, because leaving the installation in Evaluation mode will mean that SQL Server will fold up shop and not open after 180 days. Is there some special mechanism that bypasses licensing for SQL Server when ConfigMgr is installed? Why do I not see any valid license keys for SQL Server on the clients Software Assurance / Education licensing page?
Did I use the wrong version of SQL Server?
I found the answer, for anyone else stuck in the same problem.
If you use the ISO that you download from your volume license page, the SQL Server ISO should include the 'free SCCM' license baked in.
However, if you try to run this installer side-by-side on a server with a pre-existing install, SQL Server Setup will detect the other instance of SQL and not actually display the key. It will instead revert to displaying the 'Choose Evaluation or enter key screen'.
I found a way around though, wrote it up here: SCCM's SQL Stuck in Eval mode? How to fix!
In summary: download the SQL Server ISO found in the Volume License Center under System Center 2012 Configuration Manager, and run the installer on a clean server. This time you'll be able to see the pre-filled key, copy it and use this as your upgrade key using SQL Edition Upgrade from the SQL Setup. You'll get a warning stating 'Unsupported Upgrade Path' since the evaluation mode defaults to Enterprise, and the 'free' key is for Standard only, but it will still work.

Resources