Skip to content Skip to sidebar Skip to footer

We Could Not Connect to the Database Specified Please Check the Database Name and Try Again

Skip to main content

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

APPLIES TO: Azure SQL Database Azure SQL Managed Case

Yous receive error letters when the connection to Azure SQL Database or Azure SQL Managed Case fails. These connectedness problems can be caused by reconfiguration, firewall settings, a connectedness timeout, incorrect login information, or failure to apply all-time practices and design guidelines during the application design process. Additionally, if the maximum limit on some Azure SQL Database or SQL Managed Instance resources is reached, y'all can no longer connect.

Transient error 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 beliefs might crusade your client program to lose its connectedness to the database or instance. This kind of mistake condition is chosen a transient fault. Database reconfiguration events occur because of a planned outcome (for instance, a software upgrade) or an unplanned outcome (for case, a process crash, or load balancing). Near reconfiguration events are generally short-lived and should be completed in less than 60 seconds at virtually. However, these events can occasionally take longer to stop, such as when a large transaction causes a long-running recovery. The post-obit table lists various transient errors that applications tin can receive when connecting to Azure SQL Database.

List of transient error 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 information.

This mistake may be logged on SQL Managed Case errorlog, for a short menstruum of time, during the final stage of a reconfiguration, while the old main is shutting downward its log.
Other, not-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, come across Errors 4000 to 4999
40197 17 The service has encountered an error processing your request. Please endeavor once more. Error lawmaking %d.

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

Reconnecting automatically connects y'all to a salubrious copy of your database. Your application must take hold of fault 40197, log the embedded error code (%d) within the message for troubleshooting, and try reconnecting to SQL Database until the resource are available, and your connection is established again. For more information, see Transient errors.

40501 xx The service is currently busy. Retry the asking after 10 seconds. Incident ID: %ls. Code: %d. 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 single databases
•  vCore-based limits for elastic pools
•  Azure SQL Managed Instance resource limits.
40613 17 Database '%.*ls' on server '%.*ls' is not currently available. Delight retry the connexion later. If the problem persists, contact customer support, and provide them the session tracing ID of '%.*ls'.

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

49918 xvi Cannot procedure request. Non enough resources to process request.

The service is currently decorated. Please retry the request later. For more than information, come across:
•  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.

49919 xvi Cannot process create or update request. Too 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 awaiting operations. Wait until pending create or update requests are complete or delete one of your awaiting requests and retry your request later. For more data, run across:
•  Logical SQL server resource limits
•  DTU-based limits for unmarried databases
•  DTU-based limits for rubberband pools
•  vCore-based limits for single databases
•  vCore-based limits for rubberband 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 resource optimization. Query sys.dm_operation_status for functioning status. Await until pending requests are complete or delete one of your pending requests and retry your request subsequently. For more information, run across:
•  Logical SQL server resources 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 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-flying 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 condition can be minimized past avoiding long write transactions on the primary.
615 21 Could not find database ID %d, name '%.*ls' . Error Code 615.
This means in-memory cache is not in-sync with SQL server instance and lookups are retrieving stale database ID.

SQL logins use in-retentiveness cache to get 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 instance occurs.
You receive this error when detach workflow neglect to make clean-up the in-retention cache on fourth dimension and subsequent lookups to the database point to stale database ID.

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

Steps to resolve transient connectivity bug

  1. Bank check the Microsoft Azure Service Dashboard for any known outages that occurred during the time during which the errors were reported past the application.
  2. Applications that connect to a cloud service such as Azure SQL Database should expect periodic reconfiguration events and implement retry logic to handle these errors instead of surfacing awarding errors to users.
  3. As a database approaches its resource limits, it tin seem to be a transient connectivity event. See Resource limits.
  4. If connectivity problems continue, 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 day, file an Azure support request by selecting Get Support on the Azure Support site.

Implementing Retry Logic

It is strongly recommended that your client programme has retry logic then that it could reestablish a connection after giving the transient mistake fourth dimension to right itself. We recommend that yous delay for v seconds before your start retry. Retrying after a filibuster shorter than five-seconds risks overwhelming the cloud service. For each subsequent retry the filibuster should grow exponentially, up to a maximum of lx seconds.

