Troubleshooting connectivity issues and other errors with Azure SQL Database and Azure SQL Managed Instance

APPLIES TO: Azure SQL Database Azure SQL Managed Instance

You receive error letters when the connection to Azure SQL Database or Azure SQL Managed Case fails. These connection problems can be acquired past reconfiguration, firewall settings, a connection timeout, incorrect login information, or failure to apply best practices and design guidelines during the awarding blueprint procedure. Additionally, if the maximum limit on some Azure SQL Database or SQL Managed Instance resources is reached, you can no longer connect.

Transient fault error messages (40197, 40613 and others)

The Azure infrastructure has the ability to dynamically reconfigure servers when heavy workloads arise in the SQL Database service. This dynamic behavior might crusade your client program to lose its connection to the database or instance. This kind of fault status is called a transient fault. Database reconfiguration events occur considering of a planned event (for instance, a software upgrade) or an unplanned outcome (for example, a process crash, or load balancing). Nigh reconfiguration events are generally short-lived and should be completed in less than sixty seconds at most. All the same, these events can occasionally take longer to finish, such as when a big transaction causes a long-running recovery. The post-obit tabular array lists diverse transient errors that applications tin receive when connecting to Azure SQL Database.

List of transient fault error codes

Error code Severity Description
926 14 Database 'replicatedmaster' cannot be opened. It has been marked SUSPECT by recovery. See the SQL Server errorlog for more than information.

This error may be logged on SQL Managed Instance errorlog, for a short flow of fourth dimension, during the last stage of a reconfiguration, while the former primary is shutting down its log.
Other, non-transient scenarios involving this error message are described in the MSSQL Errors documentation.

4060 16 Cannot open database "%.*ls" requested by the login. The login failed. For more information, meet Errors 4000 to 4999
40197 17 The service has encountered an mistake processing your asking. Please try again. Error lawmaking %d.

Yous receive this error when the service is downwards due to software or hardware upgrades, hardware failures, or any other failover problems. The fault code (%d) embedded inside the bulletin of fault 40197 provides additional information nearly the kind of failure or failover that occurred. Some examples of the error codes are embedded within the message of error 40197 are 40020, 40143, 40166, and 40540.

Reconnecting automatically connects you to a healthy copy of your database. Your application must catch error 40197, log the embedded error code (%d) within the bulletin for troubleshooting, and endeavor reconnecting to SQL Database until the resource are bachelor, and your connection is established once more. For more information, come across Transient errors.

40501 20 The service is currently busy. Retry the request afterwards ten seconds. Incident ID: %ls. Code: %d. For more data, run into:
•  Logical SQL server resource limits
•  DTU-based limits for single databases
•  DTU-based limits for elastic pools
•  vCore-based limits for single databases
•  vCore-based limits for elastic pools
•  Azure SQL Managed Instance resource limits.
40613 17 Database '%.*ls' on server '%.*ls' is non currently available. Please retry the connectedness afterward. If the problem persists, contact customer back up, and provide them the session tracing ID of '%.*ls'.

This mistake may occur if there is already an existing defended ambassador connection (DAC) established to the database. For more information, encounter Transient errors.

49918 16 Cannot process asking. Non plenty resources to procedure request.

The service is currently busy. Delight retry the request later. For more data, see:
•  Logical SQL server resource limits
•  DTU-based limits for single databases
•  DTU-based limits for elastic pools
•  vCore-based limits for single databases
•  vCore-based limits for elastic pools
•  Azure SQL Managed Instance resources limits.

49919 xvi Cannot procedure create or update request. Besides many create or update operations in progress for subscription "%ld".

The service is busy processing multiple create or update requests for your subscription or server. Requests are currently blocked for resource optimization. Query sys.dm_operation_status for pending operations. Expect until pending create or update requests are consummate or delete 1 of your pending requests and retry your request later. For more information, meet:
•  Logical SQL server resource limits
•  DTU-based limits for unmarried databases
•  DTU-based limits for elastic pools
•  vCore-based limits for single databases
•  vCore-based limits for elastic pools
•  Azure SQL Managed Instance resources limits.

49920 16 Cannot process request. Too many operations in progress for subscription "%ld".

The service is busy processing multiple requests for this subscription. Requests are currently blocked for resources optimization. Query sys.dm_operation_status for functioning status. Wait until pending requests are consummate or delete i of your awaiting requests and retry your asking later. For more data, run into:
•  Logical SQL server resources limits
•  DTU-based limits for single databases
•  DTU-based limits for rubberband pools
•  vCore-based limits for single databases
•  vCore-based limits for elastic pools
•  Azure SQL Managed Instance resource limits.

