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

APPLIES TO: Azure SQL Database Azure SQL Managed Case

You lot receive error messages when the connection to Azure SQL Database or Azure SQL Managed Instance fails. These connection problems can be caused by reconfiguration, firewall settings, a connection timeout, incorrect login data, or failure to apply best practices and pattern guidelines during the application design procedure. Additionally, if the maximum limit on some Azure SQL Database or SQL Managed Instance resources is reached, you tin 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 error condition is called a transient error. Database reconfiguration events occur considering of a planned effect (for instance, a software upgrade) or an unplanned event (for instance, a process crash, or load balancing). Nigh reconfiguration events are generally short-lived and should be completed in less than 60 seconds at most. However, these events tin occasionally accept longer to end, such as when a large transaction causes a long-running recovery. The following table lists various transient errors that applications can receive when connecting to Azure SQL Database.

List of transient error error codes

Fault code Severity Clarification
926 14 Database 'replicatedmaster' cannot be opened. It has been marked Doubtable by recovery. Run into the SQL Server errorlog for more than data.

This error may exist logged on SQL Managed Example errorlog, for a short period of time, during the last stage of a reconfiguration, while the sometime primary is shutting downwards its log.
Other, non-transient scenarios involving this mistake bulletin are described in the MSSQL Errors documentation.

4060 16 Cannot open database "%.*ls" requested past the login. The login failed. For more information, see Errors 4000 to 4999
40197 17 The service has encountered an fault processing your request. Delight endeavour once again. Error code %d.

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

Reconnecting automatically connects you lot to a healthy copy of your database. Your application must take hold of error 40197, log the embedded error code (%d) within the message for troubleshooting, and try reconnecting to SQL Database until the resources are available, and your connexion is established once more. For more than information, run across Transient errors.

40501 20 The service is currently busy. Retry the request after 10 seconds. Incident ID: %ls. Code: %d. For more than information, come across:
•  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.
40613 17 Database '%.*ls' on server '%.*ls' is not currently bachelor. Please retry the connection subsequently. If the problem persists, contact customer support, and provide them the session tracing ID of '%.*ls'.

This mistake may occur if at that place is already an existing defended administrator connectedness (DAC) established to the database. For more information, run across Transient errors.

49918 16 Cannot process asking. Not enough resources to process asking.

The service is currently busy. Please retry the asking later on. 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 resource limits.

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

The service is decorated processing multiple create or update requests for your subscription or server. Requests are currently blocked for resource optimization. Query sys.dm_operation_status for awaiting operations. Wait until pending create or update requests are complete or delete one of your pending requests and retry your request later. For more information, come across:
•  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 rubberband pools
•  Azure SQL Managed Instance resource limits.

49920 xvi Cannot process asking. Too many operations in progress for subscription "%ld".

The service is decorated processing multiple requests for this subscription. Requests are currently blocked for resource optimization. Query sys.dm_operation_status for operation status. Wait until pending requests are complete or delete one of your pending requests and retry your request after. For more information, see:
•  Logical SQL server resource limits
•  DTU-based limits for single databases
•  DTU-based limits for elastic pools
•  vCore-based limits for unmarried databases
•  vCore-based limits for elastic pools
•  Azure SQL Managed Instance resource limits.

4221 16 Login to read-secondary failed due to long look on 'HADR_DATABASE_WAIT_FOR_TRANSITION_TO_VERSIONING'. The replica is not available for login because 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 agile transactions on the principal replica. Occurrences of this status tin can be minimized past avoiding long write transactions on the primary.
615 21 Could not find database ID %d, proper name '%.*ls' . Fault Lawmaking 615.
This means in-memory cache is non in-sync with SQL server instance and lookups are retrieving stale database ID.

SQL logins use in-memory cache to go the database name to ID mapping. The cache should be in sync with backend database and updated whenever attach and detach of database to/from the SQL server case occurs.
Yous receive this mistake when detach workflow fail to clean-upwards the in-retentivity cache on time and subsequent lookups to the database betoken to dried database ID.

Try reconnecting to SQL Database until the resource are available, and the connexion is established again. For more than information, see Transient errors.