For code examples of retry logic, come across:

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

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

A give-and-take of the blocking period for clients that utilize ADO.Cyberspace is available in Connection Pooling (ADO.NET).

The upshot occurs if the awarding tin't connect to the server.

To resolve this issue, try the steps (in the guild presented) in the Steps to fix common connection issues section.

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

Error 26: Mistake Locating server specified

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

Error forty: Could not open up a connectedness to the server

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

Error 10053: A transport-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 connexion was aborted past 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 gild presented) in the Steps to gear up mutual connection problems section.

Cannot connect to server due to firewall issues

Error 40615: Cannot connect to < servername >

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

Error 5: Cannot connect to < servername >

To resolve this event, make certain that port 1433 is open up for outbound connections on all firewalls between the client and the cyberspace.

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

Login failed for user '< User proper 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 help. (Microsoft SQL Server, Fault: 18456)

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

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

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

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

                      SELECT proper name, is_disabled FROM sys.sql_logins;                                  
  3. If the corresponding name is disabled, enable it past using the post-obit statement:

                      ALTER LOGIN <User name> ENABLE;                                  
  4. If the SQL login user name doesn't exist, edit and run the post-obit 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, expand Databases.

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

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

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

                      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 part EXEC sp_addrolemember N'db_owner', N'<user_name, sysname, user_name>'; GO                                  

    Yous can likewise utilise sp_addrolemember to map specific users to specific database roles.

    Note

    In Azure SQL Database, consider the newer Alter Part syntax for managing database office membership.

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

Connection timeout expired errors

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

System.Data.SqlClient.SqlException (0x80131904): Connection Timeout Expired. The timeout menstruum elapsed while attempting to consume the pre-login handshake acknowledgement. This could be because the pre-login handshake failed or the server was unable to reply back in fourth dimension. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=iii; handshake=29995;

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

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

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

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

Cannot connect to < server name >

Cannot connect to <server name>.ADDITIONAL INFORMATION:Connection Timeout Expired. The timeout period elapsed during the postal service-login stage. The connexion could have timed out while waiting for server to consummate the login process and respond; Or information technology could accept timed out while attempting to create multiple active connections. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=231; handshake=983; [Login] initialization=0; authentication=0; [Postal service-Login] complete=13000; (Microsoft SQL Server, Error: -2) For help, click: http://get.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=-ii&LinkId=20476 The await operation timed out

These exceptions tin can occur either because of connexion or query issues. To confirm that this mistake is caused by connectivity problems, run across Confirm whether an error is caused by a connectivity issue.

Connection timeouts occur considering the application tin't connect to the server. To resolve this result, effort the steps (in the order presented) in the Steps to fix common connectedness issues section.

Resource governance errors

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

The most common resource governance errors are listed first with details, followed by a table of resources governance mistake letters.

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

The detailed mistake message in this case reads: Resource ID : 1. The request limit for the database is %d and has been reached. See 'http://go.microsoft.com/fwlink/?LinkId=267637' for aid.

This error 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.

Annotation

The initial offer of Azure SQL Database supported only single threaded queries. At that time, the number of requests was ever equivalent to the number of workers. Fault 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 really the number of workers. If your max caste of parallelism (MAXDOP) setting is equal to goose egg or is greater than one, 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 one.

Learn more about Sessions, workers, and requests.

Connect with the Dedicated Admin Connection (DAC) if needed

If a alive incident is ongoing where the worker limit has been approached or reached, you may receive Mistake 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) even when the maximum worker threshold has been reached.

To establish a connection with the DAC from SSMS:

  • From the bill of fare, select File > New > Database Engine Query
  • From the connection dialog box in the Server Name field, enter admin:<fully_qualified_server_name> (this will exist something like admin:servername.database.windows.net).
  • Select Options >>
  • Select the Connection Backdrop tab
  • In the Connect to database: box, type the proper noun of your database
  • Select Connect.