4221 16 Login to read-secondary failed due to long wait on 'HADR_DATABASE_WAIT_FOR_TRANSITION_TO_VERSIONING'. The replica is non available for login considering row versions are missing for transactions that were in-flight when the replica was recycled. The issue can be resolved by rolling back or committing the active transactions on the principal replica. Occurrences of this condition tin be minimized past avoiding long write transactions on the primary.
615 21 Could not observe database ID %d, name '%.*ls' . Mistake Code 615.
This means in-memory enshroud is not in-sync with SQL server instance and lookups are retrieving dried database ID.

SQL logins use in-memory cache to go the database proper name to ID mapping. The cache should be in sync with backend database and updated whenever attach and disassemble of database to/from the SQL server instance occurs.
Yous receive this error when detach workflow fail to clean-upward the in-memory cache on fourth dimension and subsequent lookups to the database point to stale database ID.

Effort reconnecting to SQL Database until the resources are available, and the connection is established over again. For more than data, encounter Transient errors.

Steps to resolve transient connectivity problems

  1. Check the Microsoft Azure Service Dashboard for any known outages that occurred during the time during which the errors were reported by the application.
  2. Applications that connect to a deject service such as Azure SQL Database should look periodic reconfiguration events and implement retry logic to handle these errors instead of surfacing application errors to users.
  3. As a database approaches its resource limits, it tin can seem to exist a transient connectivity issue. See Resource limits.
  4. If connectivity issues keep, or if the duration for which your application encounters the error exceeds 60 seconds or if you see multiple occurrences of the error in a given solar day, file an Azure support request past selecting Get Support on the Azure Support site.

Implementing Retry Logic

It is strongly recommended that your customer program has retry logic and so that it could reestablish a connectedness afterwards giving the transient fault time to correct itself. We recommend that you filibuster for 5 seconds before your first retry. Retrying after a filibuster shorter than 5-seconds risks overwhelming the cloud service. For each subsequent retry the filibuster should grow exponentially, up to a maximum of 60 seconds.

For code examples of retry logic, run across:

  • Connect resiliently to SQL with ADO.NET
  • Connect resiliently to SQL with PHP

For additional information on handling transient errors in your awarding review Troubleshooting transient connectedness errors to SQL Database

A discussion of the blocking period for clients that employ ADO.Net is bachelor in Connectedness Pooling (ADO.Internet).

The issue occurs if the application tin can't connect to the server.

To resolve this event, try the steps (in the club presented) in the Steps to set common connectedness issues section.

The server/instance was not found or was non accessible (errors 26, 40, 10053)

Error 26: Fault Locating server specified

System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connectedness to SQL Server. The server was not plant or was not accessible. Verify that the instance proper noun is correct and that SQL Server is configured to permit remote connections.(provider: SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified)

Mistake xl: Could not open a connection to the server

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not plant or was not attainable. Verify that the instance name is right and that SQL Server is configured to let remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connectedness to SQL Server)

Error 10053: A ship-level error has occurred when receiving results from the server

10053: A transport-level error has occurred when receiving results from the server. (Provider: TCP Provider, error: 0 - An established connectedness was aborted by the software in your host automobile)

These issues occur if the application tin can't connect to the server.

To resolve these issues, try the steps (in the order presented) in the Steps to gear up mutual connection issues section.

Cannot connect to server due to firewall issues

Fault 40615: Cannot connect to < servername >

To resolve this outcome, configure firewall settings on SQL Database through the Azure portal.

Error 5: Cannot connect to < servername >

To resolve this issue, brand sure that port 1433 is open for outbound connections on all firewalls between the client and the internet.

Unable to log in to the server (errors 18456, 40531)

Login failed for user '< User name >'

Login failed for user '<User name>'.This session has been assigned a tracing ID of '<Tracing ID>'. Provide this tracing ID to customer back up when you need assist. (Microsoft SQL Server, Error: 18456)

To resolve this issue, contact your service administrator to provide y'all with a valid user name and password.

