Create Credential error occurred during Service Master Key decryption - sql-server

I have Sql Server 2017 running in a docker container, when I try and create a credential
CREATE CREDENTIAL AzureCredential WITH IDENTITY= 'xxxx', SECRET = 'xxxxxxxx'
I get the following error
Msg 33094, Level 16, State 9, Server 049ad391ba2f, Line 1
An error occurred during Service Master Key decryption
Any idea what could be causing this? Is there a linux library missing, I am using the 'mcr.microsoft.com/mssql/server:2017-latest' image

Most of the solutions around particular error suggests to run "ALTER SERVICE MASTER KEY FORCE REGENERATE;" .. Just see if this solution is applicable to you
"An error occurred during Service Master Key decryption" when trying to create SSIS catalog

Related

Setting up Azure SQL data sync's sync group

I just tried setting up Azure SQL data sync's sync group using sample Azure SQL database. I am syncing dbo.BuildVersion table of the sample database.
I get the following error on member database.
Database provisioning failed with the exception "Incorrect syntax near the keyword 'NOT'.Inner exception: SqlException ID: 39f49622-6a56-4a44-8e55-2a646f99a584, Error Code: -2146232060 - SqlError Number:156, Message: SQL error with code 156 For more information, provide tracing ID ‘679953bc-7dac-4490-89e9-ea6d145d0442’ to customer support."
How should I resolve this issue?
Thanks
I am able to resolve this issue by creating empty table in the member database first and then running the sync.
Does Sync service not create table when table does not exist in the member database?
It does create it, however, under certain circumstances it fails to create it do to some issue with the schema itself. Therefore, the workaround, as you figured out, is to create the table manually.

Issue creating external tables from sql server to hadoop using polybase

We have recently installed Polybase in SQL Server. We are trying to use Hortonworks to get data. I am facing below issue while creating a external table.
Msg 105019, Level 16, State 1, Line 1
EXTERNAL TABLE access failed due to internal error: 'Java exception raised on call to HdfsBridge_IsDirExist:
Error [End of File Exception between local host is: "xxxxx"; destination host is: "xxxxx":1111; :
java.io.EOFException; For more details see: http://wiki.apache.org/hadoop/EOFException] occurred while accessing external file.'
I tried changing the core-site.xml file in SQL Server polybase location by uncommenting the Kerberos option which is now giving me the below error:
Msg 105019, Level 16, State 1, Line 1
EXTERNAL TABLE access failed due to internal error: 'Java exception raised on call to HdfsBridge_Connect:
Error [Unable to instantiate LoginClass] occurred while accessing external file.'
I suspect it might be with creating database scoped credentials.
CREATE DATABASE SCOPED CREDENTIAL HadoopUser3
WITH IDENTITY = '<user>', Secret = '<Passw0rd>';
go
Can someone help me understand the issue I'm having with the Identity and Secret. Is it related to Hadoop credentials? What kind of secret do we have to give?
Few things to check:
In your core-site.xml file try setting hadoop.security.authentication to lower case "kerberos". Also, make sure you have added polybase.kerberos.realm and polybase.kerberos.kdchost
Make sure your data source created uses the correct LOCATION= to your HDFS cluster. Make sure that is the IP address:Port and not the name of the server itself
Check the external table and ensure you have the right path to the cluster physical file itself.

Physically move mssql instance with service broker to another server

What we are doing is simply shutting down sql server and physically moving mssql folder to another server. After that operation service broker not working correctly. What to do to make service broker work on a new server? What's the correct way to move whole server to a new machine?
We have merge replication which we dont want to reinitiallize. So backup/restore and attach/deattach is not a good option. Any solutions for reanimation of service broker on a new machine? Recreate certificates/create new SB guid (NEW BROKER)?
Alright, we moved folder with database files to fresh new instance of sql server on another machine. After few tests we get the expected error An error occurred while receiving data: '10054(An existing connection was forcibly closed by the remote host.)'. and in SQLProfiler it shows as Connection handshake failed. Error 15581 occurred while initializing the private key corresponding to the certificate. The SQL Server errorlog and the Windows event log may contain entries related to this error. State 88..
So, i've tried to regenerate master keys on both main database and master database. And it worked. Service broker running good on both directions.
USE <dbName>;
OPEN MASTER KEY DECRYPTION BY PASSWORD = 'password';
ALTER MASTER KEY REGENERATE WITH ENCRYPTION BY PASSWORD = 'password';
CLOSE MASTER KEY;
USE master;
OPEN MASTER KEY DECRYPTION BY PASSWORD = 'password';
ALTER MASTER KEY REGENERATE WITH ENCRYPTION BY PASSWORD = 'password';
CLOSE MASTER KEY;

Azure Import Error: The internal target platform type SqlAzureV12DatabaseSchemaProvider does not support schema file version '3.1'

For some reasons I cannot import new BACPACs from Azure. I still can import old ones.
This is the error message I get:
Internal Error. The internal target platform type SqlAzureV12DatabaseSchemaProvider does not support schema file version '3.1'.
I've tried this this solution , but it didn't help, because all my settings are already set up to default.
I also downloaded latest SSMS Preview, but on import it gives me other errors:
Warning SQL0: A project which specifies Microsoft Azure SQL Database v12 as the target platform may experience compatibility issues with SQL Server 2014.
Error SQL72014: .Net SqlClient Data Provider: Msg 102, Level 15, State 1, Line 1 Incorrect syntax near 'Admin'.
Error SQL72045: Script execution error. The executed script:
CREATE DATABASE SCOPED CREDENTIAL [Admin]
WITH IDENTITY = N'Admin';
Error SQL72014: .Net SqlClient Data Provider: Msg 319, Level 15, State 1, Line 2 Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.
Error SQL72045: Script execution error. The executed script:
CREATE DATABASE SCOPED CREDENTIAL [Admin]
WITH IDENTITY = N'Admin';
I have SSMS 2014 CU6 installed.
Any help would be much appreciated! Thank you!
Finally figured out what happened. It's a specific case, but maybe it helps someone else.
We tried to use elasic query to write queries across databases. To do it you need to create database scoped credentials. When package was imported, it tried to do the same locally and failed executing this:
CREATE DATABASE SCOPED CREDENTIAL [Admin]
WITH IDENTITY = N'Admin';
Since we decided to use different approach, I dropped scoped credentials and external data source (couldn't drop credentials without dropping data source):
DROP EXTERNAL DATA SOURCE Source
DROP DATABASE SCOPED CREDENTIAL Admin
Now everything is working again. Just be aware you cannot import database from Azure if it has scoped credentials created.
Make sure that you are using the new SQL Server Management Studio
https://msdn.microsoft.com/en-us/library/mt238290.aspx

Error while creating database on OrientDB

When I use the following command to create a database in OrientDB 2.0.10,
CREATE DATABASE plocal:../databases/pincode admin admin plocal
I get the following error.
Creating database [plocal:../databases/pincode] using the storage type [plocal]...
Error: com.orientechnologies.orient.core.exception.ODatabaseException: Cannot create database 'pincode'
Error: com.orientechnologies.orient.core.command.OCommandExecutorNotFoundException:Cannot find a command executor for the command request: sql.select count(*) from ORole where name.type() not in ["STRING"] and name is not null
I get the same error if i try to create the database this way,
CREATE DATABASE remote:localhost/pincode root password plocal
I have connected to the remote server in both cases.
Similar error of command executor not found, pops up even when I try to connect to the database.
Can someone help tell me where I'm going wrong?

Resources