If yous receive Error 40613, Database '%.&#x2a;ls' on server '%.&#x2a;ls' is not currently available. Delight retry the connectedness afterwards. If the trouble persists, contact customer support, and provide them the session tracing ID of '%.&#x2a;ls', this may bespeak that another session is already connected to the DAC. Just 1 session may connect to the DAC for a single database or an elastic pool at a time.

If you encounter the error 'Failed to connect to server' after selecting Connect, the DAC session may nevertheless have been established successfully if you are using a version of SSMS prior to 18.9. Early versions of SSMS attempted to provide Intellisense for connections to the DAC. This failed, as the DAC supports only a unmarried worker and Intellisense requires a dissever worker.

You cannot utilize a DAC connection with Object Explorer.

Review your max_worker_percent usage

To detect resources consumption statistics for your database for 14 days, query the sys.resource_stats organization catalog view. The max_worker_percent column shows the percent of workers used relative to the worker limit for your database. Connect to the main 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 likewise 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 tin cause a sudden surge in the number of workers in a database. A large book of concurrent parallel queries may cause a loftier number of workers. Increasing your max degree of parallelism (MAXDOP) or setting MAXDOP to cypher can increase the number of active workers.

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

  1. Investigate if blocking is occurring or if you can place a large volume of concurrent workers. Run the following query to examine current requests and check for blocking when your database is returning Fault 10928. Y'all may demand to connect with the Defended Admin Connection (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) Equally 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) 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 every bit r JOIN sys.dm_exec_sessions as southward on r.session_id=s.session_id OUTER APPLY sys.dm_exec_input_buffer (r.session_id,r.request_id) AS i WHERE s.is_user_process=1; GO                                  
    1. Look for rows with a blocking_session_id to identify blocked sessions. Detect each blocking_session_id in the listing to determine if that session is also blocked. This volition somewhen lead you to the caput blocker. Tune the head blocker query.

    2. To place a large book of concurrent workers, review the number of requests overall and the worker_count column for each request. Worker_count is the number of workers at the time sampled and may change over fourth dimension 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, see Query Tuning/Hinting.

  2. Evaluate the maximum caste 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 calculation more resources to the database to increase the worker limit.

Notice resource limits for Azure SQL Database past service tier and compute size:

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

Learn more than about Azure SQL Database resource governance of workers.

Error 10929: Resource ID: one

10929: Resource ID: one. The %s minimum guarantee is %d, maximum limit is %d and the current usage for the database is %d. Nonetheless, the server is currently likewise busy to support requests greater than %d for this database. See http://go.microsoft.com/fwlink/?LinkId=267637 for assistance. Otherwise, please try again later.

Error 40501: The service is currently decorated

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

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

For more data near resources limits, see 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: <code>.

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

The following steps can either help you lot work effectually the trouble or provide you with more options:

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

    Note

    To identify which tables are consuming the nigh 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) * viii.0 / 1024 As 'Table Size (MB)' FROM sys.objects o JOIN sys.dm_db_partition_stats p on p.object_id = o.object_id Group Past o.name Social club BY [Table Size (MB)] DESC; GO                                  
  2. If the current size does non exceed the maximum size supported for your edition, you can employ Change DATABASE to increase the MAXSIZE setting.

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

    • Perform normal database cleanup activities. For instance, clean upwards the unwanted information by using truncate/delete, or move data out by using SQL Server Integration Services (SSIS) or the bulk copy programme (bcp) utility.
    • Partitioning or delete data, drop indexes, or consult the documentation for possible resolutions.
    • For database scaling, see Calibration single database resources and Scale rubberband pool resource.

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

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

If you repeatedly encounter this error, try to resolve the issue by post-obit these steps:

  1. Run the following query to see any open up sessions that have a loftier value for the duration_ms column:

                      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.control, 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, south.login_time, due south.login_name, southward.program_name, south.host_name FROM sys.dm_exec_requests as r Join sys.dm_exec_sessions as due south on r.session_id=south.session_id OUTER APPLY sys.dm_exec_input_buffer (r.session_id,r.request_id) AS i WHERE southward.is_user_process=1 Club BY start_time ASC; GO                                  

    You may choose to ignore rows where the input_buffer column 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 see if blocking is contributing to long-running transactions.

  3. Consider batching your queries. For data on batching, see How to utilize batching to ameliorate SQL Database application performance.

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

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