Typically, the service administrator can use the following steps to add together the login credentials:

  1. Log in to the server by using SQL Server Direction Studio (SSMS).

  2. Run the following SQL query in the master database to check whether the login name is disabled:

                      SELECT name, is_disabled FROM sys.sql_logins;                                  
  3. If the corresponding proper name is disabled, enable it by using the following argument:

                      ALTER LOGIN <User name> ENABLE;                                  
  4. If the SQL login user proper name doesn't exist, edit and run the following SQL query to create a new SQL login:

                      CREATE LOGIN <SQL_login_name, sysname, login_name> WITH Password = '<countersign, sysname, Change_Password>'; Get                                  
  5. In SSMS Object Explorer, aggrandize Databases.

  6. Select the database that you lot want to grant the user permission to.

  7. Correct-click Security, and then select New, User.

  8. In the generated script with placeholders (sample shown beneath), replace template parameters by following the steps here and execute it:

                      CREATE USER [<user_name, sysname, user_name>] FOR LOGIN [<login_name, sysname, login_name>] WITH DEFAULT_SCHEMA = [<default_schema, sysname, dbo>]; Become  -- Add user to the database possessor role EXEC sp_addrolemember North'db_owner', N'<user_name, sysname, user_name>'; GO                                  

    You can likewise use sp_addrolemember to map specific users to specific database roles.

    Note

    In Azure SQL Database, consider the newer ALTER ROLE syntax for managing database role membership.

For more information, meet Managing databases and logins in Azure SQL Database.

Connection timeout expired errors

Organisation.Data.SqlClient.SqlException (0x80131904): Connection Timeout Expired

Organization.Information.SqlClient.SqlException (0x80131904): Connection Timeout Expired. The timeout period elapsed while attempting to swallow the pre-login handshake acknowledgement. This could be considering the pre-login handshake failed or the server was unable to respond back in time. The elapsing spent while attempting to connect to this server was - [Pre-Login] initialization=iii; handshake=29995;

Arrangement.Data.SqlClient.SqlException (0x80131904): Timeout expired

System.Information.SqlClient.SqlException (0x80131904): Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

System.Information.Entity.Cadre.EntityException: The underlying provider failed on Open up

System.Data.Entity.Cadre.EntityException: The underlying provider failed on Open. -> System.Data.SqlClient.SqlException: Timeout expired. The timeout menstruation elapsed prior to completion of the functioning or the server is not responding. -> System.ComponentModel.Win32Exception: The wait functioning timed out

Cannot connect to < server name >

Cannot connect to <server name>.ADDITIONAL Information:Connection Timeout Expired. The timeout menses elapsed during the post-login phase. The connectedness could have timed out while waiting for server to complete the login process and respond; Or it could have timed out while attempting to create multiple agile connections. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=231; handshake=983; [Login] initialization=0; hallmark=0; [Post-Login] consummate=13000; (Microsoft SQL Server, Fault: -2) For assist, click: http://get.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=-two&LinkId=20476 The wait operation timed out

These exceptions tin occur either because of connectedness or query issues. To confirm that this error is caused by connectivity issues, see Confirm whether an error is caused past a connectivity issue.

Connectedness timeouts occur considering the application tin't connect to the server. To resolve this issue, try the steps (in the order presented) in the Steps to prepare common connection issues section.

Resource governance errors

Azure SQL Database uses a resource governance implementation based on Resource Governor to enforce resource limits. Learn more near resource management in Azure SQL Database.

The most common resource governance errors are listed offset with details, followed by a table of resource governance mistake messages.

Error 10928: Resource ID : 1. The request limit for the database is %d and has been reached.

The detailed error bulletin in this case reads: Resource ID : i. The asking limit for the database is %d and has been reached. See 'http://go.microsoft.com/fwlink/?LinkId=267637' for assistance.

This mistake message indicates that the worker limit for Azure SQL Database has been reached. A value will be present instead of the placeholder %d. This value indicates the worker limit for your database at the time the limit was reached.

Note

The initial offering of Azure SQL Database supported only single threaded queries. At that fourth dimension, the number of requests was e'er equivalent to the number of workers. Fault message 10928 in Azure SQL Database contains the diction "The request limit for the database is North and has been reached" for backwards compatibility purposes. The limit reached is actually the number of workers. If your max degree of parallelism (MAXDOP) setting is equal to zero or is greater than one, the number of workers may be much higher than the number of requests, and the limit may be reached much sooner than when MAXDOP is equal to one.

Acquire more than well-nigh Sessions, workers, and requests.

Connect with the Dedicated Admin Connection (DAC) if needed

If a live incident is ongoing where the worker limit has been approached or reached, you may receive Mistake 10928 when y'all connect using SQL Server Management Studio (SSMS) or Azure Data Studio. One session can connect using the Diagnostic Connection for Database Administrators (DAC) even when the maximum worker threshold has been reached.