Steps to resolve transient connectivity issues

  1. Bank check the Microsoft Azure Service Dashboard for any known outages that occurred during the time during which the errors were reported by the awarding.
  2. Applications that connect to a deject service such as Azure SQL Database should expect 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 can seem to be a transient connectivity issue. Run into Resource limits.
  4. If connectivity problems continue, or if the duration for which your application encounters the error exceeds 60 seconds or if y'all run across multiple occurrences of the mistake in a given mean solar day, file an Azure back up asking by selecting Become Support on the Azure Support site.

Implementing Retry Logic

It is strongly recommended that your client program has retry logic so that it could reestablish a connectedness after giving the transient fault fourth dimension to correct itself. We recommend that you delay for 5 seconds before your kickoff retry. Retrying after a delay shorter than v-seconds risks overwhelming the cloud service. For each subsequent retry the filibuster should grow exponentially, upwards to a maximum of 60 seconds.

For lawmaking examples of retry logic, encounter:

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

For additional information on handling transient errors in your application review Troubleshooting transient connection errors to SQL Database

A discussion of the blocking period for clients that employ ADO.Internet is available in Connection Pooling (ADO.NET).

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

To resolve this outcome, try the steps (in the social club presented) in the Steps to prepare mutual connection issues department.

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

Error 26: Mistake Locating server specified

Organisation.Data.SqlClient.SqlException: A network-related or case-specific fault occurred while establishing a connection to SQL Server. The server was not plant 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, mistake: 26 – Fault Locating Server/Instance Specified)

Fault 40: Could not open up a connection to the server

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

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

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

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

To resolve these issues, try the steps (in the order presented) in the Steps to fix mutual connectedness issues section.

Cannot connect to server due to firewall issues

Error 40615: Cannot connect to < servername >

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

Error v: Cannot connect to < servername >

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

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

Login failed for user '< User name >'

Login failed for user '<User proper noun>'.This session has been assigned a tracing ID of '<Tracing ID>'. Provide this tracing ID to customer support when you need assistance. (Microsoft SQL Server, Mistake: 18456)

To resolve this result, contact your service administrator to provide you with a valid user name and password.

Typically, the service administrator tin utilize the following steps to add the login credentials:

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

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

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

                      Modify 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 = '<password, sysname, Change_Password>'; GO                                  
  5. In SSMS Object Explorer, expand Databases.

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

  7. Right-click Security, and so select New, User.

  8. In the generated script with placeholders (sample shown below), supervene upon template parameters by following the steps hither and execute it:

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

    You tin can also 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 function membership.

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

Connection timeout expired errors

System.Information.SqlClient.SqlException (0x80131904): Connection Timeout Expired

Arrangement.Data.SqlClient.SqlException (0x80131904): Connexion Timeout Expired. The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement. This could exist considering the pre-login handshake failed or the server was unable to respond dorsum in time. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=3; handshake=29995;

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

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

Arrangement.Data.Entity.Core.EntityException: The underlying provider failed on Open

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

Cannot connect to < server name >

Cannot connect to <server name>.Boosted INFORMATION:Connexion Timeout Expired. The timeout period elapsed during the mail service-login stage. The connection could take timed out while waiting for server to complete the login procedure and respond; Or information technology could have timed out while attempting to create multiple active connections. The elapsing spent while attempting to connect to this server was - [Pre-Login] initialization=231; handshake=983; [Login] initialization=0; authentication=0; [Post-Login] complete=13000; (Microsoft SQL Server, Error: -2) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=-2&LinkId=20476 The wait operation timed out

These exceptions tin can occur either considering of connection or query problems. To confirm that this fault is caused by connectivity issues, run into Ostend whether an fault is caused by a connectivity issue.

Connection timeouts occur because the application can't connect to the server. To resolve this outcome, try the steps (in the order presented) in the Steps to fix common connection issues section.

Resources governance errors

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

The almost common resource governance errors are listed first with details, followed past a tabular array of resource governance error messages.

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

The detailed fault message in this case reads: Resources ID : 1. The request limit for the database is %d and has been reached. Come across 'http://get.microsoft.com/fwlink/?LinkId=267637' for assistance.