To work effectually this upshot, follow these steps:

  1. Change the queries to reduce temporary tabular array space usage.
  2. Drop temporary objects later 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 considering of excessive transaction log space usage. Try modifying fewer rows in a unmarried transaction.

To resolve this issue, endeavour the following methods:

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

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

    Note

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

Error 40553: The session has been terminated considering of excessive retentiveness usage

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

To work around this result, endeavour to optimize the query.

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

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

Table of resources governance fault letters

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

The Resources ID indicates the resources that has reached the limit. When Resource ID = ane, this indicates a worker limit has been reached. Learn more in Error 10928: Resources 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 virtually resource limits:
•  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 rubberband pools
•  Azure SQL Managed Example resource limits.

10929 20 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 besides busy to support requests greater than %d for this database. The Resources ID indicates the resource that has reached the limit. For worker threads, the Resources ID = one. For sessions, the Resources ID = 2. For more data, see:
•  Logical SQL server resource 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.
Otherwise, try once again later.
40544 20 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 unmarried database resources and Calibration elastic puddle resources.
40549 16 Session is terminated because you take a long-running transaction. Endeavour shortening your transaction. For data on batching, see How to apply batching to improve SQL Database awarding performance.
40550 xvi The session has been terminated because it has caused as well many locks. Try reading or modifying fewer rows in a unmarried transaction. For information on batching, run across How to use batching to better SQL Database awarding functioning.
40551 16 The session has been terminated because of excessive TEMPDB usage. Try modifying your query to reduce the temporary table space usage.

If you are using temporary objects, conserve space in the TEMPDB database by dropping temporary objects after they are no longer needed past the session. For more information on tempdb limits in SQL Database, meet Tempdb database in SQL Database.

40552 xvi The session has been terminated considering of excessive transaction log space usage. Attempt modifying fewer rows in a single transaction. For information on batching, encounter How to utilise batching to better SQL Database application functioning.

If you perform bulk inserts using the bcp.exe utility or the System.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 INDEX statement, try 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 memory usage. Try modifying your query to process fewer rows.

Reducing the number of ORDER By and Grouping BY operations in your Transact-SQL lawmaking reduces the retention requirements of your query. For database scaling, encounter Scale single database resources and Scale elastic pool resources. For more than data on out of memory errors and sample queries, see Troubleshoot out of memory errors with Azure SQL Database.

Rubberband puddle errors

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