To plant a connection with the DAC from SSMS:

  • From the menu, select File > New > Database Engine Query
  • From the connection dialog box in the Server Proper name field, enter admin:<fully_qualified_server_name> (this volition exist something like admin:servername.database.windows.net).
  • Select Options >>
  • Select the Connection Properties tab
  • In the Connect to database: box, type the name of your database
  • Select Connect.

If y'all receive Error 40613, Database '%.&#x2a;ls' on server '%.&#x2a;ls' is non currently available. Please retry the connexion later. If the problem persists, contact customer support, and provide them the session tracing ID of '%.&#x2a;ls', this may betoken that another session is already connected to the DAC. Only ane session may connect to the DAC for a single database or an elastic pool at a time.

If you encounter the fault 'Failed to connect to server' after selecting Connect, the DAC session may still accept been established successfully if you are using a version of SSMS prior to xviii.nine. Early versions of SSMS attempted to provide Intellisense for connections to the DAC. This failed, as the DAC supports merely a single worker and Intellisense requires a separate worker.

You cannot apply a DAC connection with Object Explorer.

Review your max_worker_percent usage

To notice resources consumption statistics for your database for 14 days, query the sys.resource_stats organisation catalog view. The max_worker_percent cavalcade shows the pct of workers used relative to the worker limit for your database. Connect to the master database on your logical server to query sys.resource_stats.

              SELECT start_time, end_time, database_name, sku, avg_cpu_percent, max_worker_percent, max_session_percent  FROM sys.resource_stats;                          

You tin can besides query resource consumption statistics from the last hour from the sys.dm_db_resource_stats dynamic management view. Connect directly to your database to query sys.dm_db_resource_stats.

              SELECT end_time, avg_cpu_percent, max_worker_percent, max_session_percent FROM sys.dm_db_resource_stats;                          

Lower worker usage when possible

Blocking bondage can crusade a sudden surge in the number of workers in a database. A large volume of concurrent parallel queries may cause a high number of workers. Increasing your max degree of parallelism (MAXDOP) or setting MAXDOP to nix tin can increase the number of active workers.

Triage an incident with insufficient workers by following these steps:

  1. Investigate if blocking is occurring or if yous can place a big volume of concurrent workers. Run the following query to examine current requests and check for blocking when your database is returning Error 10928. Y'all may demand to connect with the Dedicated Admin Connectedness (DAC) to execute the query.

                      SELECT     r.session_id, r.request_id, r.blocking_session_id, r.start_time,      r.status, r.command, DB_NAME(r.database_id) As database_name,     (SELECT COUNT(*)          FROM sys.dm_os_tasks Every bit t          WHERE t.session_id=r.session_id and t.request_id=r.request_id) As worker_count,     i.parameters, i.event_info As input_buffer,     r.last_wait_type, r.open_transaction_count, r.total_elapsed_time, r.cpu_time,     r.logical_reads, r.writes, s.login_time, s.login_name, s.program_name, s.host_name FROM sys.dm_exec_requests equally r Bring together sys.dm_exec_sessions as s on r.session_id=south.session_id OUTER APPLY sys.dm_exec_input_buffer (r.session_id,r.request_id) Every bit i WHERE s.is_user_process=ane; GO                                  
    1. Look for rows with a blocking_session_id to place blocked sessions. Find each blocking_session_id in the list to decide if that session is also blocked. This will eventually lead you lot to the head blocker. Melody the head blocker query.

    2. To identify a large book of concurrent workers, review the number of requests overall and the worker_count cavalcade for each request. Worker_count is the number of workers at the fourth dimension sampled and may modify over time every bit the request is executed. Tune queries to reduce resource utilization if the cause of increased workers is concurrent queries that are running at their optimal degree of parallelism. For more information, see Query Tuning/Hinting.

  2. Evaluate the maximum degree of parallelism (MAXDOP) setting for the database.

Increment worker limits

If the database consistently reaches its limit despite addressing blocking, optimizing queries, and validating your MAXDOP setting, consider calculation more than resource to the database to increase the worker limit.

Observe resource limits for Azure SQL Database by service tier and compute size:

  • Resource limits for single databases using the vCore purchasing model
  • Resource limits for elastic pools using the vCore purchasing model
  • Resource limits for unmarried databases using the DTU purchasing model
  • Resources limits for elastic pools using the DTU purchasing model

Learn more nigh Azure SQL Database resource governance of workers.

Mistake 10929: Resource ID: ane

10929: Resource ID: 1. The %south minimum guarantee is %d, maximum limit is %d and the current usage for the database is %d. However, the server is currently too decorated to support requests greater than %d for this database. Meet http://go.microsoft.com/fwlink/?LinkId=267637 for assist. Otherwise, please try once more later.