This fault message indicates that the worker limit for Azure SQL Database has been reached. A value will exist 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 offer of Azure SQL Database supported merely single threaded queries. At that time, the number of requests was always equivalent to the number of workers. Error message 10928 in Azure SQL Database contains the wording "The request limit for the database is Northward and has been reached" for backwards compatibility purposes. The limit reached is actually the number of workers. If your max caste of parallelism (MAXDOP) setting is equal to zero or is greater than i, the number of workers may be much higher than the number of requests, and the limit may exist reached much sooner than when MAXDOP is equal to ane.

Acquire more most Sessions, workers, and requests.

Connect with the Defended Admin Connection (DAC) if needed

If a live incident is ongoing where the worker limit has been approached or reached, you may receive Error 10928 when you connect using SQL Server Management Studio (SSMS) or Azure Data Studio. I session tin can connect using the Diagnostic Connection for Database Administrators (DAC) fifty-fifty when the maximum worker threshold has been reached.

To establish a connection with the DAC from SSMS:

  • From the carte, select File > New > Database Engine Query
  • From the connection dialog box in the Server Name field, enter admin:<fully_qualified_server_name> (this will be something like admin:servername.database.windows.internet).
  • Select Options >>
  • Select the Connection Properties tab
  • In the Connect to database: box, blazon the name of your database
  • Select Connect.

If yous receive Mistake 40613, Database '%.&#x2a;ls' on server '%.&#x2a;ls' is not currently available. Please retry the connection afterward. If the problem persists, contact customer support, and provide them the session tracing ID of '%.&#x2a;ls', this may indicate that another session is already connected to the DAC. Only i session may connect to the DAC for a unmarried database or an elastic pool at a time.

If you encounter the error 'Failed to connect to server' subsequently selecting Connect, the DAC session may however accept been established successfully if you lot are using a version of SSMS prior to 18.9. Early on versions of SSMS attempted to provide Intellisense for connections to the DAC. This failed, equally the DAC supports only a single worker and Intellisense requires a split up worker.

You lot cannot employ a DAC connection with Object Explorer.

Review your max_worker_percent usage

To detect resource consumption statistics for your database for xiv days, query the sys.resource_stats organization catalog view. The max_worker_percent column shows the percentage 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 can also query resource consumption statistics from the concluding hour from the sys.dm_db_resource_stats dynamic management view. Connect direct 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 chains tin can cause 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 caste of parallelism (MAXDOP) or setting MAXDOP to zero can increase the number of active workers.

Triage an incident with insufficient workers past post-obit these steps:

  1. Investigate if blocking is occurring or if you tin place a large book of concurrent workers. Run the post-obit query to examine current requests and check for blocking when your database is returning Error 10928. You lot 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.control, DB_NAME(r.database_id) Every bit database_name,     (SELECT COUNT(*)          FROM sys.dm_os_tasks AS t          WHERE t.session_id=r.session_id and t.request_id=r.request_id) Equally 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, southward.login_time, s.login_name, s.program_name, s.host_name FROM sys.dm_exec_requests equally r JOIN sys.dm_exec_sessions every bit s on r.session_id=southward.session_id OUTER Use sys.dm_exec_input_buffer (r.session_id,r.request_id) AS i WHERE southward.is_user_process=i; Get                                  
    1. Wait for rows with a blocking_session_id to identify blocked sessions. Observe each blocking_session_id in the listing to determine if that session is too blocked. This volition eventually pb you to the head blocker. Tune the head blocker query.

    2. To identify a large volume 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 time sampled and may change over time as the request is executed. Melody 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, meet Query Tuning/Hinting.

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

Increase worker limits

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

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

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

Learn more about Azure SQL Database resource governance of workers.

Mistake 10929: Resource ID: 1

10929: Resource ID: 1. The %s minimum guarantee is %d, maximum limit is %d and the electric current usage for the database is %d. However, the server is currently too busy to support requests greater than %d for this database. See http://go.microsoft.com/fwlink/?LinkId=267637 for help. Otherwise, delight endeavor again later.

Error 40501: The service is currently decorated

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

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

For more information about resource limits, come across Logical SQL server resource limits.