Mistake lawmaking Severity Description Corrective action
1132 17 The elastic puddle 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 rubberband puddle 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 rubberband puddle if possible in order to increase its storage limit, reduce the storage used by individual databases within the elastic pool, or remove databases from the rubberband pool. For elastic puddle scaling, run into Scale elastic pool resources. For more than information on removing unused space from databases, see Manage file space for databases in Azure SQL Database.
10929 16 The %s minimum guarantee is %d, maximum limit is %d, and the current usage for the database is %d. Withal, the server is currently too decorated 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 rubberband pools.
Otherwise, try again later. DTU / vCore min per database; DTU / vCore max per database. The total number of concurrent workers across 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 guild to increase its worker limit, or remove databases from the elastic pool.
40844 xvi Database '%ls' on Server '%ls' is a '%ls' edition database in an elastic pool and cannot take a continuous copy relationship. N/A
40857 16 Rubberband pool not establish for server: '%ls', elastic pool name: '%ls'. Specified elastic pool does not exist in the specified server. Provide a valid rubberband pool name.
40858 16 Elastic pool '%ls' already exists in server: '%ls'. Specified elastic pool already exists in the specified server. Provide new rubberband pool proper noun.
40859 16 Elastic pool does not support service tier '%ls'. Specified service tier is not supported for elastic pool provisioning. Provide the correct edition or leave service tier blank to use the default service tier.
40860 16 Elastic pool '%ls' and service objective '%ls' combination is invalid. Rubberband pool and service tier can be specified together only if resource type is specified as 'ElasticPool'. Specify correct combination of rubberband 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 elastic pool service tier. Exercise not specify a database edition that is different than the elastic puddle service tier. Note that the database edition does not need to be specified.
40862 16 Elastic pool proper name must be specified if the elastic pool service objective is specified. Elastic pool service objective does not uniquely place an elastic pool. Specify the elastic puddle name if using the elastic pool service objective.
40864 16 The DTUs for the elastic pool must exist at least (%d) DTUs for service tier '%.*ls'. Attempting to set the DTUs for the rubberband puddle below the minimum limit. Retry setting the DTUs for the rubberband puddle to at to the lowest degree the minimum limit.
40865 xvi The DTUs for the elastic puddle cannot exceed (%d) DTUs for service tier '%.*ls'. Attempting to set the DTUs for the elastic pool to a higher place the maximum limit. Retry setting the DTUs for the rubberband pool to no greater than the maximum limit.
40867 xvi The DTU max per database must be 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 xvi The DTU max per database cannot exceed (%d) for service tier '%.*ls'. Attempting to set the DTU max per database beyond 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 across the supported limit. Consider using the rubberband puddle 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 rubberband 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 decrease the number of databases in the elastic pool.
40877 16 An elastic pool cannot be deleted unless it does not 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 database to elastic pool when the database count limit of the elastic pool has been reached. Consider increasing the DTUs of the elastic pool if possible in order to increase its database limit, or remove databases from the elastic pool.
40889 16 The DTUs or storage limit for the rubberband puddle '%.*ls' cannot be decreased since that would not provide sufficient storage infinite for its databases. Attempting to decrease 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 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 set the DTU min per database college than the DTU max per database. Ensure the DTU min per databases does non exceed the DTU max per database.
TBD 16 The storage size for an individual 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 past the elastic puddle service tier. Gear up the max size of the database within the limits of the max size allowed by the elastic puddle service tier.

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

This consequence occurs because the account doesn't have permission to admission the main database. But by default, SQL Server Management Studio (SSMS) tries to connect to the master database.

To resolve this outcome, follow these steps:

  1. On the login screen of SSMS, select Options, so select Connection Properties.

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

    Connection properties

Read-only errors

If you attempt to write to a database that is read-simply, yous'll receive an fault. In some scenarios, the cause of the database'southward read-just condition may non exist immediately clear.

Mistake 3906: Failed to update database "DatabaseName" because the database is read-only.

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

              Msg 3906, Level 16, State ii, Line one Failed to update database "%d" because the database is read-only.                          

You may be continued to a read-only replica

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

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

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

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

The database may exist set to read-only

If you're using Azure SQL Database, the database itself may have been set to read-only. You lot tin verify the database'south condition with the post-obit query:

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

You can alter the read-just condition for a database in Azure SQL Database using Modify DATABASE Transact-SQL. You can't currently set a database in a managed instance to read-only.

Confirm whether an mistake is caused past a connectivity event

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

              Arrangement.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`one 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, yous'll notice a call stack that's like to the following (note the reference to the SqlCommand class). In this situation, tune your queries.

                              at System.Data.SqlClient.SqlCommand.ExecuteReader()   at AzureConnectionTest.Program.Main(Cord[] args)   ClientConnectionId:<Client ID>                          

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

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

Steps to ready mutual connection issues

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

  2. Check the application'southward connectedness cord to brand sure it's configured correctly. For example, make sure that the connection string specifies the correct port (1433) and fully qualified server name. Come across 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 betwixt 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 issues and Diagnostics for connectivity bug.

    Note

    Every bit a troubleshooting step, you lot can also test connectivity on a dissimilar client reckoner.

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

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

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

Adjacent steps

Learn more about 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 Instance
  • Troubleshoot transient connection errors in SQL Database and SQL Managed Instance
  • Analyze and prevent deadlocks in Azure SQL Database

clarkprourne.blogspot.com

Source: https://docs.microsoft.com/en-us/azure/azure-sql/database/troubleshoot-common-errors-issues

Post a Comment for "We Could Not Connect to the Database Specified Please Check the Database Name and Try Again"