Error 40501: The service is currently decorated

40501: The service is currently busy. Retry the request after 10 seconds. Incident ID: %ls. Lawmaking: %d.

This is an engine throttling error, an indication that resources limits are being exceeded.

For more information about resource limits, see Logical SQL server resources limits.

Error 40544: The database has reached its size quota

40544: The database has reached its size quota. Segmentation or delete data, drop indexes, or consult the documentation for possible resolutions. Incident ID: <ID>. Code: <code>.

This fault occurs when the database has reached its size quota.

The following steps tin can either help you lot work around the problem or provide you with more options:

  1. Bank check the current size of the database by using the dashboard in the Azure portal.

    Annotation

    To identify which tables are consuming the most space and are therefore potential candidates for cleanup, run the post-obit SQL query:

                      SELECT o.name,  SUM(p.row_count) AS 'Row Count',  SUM(p.reserved_page_count) * eight.0 / 1024 AS 'Tabular array Size (MB)' FROM sys.objects o Join sys.dm_db_partition_stats p on p.object_id = o.object_id GROUP BY o.name Gild Past [Tabular array Size (MB)] DESC; GO                                  
  2. If the current size does non exceed the maximum size supported for your edition, you lot can use ALTER DATABASE to increase the MAXSIZE setting.

  3. If the database is already by the maximum supported size for your edition, try 1 or more of the following steps:

    • Perform normal database cleanup activities. For example, clean up the unwanted data past using truncate/delete, or move data out by using SQL Server Integration Services (SSIS) or the bulk copy program (bcp) utility.
    • Division or delete information, drop indexes, or consult the documentation for possible resolutions.
    • For database scaling, see Scale unmarried database resources and Calibration elastic pool resources.

Mistake 40549: Session is terminated because you have a long-running transaction

40549: Session is terminated because you have a long-running transaction. Endeavour shortening your transaction.

If you lot repeatedly encounter this error, effort to resolve the upshot by following these steps:

  1. Run the following query to see any open sessions that have a high value for the duration_ms cavalcade:

                      SELECT     r.start_time, DATEDIFF(ms,start_time, SYSDATETIME()) every bit duration_ms,  	r.session_id, r.request_id, r.blocking_session_id,       r.status, r.command, DB_NAME(r.database_id) As database_name,     i.parameters, i.event_info Equally input_buffer,     r.last_wait_type, r.open_transaction_count, r.total_elapsed_time, r.cpu_time,     r.logical_reads, r.writes, due south.login_time, due south.login_name, s.program_name, s.host_name FROM sys.dm_exec_requests as r Bring together sys.dm_exec_sessions as s on r.session_id=southward.session_id OUTER APPLY sys.dm_exec_input_buffer (r.session_id,r.request_id) AS i WHERE s.is_user_process=one ORDER By start_time ASC; GO                                  

    You may choose to ignore rows where the input_buffer cavalcade shows a query reading from sys.fn_MSxe_read_event_stream: these requests are related to Extended Event sessions.

  2. Review the blocking_session_id column to meet if blocking is contributing to long-running transactions.

  3. Consider batching your queries. For information on batching, come across How to employ batching to improve SQL Database application performance.

Error 40551: The session has been terminated because of excessive TEMPDB usage

40551: The session has been terminated considering of excessive TEMPDB usage. Attempt modifying your query to reduce the temporary table space usage.

To piece of work around this issue, follow these steps:

  1. Change the queries to reduce temporary table space usage.
  2. Drop temporary objects later on they're no longer needed.
  3. Truncate tables or remove unused tables.

Error 40552: The session has been terminated considering of excessive transaction log space usage

40552: The session has been terminated because of excessive transaction log space usage. Effort modifying fewer rows in a single transaction.

