I am trying to automate the tenant DB creation in Azure SQL Server.
DB has been created/copied as
CREATE DATABASE {0} AS COPY OF {1} ( SERVICE_OBJECTIVE = 'S2' )
Immediately adding a record to one of the table in the same. Getting error as:
Function completed (Failure, Id=1046eae2-c07a-4eee-9a1d-886e89ab5071)
A ScriptHost error has occurred
Exception while executing function: Functions.CreateTenant. .Net SqlClient Data Provider: Database 'tenant8' on server 'dbserver' is not currently available. Please retry the connection later. If the problem persists, contact customer support, and provide them the session tracing ID of '8AF58081-8F25-4B7F-83E3-63AFFC13C8CB'.
Exception while executing function: Functions.CreateTenant
Executed 'Functions.CreateTenant' (Failed, Id=1046eae2-c07a-4eee-9a1d-886e89ab5071)
Function had errors. See Azure WebJobs SDK dashboard for details. Instance ID is '1046eae2-c07a-4eee-9a1d-886e89ab5071'
Looking at the error message, it seems that you are trying to insert data before the database tenant8 has been provisioned and deployed. Deploying a database takes any time between a few dozens seconds to a few minutes. A description of the steps involved in this operation can be found on this blog post by Steve Mark. Please let us know if the deployment takes more than 5 minutes.
Related
I'm trying to create an Azure Synapse Link for Azure SQL Database, using the steps from here:
https://learn.microsoft.com/en-us/azure/synapse-analytics/synapse-link/connect-synapse-link-sql-database
After I create the link connection and I want to start it I receive the following error:
The connection to the sink database is failed. Detailed error message is: Login failed for user ''.
ConnectionToAzureDB
LinkConnection
Also I have configurated the Azure SQL database to use ADD Auth. The connection to the Azure Database seems to be working.
My user ( used to create the Synapse workspace is Subscription Owner)
The user is also owner of the storage account.
I added the SQL Managed Identity as Storage Blob Data Contributor
Did anyone else got this error and manage to fix it?
There are certain limitations while connecting SQL Database to Synapse Link as per document:
When setting up your workspace, users must select "Disable Managed Virtual Network" and "Allow connections from any IP addresses."
A link connection cannot be enabled by Azure Synapse link for SQL if the database owner does not have a mapped log in. it will cause to get error.The (ALTER AUTHORIZATION command can be used to workaround this problem by changing the database owner to an user.)
With fewer than 100 DTUs, the Free, Basic, or Standard tiers do not allow Azure Synapse Link for SQL.
With is limitation I tried to Connect SQL Database to Synapse Link and able to connect without error:
I was trying to create a Synapse Link service with On Premises SQL Server and getting following error
Failed to enable Synapse Link on the source due to 'Failed to enable the source database: Some internal error happened due to 'Calling internal service failed: Failed to execute non query on change publisher with status code 400 and error Fail to non-query change publisher with error: 'sqlErrorCode - 22301; exceptionCode - TransferServiceUnknowError; error - A database operation failed with the following error: 'Could not update the metadata. The failure occurred when executing the command '(null)'. The error/state returned was 15517/1: 'Cannot execute as the database principal because the principal "dbo" does not exist, this type of principal cannot be impersonated, or you do not have permission.'. Use the action and error to determine the cause of the failure and resubmit the request.'; detailedError - A database operation failed with the following error: 'Could not update the metadata. The failure occurred when executing the command '(null)'. The error/state returned was 15517/1: 'Cannot execute as the database principal because the principal "dbo" does not exist, this type of principal cannot be impersonated, or you do not have permission.'. Use the action and error to determine the cause of the failure and resubmit the request.'
I resolved by by changing the corresponding database user to 'sa' and it works.
use [YourCorrespondingDatabase] EXEC sp_changedbowner 'sa'
I am trying to get the current pipeline runs using the web activity. I followed the below article, however, after having all the permissions required, it give the below error.
Invoking Web Activity failed with HttpStatusCode - '404 : NotFound',
message - 'The requested resource does not exist on the server. Please
verify the request server and retry
link followed
https://www.moderndata.ai/2021/12/how-to-prevent-concurrent-pipeline-execution-in-azure-data-factory-or-azure-synapse-analytics-design-1/
Any idea why I am facing the above error.
enter image description here
The issue occurs when you run the pipeline using Debug option from the top tool bar. It would work fine if you will run it using Trigger Now option.
When you try to query using the Web API, it only query the non-debug pipeline runs, means only triggered runs. Therefore, run it using trigger.
I am creating Azure Elastic jobs agent and I am attaching a newly created, fresh Azure SQL Database with it, but when I execute the process it gives me this error
"error": {
"code": "DatabaseDoesNotExist",
"message": "Database 'mydatabase' does not exist."
}
Previously we were created it successfully
Update:
Actually, the issue was we were selecting the wrong database (hyperscale) type. When select the following tier it worked perfectly
I tried to deploy the same resource and it deployed successfully for me. Please find the screenshot for the same below. I just simply created the SQL server on Azure, then create a Database inside it and used the same database in Elastic Job.
As per the official document Troubleshoot common Azure deployment errors, the Conflict error occurs when:
You're requesting an operation that isn't allowed in the resource's
current state. For example, disk resizing is allowed only when
creating a VM or when the VM is deallocated.
You can check if your database has been deployed successfully without any error. And once it is deployed, you create the elastic job agent using that database. Make sure your database configuration match the elastic job requirement and you have appropriate permissions.
I am new to Azure and learning it. An error returned when I am trying to create SQL database in Azure.
{
"code": "InvalidDeploymentParameterValue",
"message": "The value of deployment parameter 'digestRegion' is null. Please specify the value or use the parameter reference. See https://aka.ms/resource-manager-parameter-files for details."
}
I am using an Azure free account and I checked the free account limit, it shows that 250 GB of Azure SQL Database standard S0 instance with 10 database transaction units is allowed.
I also tried to change the Sqlserver region to west, central, west2,west3, but the same error occurred.
When I checked the deployment template and search for "Region", the 'digestRegion' parameter is actually empty. I guess it should be the region name. Where should I find the applicable options?
I searched online for the error but had no luck. Thank you for any suggestions.
UPDATE:
I also posted this problem in the MS Azure Community and the problem would be solved by MS at the end of the day.
Thanks, The deployment for the fix is in progress and will be completed in couple of hours from now.
A transport-level error has occurred when receiving results from the server. (provider: Session Provider, error: 19 - Physical connection is not usable) - occurs intermittently, using hybrid connector to connect to on-premise database from Azure API
I try connecting to SQL database in on-premise sever from app service resource (Web API). Configured classic hybrid connection end point to on-premise db.
Root Cause :
In SQL database, there is a property 'Auto Close' in Options tab, which is set to TRUE by default.
When Azure Service(API) establishes connection to SQL server. Azure tries to maintain the same connection pool and try to reuse and reconnect to it.
As we have set 'Auto Close as TRUE', the SQL database clears the existing connection after sometime. Whereas Azure tries to reconnect with the earlier connection which has already been cleared by SQL database. This results in 'Physical Connection is not usable - error 19'.
SOLUTION:
In SQL db, go to database properties. Navigate to 'OPTIONS' page and expand automatic tab and set 'AUTO CLOSE' property as 'FALSE'.
Make sure you restart Azure app and your database server to ensure no old connections are used.
PROBLEM SOLVED.
NOTE : This is one of the reason (which happened to me).
Another useful method to get rid of this error is to use RETRY LOGIC of Entity Framework 1.1.0
services.AddDbContext<DbContext>(options => options.UseSqlServer('yourconnectionstring',
sqlServerOptionsAction: sqlOptions =>
{
sqlOptions.EnableRetryOnFailure(
maxRetryCount: 5,
maxRetryDelay: TimeSpan.FromSeconds(30),
errorNumbersToAdd: new List<int>() { 19 });
}));
In Retry logic, error 19 is not included. So you have to pass the error code 19 to set retry logic for error code 19.
It seems you need to add a retry logic to your Web API as explained here. The "Physical connection is not usable" error may be caused by transient errors as explained on this Microsoft documentation.
"Transient fault errors typically manifest as one of the following error messages from your client programs:+
•Database on server is not currently available. Please retry the connection later. If the problem persists, contact customer support, and provide them the session tracing ID of
•Database on server is not currently available. Please retry the connection later. If the problem persists, contact customer support, and provide them the session tracing ID of . (Microsoft SQL Server, Error: 40613)
•An existing connection was forcibly closed by the remote host.
•System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> System.Data.SqlClient.SqlException: A transport-level error has occurred when receiving results from the server. (provider: Session Provider, error: 19 - Physical connection is not usable)
•An connection attempt to a secondary database failed because the database is in the process of reconfguration and it is busy applying new pages while in the middle of an active transation on the primary database."