Error 40544: The database has reached its size quota

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

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

The following steps can either help yous work around the problem or provide y'all with more options:

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

    Note

    To identify which tables are consuming the about space and are therefore potential candidates for cleanup, run the following SQL query:

                      SELECT o.name,  SUM(p.row_count) As 'Row Count',  SUM(p.reserved_page_count) * 8.0 / 1024 Every bit 'Table Size (MB)' FROM sys.objects o JOIN sys.dm_db_partition_stats p on p.object_id = o.object_id Grouping Past o.name ORDER By [Table Size (MB)] DESC; Get                                  
  2. If the electric current size does not exceed the maximum size supported for your edition, y'all tin apply ALTER DATABASE to increase the MAXSIZE setting.

  3. If the database is already past the maximum supported size for your edition, attempt i or more than of the following steps:

    • Perform normal database cleanup activities. For example, clean up the unwanted data by using truncate/delete, or move data out by using SQL Server Integration Services (SSIS) or the majority copy program (bcp) utility.
    • Partition or delete data, driblet indexes, or consult the documentation for possible resolutions.
    • For database scaling, encounter Scale single database resources and Scale rubberband pool resource.

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

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

If you repeatedly run across this error, attempt to resolve the outcome by following these steps:

  1. Run the following query to run across whatsoever open sessions that have a high value for the duration_ms column:

                      SELECT     r.start_time, DATEDIFF(ms,start_time, SYSDATETIME()) as 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 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, due south.login_name, southward.program_name, s.host_name FROM sys.dm_exec_requests as r Bring together sys.dm_exec_sessions as s on r.session_id=s.session_id OUTER APPLY sys.dm_exec_input_buffer (r.session_id,r.request_id) AS i WHERE due south.is_user_process=1 ORDER BY start_time ASC; Become                                  

    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 Result sessions.

  2. Review the blocking_session_id cavalcade to run across if blocking is contributing to long-running transactions.

  3. Consider batching your queries. For data on batching, encounter How to use batching to improve SQL Database application performance.

Mistake 40551: The session has been terminated considering of excessive TEMPDB usage

40551: The session has been terminated because of excessive TEMPDB usage. Try modifying your query to reduce the temporary table infinite usage.

To work around this result, follow these steps:

  1. Alter the queries to reduce temporary table infinite usage.
  2. Drop temporary objects afterwards they're no longer needed.
  3. Truncate tables or remove unused tables.

Mistake 40552: The session has been terminated because of excessive transaction log space usage

40552: The session has been terminated considering of excessive transaction log space usage. Try modifying fewer rows in a unmarried transaction.