To resolve this issue, try the following methods:

  • The issue can occur because of insert, update, or delete operations. Try to reduce the number of rows that are operated on immediately past implementing batching or splitting into multiple smaller transactions.

  • The upshot tin occur because of index rebuild operations. To work around this issue, make sure the number of rows that are affected in the table * (average size of field that's updated in bytes + fourscore) < 2 gigabytes (GB).

    Note

    For an alphabetize rebuild, the boilerplate size of the field that'due south updated should exist substituted by the average alphabetize size.

Error 40553: The session has been terminated because of excessive memory usage

40553: The session has been terminated because of excessive memory usage. Try modifying your query to procedure fewer rows.

To piece of work effectually this issue, try to optimize the query.

For an in-depth troubleshooting procedure, see Is my query running fine in the cloud?.

For more information on other out of retention errors and sample queries, meet Troubleshoot out of memory errors with Azure SQL Database.

Tabular array of resource governance error letters

Error lawmaking Severity Description
10928 20 Resource ID: %d. The %s limit for the database is %d and has been reached. See 'http://become.microsoft.com/fwlink/?LinkId=267637' for assistance..

The Resource ID indicates the resource that has reached the limit. When Resource ID = 1, this indicates a worker limit has been reached. Larn more in Error 10928: Resource ID : 1. The request limit for the database is %d and has been reached. When Resource ID = 2, this indicates the session limit has been reached.

Learn more about resource limits:
•  Logical SQL server resources limits
•  DTU-based limits for unmarried databases
•  DTU-based limits for rubberband pools
•  vCore-based limits for single databases
•  vCore-based limits for elastic pools
•  Azure SQL Managed Instance resource limits.

10929 20 Resource ID: %d. The %southward minimum guarantee is %d, maximum limit is %d, and the electric current usage for the database is %d. Even so, the server is currently besides busy to support requests greater than %d for this database. The Resource ID indicates the resource that has reached the limit. For worker threads, the Resource ID = i. For sessions, the Resource ID = 2. For more information, encounter:
•  Logical SQL server resource limits
•  DTU-based limits for unmarried databases
•  DTU-based limits for elastic pools
•  vCore-based limits for single databases
•  vCore-based limits for elastic pools
•  Azure SQL Managed Instance resource limits.
Otherwise, try once more later.
40544 twenty The database has reached its size quota. Partition or delete data, drop indexes, or consult the documentation for possible resolutions. For database scaling, see Calibration single database resources and Scale elastic pool resources.
40549 xvi Session is terminated because you have a long-running transaction. Try shortening your transaction. For information on batching, see How to use batching to improve SQL Database application operation.
40550 16 The session has been terminated because it has acquired also many locks. Endeavour reading or modifying fewer rows in a single transaction. For information on batching, encounter How to use batching to improve SQL Database application performance.
40551 16 The session has been terminated because of excessive TEMPDB usage. Try modifying your query to reduce the temporary table space usage.

If y'all are using temporary objects, conserve space in the TEMPDB database by dropping temporary objects subsequently they are no longer needed by the session. For more than information on tempdb limits in SQL Database, see Tempdb database in SQL Database.

40552 16 The session has been terminated because of excessive transaction log infinite usage. Try modifying fewer rows in a single transaction. For information on batching, see How to use batching to improve SQL Database application performance.

If you perform majority inserts using the bcp.exe utility or the Organization.Data.SqlClient.SqlBulkCopy class, try using the -b batchsize or BatchSize options to limit the number of rows copied to the server in each transaction. If you are rebuilding an index with the ALTER Alphabetize argument, attempt using the REBUILD WITH ONLINE = ON option. For data on transaction log sizes for the vCore purchasing model, see:
•  vCore-based limits for single databases
•  vCore-based limits for elastic pools
•  Azure SQL Managed Case resource limits.

40553 16 The session has been terminated because of excessive retentivity usage. Endeavor modifying your query to process fewer rows.

Reducing the number of ORDER By and GROUP By operations in your Transact-SQL code reduces the memory requirements of your query. For database scaling, meet Scale single database resources and Scale elastic puddle resource. For more data on out of memory errors and sample queries, come across Troubleshoot out of retention errors with Azure SQL Database.

Elastic pool errors

The following errors are related to creating and using elastic pools:

Error code Severity Description Corrective action
1132 17 The elastic pool has reached its storage limit. The storage usage for the elastic pool cannot exceed (%d) MBs. Attempting to write data to a database when the storage limit of the elastic pool has been reached. For information on resource limits, see:
•  DTU-based limits for elastic pools
•  vCore-based limits for elastic pools.
Consider increasing the DTUs of and/or adding storage to the elastic pool if possible in gild to increase its storage limit, reduce the storage used by individual databases within the elastic puddle, or remove databases from the elastic pool. For elastic pool scaling, see Scale elastic pool resources. For more information on removing unused infinite from databases, come across Manage file infinite for databases in Azure SQL Database.
10929 16 The %s minimum guarantee is %d, maximum limit is %d, and the electric current usage for the database is %d. Yet, the server is currently besides busy to support requests greater than %d for this database. For information on resource limits, see:
•  DTU-based limits for elastic pools
•  vCore-based limits for elastic pools.
Otherwise, attempt over again later. DTU / vCore min per database; DTU / vCore max per database. The total number of concurrent workers across all databases in the rubberband pool attempted to exceed the pool limit.
Consider increasing the DTUs or vCores of the rubberband puddle if possible in order to increase its worker limit, or remove databases from the rubberband pool.
40844 16 Database '%ls' on Server '%ls' is a '%ls' edition database in an elastic puddle and cannot have a continuous re-create relationship. North/A
40857 16 Elastic pool non institute for server: '%ls', elastic puddle name: '%ls'. Specified rubberband pool does non exist in the specified server. Provide a valid elastic pool name.
40858 16 Elastic pool '%ls' already exists in server: '%ls'. Specified elastic pool already exists in the specified server. Provide new elastic pool proper noun.
40859 xvi Rubberband pool does not support service tier '%ls'. Specified service tier is not supported for rubberband puddle provisioning. Provide the correct edition or exit service tier blank to apply the default service tier.
40860 sixteen Elastic puddle '%ls' and service objective '%ls' combination is invalid. Elastic pool and service tier can be specified together only if resource blazon is specified as 'ElasticPool'. Specify correct combination of elastic pool and service tier.
40861 16 The database edition '%.*ls' cannot be different than the elastic pool service tier which is '%.*ls'. The database edition is different than the rubberband pool service tier. Do non specify a database edition that is unlike than the elastic pool service tier. Annotation that the database edition does not need to be specified.
40862 xvi Rubberband pool name must be specified if the rubberband puddle service objective is specified. Elastic pool service objective does not uniquely identify an rubberband pool. Specify the rubberband pool name if using the elastic puddle service objective.
40864 sixteen The DTUs for the elastic pool must be at least (%d) DTUs for service tier '%.*ls'. Attempting to prepare the DTUs for the elastic pool below the minimum limit. Retry setting the DTUs for the rubberband pool to at least the minimum limit.
40865 16 The DTUs for the elastic pool cannot exceed (%d) DTUs for service tier '%.*ls'. Attempting to set the DTUs for the elastic pool above the maximum limit. Retry setting the DTUs for the elastic pool to no greater than the maximum limit.
40867 sixteen The DTU max per database must exist at least (%d) for service tier '%.*ls'. Attempting to set the DTU max per database beneath the supported limit. Consider using the rubberband pool service tier that supports the desired setting.
40868 16 The DTU max per database cannot exceed (%d) for service tier '%.*ls'. Attempting to prepare the DTU max per database across the supported limit. Consider using the elastic pool service tier that supports the desired setting.
40870 xvi The DTU min per database cannot exceed (%d) for service tier '%.*ls'. Attempting to set the DTU min per database beyond the supported limit. Consider using the elastic pool service tier that supports the desired setting.
40873 16 The number of databases (%d) and DTU min per database (%d) cannot exceed the DTUs of the elastic pool (%d). Attempting to specify DTU min for databases in the elastic pool that exceeds the DTUs of the elastic pool. Consider increasing the DTUs of the elastic pool, or decrease the DTU min per database, or subtract the number of databases in the elastic pool.
40877 16 An elastic pool cannot be deleted unless it does non contain any databases. The elastic pool contains one or more databases and therefore cannot be deleted. Remove databases from the elastic pool in order to delete it.
40881 16 The elastic pool '%.*ls' has reached its database count limit. The database count limit for the elastic pool cannot exceed (%d) for an elastic pool with (%d) DTUs. Attempting to create or add together database to elastic pool when the database count limit of the rubberband puddle has been reached. Consider increasing the DTUs of the rubberband pool if possible in order to increase its database limit, or remove databases from the elastic puddle.
40889 16 The DTUs or storage limit for the rubberband pool '%.*ls' cannot be decreased since that would not provide sufficient storage infinite for its databases. Attempting to decrease the storage limit of the elastic puddle below its storage usage. Consider reducing the storage usage of private databases in the rubberband pool or remove databases from the puddle in order to reduce its DTUs or storage limit.
40891 16 The DTU min per database (%d) cannot exceed the DTU max per database (%d). Attempting to gear up the DTU min per database higher than the DTU max per database. Ensure the DTU min per databases does not exceed the DTU max per database.
TBD xvi The storage size for an individual database in an elastic pool cannot exceed the max size allowed by '%.*ls' service tier rubberband pool. The max size for the database exceeds the max size allowed by the elastic pool service tier. Fix the max size of the database inside the limits of the max size allowed by the elastic puddle service tier.

Cannot open up database "master" requested past the login. The login failed

This upshot occurs because the account doesn't accept permission to access the master database. Only by default, SQL Server Direction Studio (SSMS) tries to connect to the master database.

To resolve this issue, follow these steps:

  1. On the login screen of SSMS, select Options, and then select Connection Backdrop.

  2. In the Connect to database field, enter the user's default database name as the default login database, and so select Connect.

    Connection properties

Read-but errors

If you attempt to write to a database that is read-merely, yous'll receive an error. In some scenarios, the cause of the database's read-only condition may not exist immediately clear.

Error 3906: Failed to update database "DatabaseName" because the database is read-merely.

When attempting to modify a read-only database, the following error will be raised.

              Msg 3906, Level 16, State 2, Line ane Failed to update database "%d" because the database is read-simply.                          

You lot may exist connected to a read-merely replica

For both Azure SQL Database and Azure SQL Managed Example, yous may exist connected to a database on a read-only replica. In this case, the following query using the DATABASEPROPERTYEX() function will return READ_ONLY:

              SELECT DATABASEPROPERTYEX(DB_NAME(), 'Updateability'); GO                          

If you're connecting using SQL Server Management Studio, verify if you have specified ApplicationIntent=ReadOnly in the Additional Connection Parameters tab on your connection options.

If the connection is from an application or a client using a connection string, validate if the connection string has specified ApplicationIntent=ReadOnly. Learn more in Connect to a read-simply replica.

The database may be gear up to read-only

If yous're using Azure SQL Database, the database itself may have been ready to read-only. Y'all can verify the database'southward status with the following query:

              SELECT name, is_read_only FROM sys.databases WHERE database_id = DB_ID();                          

Yous can modify the read-only status for a database in Azure SQL Database using ALTER DATABASE Transact-SQL. You tin't currently set up a database in a managed instance to read-just.

Confirm whether an error is acquired by a connectivity effect

To confirm whether an error is caused by a connectivity issue, review the stack trace for frames that bear witness calls to open up a connection similar the post-obit ones (note the reference to the SqlConnection class):

              Organization.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)  at System.Data.SqlClient.SqlConnection.Open()  at AzureConnectionTest.Program.Main(String[] args) ClientConnectionId:<Client connection ID>                          

