In this blog, we are going to cover Solved Azure SQL DB Connectivity Error You 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 information, or failure to apply best 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, you can no longer connect.
Topics we’ll cover :
- Transient Fault Error Messages
- Unable To Login Into Server
- Transaction Log Error
- Prevented Transaction Log Truncation
Troubleshoot Transient Fault Error Messages (40613, 40197, and others errors)
The Azure foundation can powerfully reconfigure workers when heavy responsibilities emerge in the SQL Database administration. This unique conduct may cause your customer program to lose its association with the data set or case. This sort of blunder condition is known as a transient fault. Database reconfiguration events happen in light of a planned event (for instance, a software upgrade ) or an unplanned event (for instance, load balancing and a process crash).
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 error log for more information.
This error may be logged on SQL Managed Instance error log, for a short period of time, during the last stage of a reconfiguration, while the old primary is shutting down its log.
|
4060 | 16 | Cannot open database “%.*ls” requested by the login. The login failed. |
40197 | 17 | 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 message of error 40197 provides additional information about 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. |
40501 | 20 | The service is currently busy. Retry the request after 10 seconds. Incident ID: %ls. Code: %d. |
40613 | 17 | Database ‘%.*ls’ on server ‘%.*ls’ is not currently available. Please retry the connection later. If the problem persists, contact customer support, and provide them the session tracing ID of ‘%.*ls’.
This error may occur if there is already an existing dedicated administrator connection (DAC) established to the database.
|
49918 | 16 | Cannot process request. Not enough resources to process requests. |
49919 | 16 | Cannot process create or update requests. Too many create or update operations in progress for subscription “%ld”. |
49920 | 16 | Cannot process request. Too many operations in progress for subscription “%ld”. |
A Network-Related Or Instance-Specific Error Occurred While Establishing A Connection To Your Server
To resolve this issue, try the steps (in the order presented) in the Steps to fix common connection issues section below.
Steps to fix common connection issues
- Make sure that TCP/IP is enabled as a client protocol on the application server. For more information, see Configure client protocols. On application servers where you don’t have SQL tools installed, verify that TCP/IP is enabled by running cliconfg.exe (SQL Server Client Network utility).
- Check the application’s connection string to make sure it’s configured correctly. For example, make sure that the connection string specifies the correct port (1433) and fully qualified server name. See Get connection information.
- Try increasing the connection timeout value. We recommend using a connection timeout of at least 30 seconds.
Unable To Login 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 support when you need assistance. (Microsoft SQL Server, Error: 18456)
To resolve this issue, contact your service administrator 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 by using SQL Server Management 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 name is disabled, enable it by using the following statement
ALTER LOGIN <User name> ENABLE;
4.) If the SQL login user 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 the database.
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, 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 user to the database owner role EXEC sp_addrolemember N'db_owner', N'<user_name, sysname, user_name>'; GO
Transaction Log Error
- You may see errors 9002 or 40552 when the transaction log is full and cannot accept new transactions. These errors occur when the database transaction log, managed by Azure SQL Database or Azure SQL Managed Instance, exceeds thresholds for space and cannot continue to accept transactions.
- These errors are similar to issues with a full transaction log in SQL Server but have different resolutions in Azure SQL Database or Azure SQL Managed Instance.
Prevented Transaction Log Truncation
To discover what is preventing log truncation in a given case, refer to log_reuse_wait_desc
in sys.databases
. The log reuse wait informs you as to what conditions or causes are preventing the transaction log from being truncated by a regular log backup. For more information, see sys. databases (Transact-SQL).
SELECT [name], log_reuse_wait_desc FROM sys.databases;
The following values of log_reuse_wait_desc
in sys.databases
may indicate the reason why the database’s transaction log truncation is being prevented:
PREVENTED TRANSACTION LOG TRUNCATION |
log_reuse_wait_desc | Diagnosis | Response required |
NOTHING | Typical state. There is nothing blocking the log from truncating. | No |
CHECKPOINT | A checkpoint is needed for log truncation. Rare. | No response is required unless sustained. |
LOG BACKUP | A log backup is in progress. | No response is required unless sustained. |
ACTIVE BACKUP OR RESTORE | A database backup is in progress. | No response is required unless sustained. |
ACTIVE TRANSACTION | An ongoing transaction is preventing log truncation. | The log file cannot be truncated due to active and/or uncommitted transactions. See next section. |
REPLICATION | In Azure SQL Database, likely due to change data capture (CDC) feature. In Azure SQL Managed Instances, due to replication or CDC. |
In Azure SQL Database, query sys.dm_cdc_errors and resolve errors. If unresolvable, file a support request with Azure Support.
In Azure SQL Managed Instance, if sustained, investigate agents involved with CDC or replication. For troubleshooting CDC, query jobs in msdb.dbo.cdc_jobs. If not present, add via sys.sp_cdc_add_job. For replication, consider Troubleshooting transactional replication. If unresolvable, file a support request with Azure Support. |
AVAILABILITY_REPLICA | Synchronization to the secondary replica is in progress. | No response is required unless sustained. |
Related/References
- Exam DP-300: Microsoft Azure Database Administrator Associate
- Microsoft Certified Azure Database Administrator Associate(Hands-On Labs)
- Azure SQL Deployment Options | SQL Managed Instance | SQL Database| SQL On VM
- Migrate SQL Server To Azure SQL Database
- Implement A High Availability And Disaster Recovery Environment
- Use External Table On Azure SQL Managed Instance To Read Data From Azure SQL Database
- Optimize Query Performance In SQL Server
Next Task For You
We will cover all the exam objectives related to how to perform migrations, Hands-On Labs, and practice tests in our Azure Database Administrator training program. If you want to begin your journey towards becoming a Microsoft Certified: Azure Database Administrator Associate by checking our FREE CLASS.
The post Solved Azure SQL DB Connectivity Error appeared first on Cloud Training Program.