To resolve this upshot, try the following methods:

  • The outcome 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 issue can occur because of index rebuild operations. To work effectually this outcome, brand certain the number of rows that are affected in the table * (average size of field that'south updated in bytes + 80) < 2 gigabytes (GB).

    Note

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

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

40553: The session has been terminated considering of excessive retentiveness usage. Endeavor modifying your query to procedure fewer rows.

To work around this issue, try to optimize the query.

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

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

Table of resource governance error messages

Fault code Severity Description
10928 twenty Resource ID: %d. The %s limit for the database is %d and has been reached. Run across 'http://go.microsoft.com/fwlink/?LinkId=267637' for assistance..

The Resources ID indicates the resource that has reached the limit. When Resources 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.

Acquire more nearly resource limits:
•  Logical SQL server resources 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.

10929 twenty Resource ID: %d. The %s minimum guarantee is %d, maximum limit is %d, and the current usage for the database is %d. However, the server is currently also decorated 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 = 1. For sessions, the Resource ID = ii. For more than 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 rubberband pools
•  Azure SQL Managed Example resources limits.
Otherwise, try once again later.
40544 twenty The database has reached its size quota. Partition or delete data, driblet indexes, or consult the documentation for possible resolutions. For database scaling, see Scale single database resources and Scale elastic puddle resource.
40549 sixteen Session is terminated because you have a long-running transaction. Try shortening your transaction. For information on batching, see How to utilise batching to amend SQL Database awarding performance.
40550 16 The session has been terminated because information technology has acquired as well many locks. Endeavor reading or modifying fewer rows in a single transaction. For information on batching, meet How to utilise batching to meliorate SQL Database application performance.
40551 16 The session has been terminated considering of excessive TEMPDB usage. Endeavour modifying your query to reduce the temporary table infinite usage.

If yous are using temporary objects, conserve space in the TEMPDB database by dropping temporary objects after they are no longer needed by the session. For more data 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 unmarried transaction. For information on batching, come across How to utilize batching to meliorate SQL Database application operation.

If yous perform bulk inserts using the bcp.exe utility or the System.Data.SqlClient.SqlBulkCopy class, endeavor using the -b batchsize or BatchSize options to limit the number of rows copied to the server in each transaction. If yous are rebuilding an index with the ALTER INDEX statement, endeavor using the REBUILD WITH ONLINE = ON pick. For information on transaction log sizes for the vCore purchasing model, encounter:
•  vCore-based limits for single databases
•  vCore-based limits for elastic pools
•  Azure SQL Managed Example resource limits.

40553 16 The session has been terminated considering of excessive retention usage. Try modifying your query to process fewer rows.

Reducing the number of Gild By and GROUP BY operations in your Transact-SQL lawmaking reduces the retentiveness requirements of your query. For database scaling, encounter Scale single database resources and Calibration rubberband puddle resource. For more information on out of memory errors and sample queries, see Troubleshoot out of retentivity errors with Azure SQL Database.

Elastic puddle errors

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

Fault code Severity Description Corrective activity
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 puddle has been reached. For information on resources limits, encounter:
•  DTU-based limits for elastic pools
•  vCore-based limits for elastic pools.
Consider increasing the DTUs of and/or adding storage to the rubberband pool if possible in social club to increase its storage limit, reduce the storage used past individual databases within the elastic puddle, or remove databases from the elastic pool. For elastic pool scaling, see Calibration elastic pool resource. For more information on removing unused space from databases, see Manage file space for databases in Azure SQL Database.
10929 xvi The %due 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. For information on resources limits, see:
•  DTU-based limits for rubberband pools
•  vCore-based limits for elastic pools.
Otherwise, try again later. DTU / vCore min per database; DTU / vCore max per database. The full number of concurrent workers beyond all databases in the elastic pool attempted to exceed the pool limit.
Consider increasing the DTUs or vCores of the elastic pool if possible in order to increase its worker limit, or remove databases from the rubberband puddle.
40844 16 Database '%ls' on Server '%ls' is a '%ls' edition database in an elastic puddle and cannot have a continuous copy relationship. N/A
40857 16 Rubberband pool not found for server: '%ls', elastic pool name: '%ls'. Specified elastic pool does non be in the specified server. Provide a valid elastic puddle proper noun.
40858 xvi Elastic pool '%ls' already exists in server: '%ls'. Specified elastic pool already exists in the specified server. Provide new elastic pool name.
40859 16 Elastic pool does not support service tier '%ls'. Specified service tier is not supported for rubberband pool provisioning. Provide the right edition or exit service tier blank to employ the default service tier.
40860 xvi Elastic pool '%ls' and service objective '%ls' combination is invalid. Elastic pool and service tier can be specified together only if resource type is specified as 'ElasticPool'. Specify correct combination of elastic pool and service tier.
40861 16 The database edition '%.*ls' cannot be different than the rubberband pool service tier which is '%.*ls'. The database edition is different than the elastic pool service tier. Do not specify a database edition that is different than the rubberband puddle service tier. Note that the database edition does not need to be specified.
40862 xvi Elastic pool name must exist specified if the rubberband puddle service objective is specified. Elastic pool service objective does not uniquely identify an elastic pool. Specify the elastic puddle proper name if using the elastic pool service objective.
40864 16 The DTUs for the elastic puddle must exist at least (%d) DTUs for service tier '%.*ls'. Attempting to set the DTUs for the elastic pool below the minimum limit. Retry setting the DTUs for the elastic 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 rubberband pool above the maximum limit. Retry setting the DTUs for the rubberband pool to no greater than the maximum limit.
40867 sixteen The DTU max per database must be at least (%d) for service tier '%.*ls'. Attempting to set up 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 beyond the supported limit. Consider using the elastic pool service tier that supports the desired setting.
40870 16 The DTU min per database cannot exceed (%d) for service tier '%.*ls'. Attempting to fix the DTU min per database across 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 puddle (%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 rubberband puddle.
40877 16 An elastic pool cannot exist deleted unless it does not comprise whatever databases. The rubberband puddle contains i or more than databases and therefore cannot be deleted. Remove databases from the elastic puddle in order to delete information technology.
40881 sixteen The elastic pool '%.*ls' has reached its database count limit. The database count limit for the rubberband pool cannot exceed (%d) for an elastic pool with (%d) DTUs. Attempting to create or add database to elastic pool when the database count limit of the elastic pool has been reached. Consider increasing the DTUs of the elastic puddle if possible in social club to increase its database limit, or remove databases from the elastic pool.
40889 16 The DTUs or storage limit for the elastic pool '%.*ls' cannot be decreased since that would not provide sufficient storage space for its databases. Attempting to subtract the storage limit of the elastic pool below its storage usage. Consider reducing the storage usage of individual databases in the elastic pool or remove databases from the pool in guild 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 set the DTU min per database college than the DTU max per database. Ensure the DTU min per databases does not exceed the DTU max per database.
TBD 16 The storage size for an private database in an elastic pool cannot exceed the max size allowed by '%.*ls' service tier elastic pool. The max size for the database exceeds the max size allowed by the rubberband puddle service tier. Set the max size of the database within the limits of the max size allowed by the elastic pool service tier.

Cannot open database "master" requested by the login. The login failed

This result occurs because the business relationship doesn't have permission to admission the master database. But by default, SQL Server Management 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 Connectedness Properties.

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

    Connection properties

Read-only errors

If you attempt to write to a database that is read-only, y'all'll receive an error. In some scenarios, the cause of the database's read-just status may non be immediately clear.

Error 3906: Failed to update database "DatabaseName" considering the database is read-only.

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

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

You may be continued to a read-only replica

For both Azure SQL Database and Azure SQL Managed Instance, you may be continued to a database on a read-only replica. In this case, the post-obit query using the DATABASEPROPERTYEX() function will render READ_ONLY:

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

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

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

The database may be ready to read-just

If you're using Azure SQL Database, the database itself may take been set to read-only. You can verify the database'south status with the following query:

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

You tin modify the read-but status for a database in Azure SQL Database using ALTER DATABASE Transact-SQL. You lot tin't currently ready a database in a managed example to read-only.

Confirm whether an fault is acquired by a connectivity issue

To confirm whether an error is caused by a connectivity issue, review the stack trace for frames that show calls to open a connexion like the following ones (note the reference to the SqlConnection class):

              System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)  at Arrangement.Information.SqlClient.SqlConnection.Open()  at AzureConnectionTest.Program.Main(Cord[] args) ClientConnectionId:<Client connexion ID>                          

When the exception is triggered past query issues, you'll detect a phone call stack that's similar to the following (note the reference to the SqlCommand class). In this situation, melody your queries.

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

For additional guidance on fine-tuning operation, run into the following resource:

  • How to maintain Azure SQL indexes and statistics
  • Manual tune query performance in Azure SQL Database
  • Monitoring performance Azure SQL Database by using dynamic management views
  • Operating the Query Shop in Azure SQL Database

Steps to ready common connexion issues

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

  2. Cheque the application'south connectedness cord to brand sure it's configured correctly. For case, brand certain that the connection string specifies the correct port (1433) and fully qualified server name. See Become connectedness data.

  3. Try increasing the connection timeout value. Nosotros recommend using a connection timeout of at to the lowest degree xxx seconds.

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

    Note

    As a troubleshooting step, y'all tin can also test connectivity on a different client calculator.

  5. As a best practice, make certain that the retry logic is in place. For more information about retry logic, see Troubleshoot transient faults and connection errors to SQL Database.

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

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

Next steps

Learn more than nigh related topics in the following 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 Example
  • Troubleshoot transient connection errors in SQL Database and SQL Managed Instance
  • Analyze and prevent deadlocks in Azure SQL Database