When the exception is triggered by query issues, you lot'll notice a call stack that's similar to the following (note the reference to the SqlCommand class). In this situation, tune your queries.

                              at Organisation.Data.SqlClient.SqlCommand.ExecuteReader()   at AzureConnectionTest.Program.Principal(String[] args)   ClientConnectionId:<Client ID>                          

For additional guidance on fine-tuning performance, see the following resources:

  • How to maintain Azure SQL indexes and statistics
  • Manual tune query functioning in Azure SQL Database
  • Monitoring functioning Azure SQL Database past using dynamic management views
  • Operating the Query Store in Azure SQL Database

Steps to set common connection issues

  1. Make sure that TCP/IP is enabled as a customer protocol on the application server. For more data, see Configure client protocols. On awarding servers where y'all don't have SQL tools installed, verify that TCP/IP is enabled by running cliconfg.exe (SQL Server Client Network utility).

  2. Bank check the awarding's connection string to make sure information technology's configured correctly. For example, brand sure that the connexion string specifies the correct port (1433) and fully qualified server name. See Get connection information.

  3. Attempt increasing the connection timeout value. We recommend using a connection timeout of at least xxx seconds.

  4. Test the connectivity between the application server and the Azure SQL Database by using SQL Server Direction Studio (SSMS), a UDL file, ping, or telnet. For more information, see Troubleshooting connectivity problems and Diagnostics for connectivity issues.

    Note

    As a troubleshooting step, you can also test connectivity on a different client computer.

  5. Every bit a best practice, brand sure that the retry logic is in place. For more information about retry logic, see Troubleshoot transient faults and connexion errors to SQL Database.

If these steps don't resolve your problem, endeavor to collect more data and and so contact back up. If your application is a cloud service, enable logging. This stride returns a UTC time postage of the failure. Additionally, SQL Database returns the tracing ID. Microsoft Customer Support Services can use this information.

For more information about how to enable logging, see Enable diagnostics logging for apps in Azure App Service.

Side by side steps

Learn more most related topics in the post-obit articles:

  • Azure SQL Database connectivity architecture
  • Azure SQL Database and Azure Synapse Analytics network access controls
  • Troubleshooting transaction log errors with Azure SQL Database and Azure SQL Managed Instance
  • Troubleshoot transient connectedness errors in SQL Database and SQL Managed Instance
  • Analyze and prevent deadlocks in Azure SQL Database