Help: SQL Server

Sharing my knowlege about SQL Server Troubleshooting Skills

  • Blog Stats

    • 2,156,681 hits
  • Select GETDATE()

    March 2026
    M T W T F S S
     1
    2345678
    9101112131415
    16171819202122
    23242526272829
    3031  

AlwaysOn – How many databases can be added in Availability Group? Any hard limit?

Posted by blakhani on April 14, 2015


This is one of the common question asked. This blog has list of resources which can be useful in getting answer. First lets look at books online.

Prerequisites, Restrictions, and Recommendations for AlwaysOn Availability Groups (SQL Server)
http://msdn.microsoft.com/en-us/library/ff878487.aspx

Maximum number of availability groups and availability databases per computer: The actual number of databases and availability groups you can put on a computer (VM or physical) depends on the hardware and workload, but there is no enforced limit. Microsoft has extensively tested with 10 AGs and 100 DBs per physical machine. Signs of overloaded systems can include, but are not limited to, worker thread exhaustion, slow response times for AlwaysOn system views and DMVs, and/or stalled dispatcher system dumps. Please make sure to thoroughly test your environment with a production-like workload to ensure it can handle peak workload capacity within your application SLAs. When considering SLAs be sure to consider load under failure conditions as well as expected response times.

In general, the more databases that are replicated and the more secondary replicas that exist – the more worker threads and more memory that will be consumed just to have the AlwaysOn infrastructure.  As the text above indicates, there is no enforced limit, but the more you have the more worker threads and memory will be needed.   If there are insufficient worker threads you will probably see error messages in the SQL Error log similar to:

“The thread pool for AlwaysOn Availability Groups was unable to start a new worker thread because there are not enough available worker threads.  This may degrade AlwaysOn Availability Groups performance.  Use the "max worker threads" configuration option to increase number of allowable threads.”

If starved for memory, you could see many different error messages – that may or may not look like they relate to AlwaysOn. One possible message could be:

“Could not start the AlwaysOn Availability Groups transport manager. This failure probably occurred because a low memory condition existed when the message dispatcher started up. If so, other internal tasks might also have experienced errors. Check the SQL Server error log and the Windows error log for additional error messages. If a low memory condition exists, investigate and correct its cause.”

Here are other blogs which explain the number of threads in worker pool to support availability group.

AlwaysOn – HADRON Learning Series:  Worker Pool Usage for HADRON enabled databases
http://blogs.msdn.com/b/psssql/archive/2012/05/17/alwayson-hadron-learning-series-worker-pool-usage-for-hadron-enabled-databases.aspx

Monitoring SQL Server 2012 AlwaysOn Availability Groups Worker Thread Consumption
http://blogs.msdn.com/b/sql_pfe_blog/archive/2013/07/15/monitoring-sql-server-2012-alwayson-availability-groups-worker-thread-consumption.aspx

Hope this helps.

  • Cheers,
  • Balmukund Lakhani
  • Twitter @blakhani
  • Posted in AlwaysOn, SQL Server 2012, SQL Server 2014 | Tagged: , , , | Leave a Comment »

    SQL SERVER – SSMS Database Expand Hang – High waits on PREEMPTIVE_OS_LOOKUPACCOUNTSID

    Posted by blakhani on April 7, 2015


    Recently I have had a friend who reported below issues.

    1. When I expand database, it takes a lot of time.
    2. When I expand Jobs under SQL Server Agent node in SQL Server Management Studio, it freezes and finally it fails with error  
      “An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
      Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding”

    The symptom on the server that we were working on was that from Management Studio, when trying to browse SQL agent job, the interface would hang. I have asked to capture Profiler trace to find out which query is taking time and what is the waits for those query which are stuck.

    In profiler trace, and the query to capture currently running queries (refer this blog) I found that it was running sp_help_job stored procedure from MSDB database. This is the procedure to get high level details about all jobs in MSDB database using msdb.dbo.sysjobs_view. When we looked further, we found that SQL Server is running function dbo.SQLAGENT_SUSER_SNAME and got stuck at SELECT @ret = SUSER_SNAME(@user_sid) statement. The wait for the session is was PREEMPTIVE_OS_LOOKUPACCOUNTSID and wait time was increasing. This wait is related to the communication/validation from Active Directory.

    When we debugged further, here is the chain of reaching to function.

    sp_help_job  
                 >> sp_get_composite_job_info 
                         >> Query having – owner = dbo.SQLAGENT_SUSER_SNAME(sjv.owner_sid) 
                                    >>  SELECT @ret = SUSER_SNAME(@user_sid)

    This is getting stuck at PREEMPTIVE_OS_LOOKUPACCOUNTSID. We was identified that the function is used to convert SIDs stored in SQL Server table to the name by making call to Active Directory. Now the challenge was to find why and also was to identify if its happening with particular logins or all login. The complexity here was that SQL Server stores SID in varbinary format not in the format which OS would understand.

    Luckily, I have had a blog post having script to convert the varbinary to well known format. So I have used that to convert SIDs obtained from below query

    select    owner_sid 
    from    msdb.dbo.sysjobs_view
    where    owner_sid <> 0x01

     

    Once we have SID value in OS understandable format, I used PsGetSID tool from sysinternals to get Windows account name. While running that it was taking a long time and finally it failed with below error.

    Error querying SID:

    The trust relationship between the primary domain and the trusted domain failed

    So, it was something to do with two domains trust which seems to be broken. I asked him to work with this Windows Domain Admin team and networking team to get the issue resolved.

    Same issue might happen during database expand also as, database owner is a SID stored in sys.databases and that has to be converted to name.

    Hope this helps.

  • Cheers,
  • Balmukund Lakhani
  • Twitter @blakhani
  • Posted in SQL Server Management Studio, SSMS, Troubleshooting | Tagged: , | 4 Comments »

    SQL SERVER SETUP – The syntax of argument "/SKIPRULES" is incorrect

    Posted by blakhani on April 2, 2015


    While running SQL Server setup I have faced below error today. You may not get this error unless you run it from command line.

     

    here is the text of the message.

    TITLE: SQL Server Setup failure.
    ——————————
    SQL Server Setup has encountered the following error:

    The syntax of argument "/SKIPRULES" is incorrect. Either the delimiter ‘=’ is missing or there is one or more space characters before the delimiter ‘=’. Please use /? to check usage.
    Error code 0x84B40001.
    For help, click: http://go.microsoft.com/fwlink?LinkID=20476&ProdName=Microsoft%20SQL%20Server&EvtSrc=setup.rll&EvtID=50000&EvtType=0xCAE17AB9%25400x2841E06E%25401204%25401

    ——————————
    BUTTONS:
    OK
    ——————————

     

    Here is the command which I was trying

    setup.exe Action=/InstallFailoverCluster /SkipRules = "Cluster_VerifyForErrors"

    Error message is very clear in telling the problem with the command. If we read complete message with patience, it says there is a space. Here is the correct version of command. Note that I have removed space after SkipRules Parameter and “=”.

    setup.exe Action=/InstallFailoverCluster /SkipRules="Cluster_VerifyForErrors"

    The reason I have to go with command line setup is because I was not able to install SQL Cluster from UI and here was the message.

     

    Hope this helps.

    Posted in Error, Installation | Tagged: , , | Leave a Comment »