Category: Data

Posts about data platforms, SQL Server, databases, Azure SQL, analytics, and data engineering.

  • QnA: Performance Dashboard Webcast

    I had an overflow of questions during the webcast today and wasn’t able to answer a few as we ran short of time. I shall attempt to address the most common questions asked during the webcast.

    How do I configure SQL Server Performance Dashboards?
    SQL Server Performance Dashboard was originally released for SQL Server 2005. Setup instructions are available with the download link. However, the same install can be tweaked to work for SQL Server 2008 and SQL Server 2008 R2 using the blog post by Sudarshan: Configuring Performance Dashboard for SQL Server 2008
    Download link: SQL Server 2005 Performance Dashboard

    The SQL Server instance being monitored must be running SQL Server 2005 SP2 or later. After completing the installation, you must:
    1. Run the Setup.sql file on each instance of SQL Server 200x that you wish to monitor with the SQL Server 2005 Performance Dashboard Reports.
    2. Open the performance_dashboard_main.rdl file with the Custom Reports functionality new to Management Studio in SQL Sever 2005 Service Pack 2.

    Does Performance Dashboard work for SQL Server 2000?
    No, Performance Dashboard uses DMVs to generate the data for the reports which are available from SQL Server 2005 and higher.

    Where can I get the presentation and webcast recording?
    The presentation and webcast recording for the entire webcast series will be made available on the SQLServerFAQ MSDN blog. I shall post an update once both are available.

    What is the performance impact of running these reports?
    If your server is unresponsive or experiencing high CPU usage on all the processors, then these reports will also face issues while retrieving diagnostic data from the DMVs. However, the overall impact of running this reports on a SQL Server instance is very minimal as compared to any other performance diagnostic tool.

    Can these reports be used on SQL Azure or any other RDBMS?
    No, they cannot be used to monitor SQL Azure databases or any other non-SQL Server RDMBS environment.

    What permissions are required for using Performance Dashboard?
    You need to have VIEW SERVER STATE permission to view all the information exposed by Performance Dashboard as most of the information is collected from DMVs.

    Can these reports be deployed to a local shared repository?
    You can use Visual Studio and create custom reports similar to the Performance Dashboard reports or modify the existing reports as per your needs and deploy them. Be advised, that this will be a customized solution and not supported by CSS w.r.t. performance issues while running these reports or configuration issues.

    Lastly, thank you for attending the session! And for your patience.

    In case there are more questions, please feel free to add a comment and I shall reply back accordingly.

    Cheers!

     

  • The case of the obnoxious locks value

    Yesterday I worked with Argenis [Blog | Twitter] regarding an interesting startup failure for a SQL Server standalone instance.

    The error in the SQL Errorlog was:

    2011-03-30 14:43:18.46 Server      Large Page Extensions enabled.
    2011-03-30 14:43:18.46 Server      Large Page Granularity: 2097152
    2011-03-30 14:43:18.46 Server      Large Page Allocated: 32MB
    2011-03-30 14:43:18.46 Server      Large Page Allocated: 32MB
    2011-03-30 14:43:18.55 Server      Large Page Allocated: 32MB
    2011-03-30 14:43:18.56 Server      Large Page Allocated: 32MB
    2011-03-30 14:43:38.07 Server      Error allocating 16777216 lock owner blocks on startup

    After trying the removal of the trace flags that were enabled, we still couldn’t get the SQL instance to startup. The next thing we did was to start the SQL instance from command prompt using the following parameters:

    sqlservr.exe –c –m -T3608 -f

    The above started the SQL Server instance in minimal configuration mode without any errors. Now the above lock block allocation seemed a bit too large. So we checked the sp_configure output for the configured value of the “locks” configuration option. And voila, we had our answer! The value of “locks” was set to 16777216. We then changed this value to 0 (ZERO) which is the default using sp_configure and restarted SQL instance. This time the SQL instance came online!

    Takeaway:

    If the SQL instance fails to start, try starting the SQL instance using minimal configuration. If SQL comes online, check the configuration settings for any untoward configuration values.

    Reference:

    Wiki: SQL Database Engine Startup Failures

    https://troubleshootingsql.com/2010/11/23/wiki-sql-database-engine-startup-failures/

  • Wiki: Demystifying SQL Server Exception Dumps

    Recently, I had replied to a MSDN post regarding an Access Violation reported by a SQL Server instance. In this post, I shall elucidate on troubleshooting memory dumps generated by SQL Server exceptions and what can be done without the availability of private symbols for debugging.

    I had written a post earlier on when a memory dump is generated in SQL Server. If a single Errorlog has multiple stack dumps from multiple exceptions, then the first thing to do is to investigate the first access violation reported in the series of dumps reported. It is also possible that an exception (eg:access violation) could be followed by another exception/assertion or a non-yielding condition which may be a side effect of the earlier access violation.

    When SQL encounters an access violation, there will be  SQLDumpXXXX.mdmp, SQLDumpXXXX.txt and SQLDumpXXXX.log files created in the LOG folder associated with the exception. The SQL Errorlog will report the occurrence of the exception as well.

    1. The .mdmp file is the memory dump which would be required by CSS to troubleshoot the issue.
    2. The .txt file is the symptom dump file which contains environment information along with other information depending on the nature of the exception.
    3. The .log file contains an extract from the SQL Errorlog when the exception was encountered. This helps in looking at what messages were reported in the Errorlog prior to the issue. Helps during post-mortem analysis if the current Errorlogs have already been recycled.

    There can be two types of exceptions: one that is fatal enough to cause a SQL service termination or one that encounters the exception which terminates the thread which was encountered the issue.

    Now what can be done in such a situation without having to look into memory dump file. The first step would be to check if the issue is a recurring behavior due to a particular operation to establish some pattern or if there is not identifiable pattern at all. If you look into the SQL Errorlog, you might be able to identify the input buffer which cause the exception (unless it’s an exception which terminated the SQL service, one such example is shown below).

    Server * BEGIN STACK DUMP:
    Server * spid 5728
    Server * ex_handle_except encountered exception C0000005 – Server terminating

    If the above snippet contains the T-SQL query which raised the exception, then you would want to execute the same query from a Management Studio query window and check if the exception re-occurs. If yes, then you have a valid repro scenario.

    Example snippet from an Errorlog where the Access Violation didn’t cause a service termination:

    *   Exception Address = 0042B866
    *   Exception Code    = c0000005 EXCEPTION_ACCESS_VIOLATION
    *   Access Violation occurred writing address 67192000
    * Input Buffer 38 bytes –
    *  exec sp_updatestats

    Next check if you can spot any external components loaded into SQL Server address space. I shall revert back to my MSDN post where I had spotted an anti-virus filter DLL loaded in SQL Server process address space.

    Server * bcrypt 000007FEFC900000 000007FEFC921FFF 00022000
    Server * PCTLsp64 000000000B1E0000 000000000B251FFF 00072000
    Server * mswsock 000007FEFC840000 000007FEFC893FFF 00054000

    Based on a few Bing searches, I was able to determine that the PCTLsp64 was part of a virus monitoring program from PC Tools. The next step would be to check if this external component can be moved out of SQL Server process address space. The fact that the DLL is loaded in SQL process address space doesn’t make the DLL a culprit. However, when troubleshooting such issues, it is important to eliminate all unknown or third party elements that could prevent us from narrowing down to the culprit. Other DLLs which can be commonly found in SQL Server process address space would be provider DLLs when linked servers are being used on the SQL Server instance. Additionally execution of Extended Stored Procedures (XSPs) could also load external DLLs into SQL Server process address space depending on the way the XSP DLL was coded. An easy way to identifying a XSP dll is searching for the word “using” in the SQL Server Errorlog. SQL Server reports the first instance of a XSP dll being loaded into SQL Server process address space.

    Using ‘xpstar.dll’ version ‘2009.100.1600’ to execute extended stored procedure ‘xp_readerrorlog’

    If you do find an external component loaded in SQL process address space, check the callstack reported in the Errorlog below the list of modules printed below to determine if the functions of the exception stack are associated with external component that you identified. For the issue reported in the MSDN post, I did find this:

    Module(sqlservr+00000000017A954C)
    Module(kernel32+0000000000099380)
    Module(ntdll+0000000000096228)
    Module(ntdll+0000000000014F48)
    Module(ntdll+0000000000034F6D)
    Module(ntdll+0000000000015B2C)
    Module(ntdll+000000000004F638)
    Module(ntdll+000000000004C8F4)
    Module(ntdll+000000000004C822)
    Module(PCTLsp64+00000000000040AD)
    Module(PCTLsp64+0000000000004701)
    Module(PCTLsp64+0000000000005434)

    Now this makes my story a bit more compelling of removing the external component out of SQL Server process address space. Once that is done and if you have a repro condition which causes the issue, then it would be good to re-run your repro and check if the issue is actually resolved. Not all the exceptions are the same even though they are reported in the same manner.

    If all the above hasn’t helped in narrowing down the issue, then check if you are on the latest available cumulative update for the version of  SQL Server that you are using. If not, then it might be a good idea to update your instance to the latest available build to ensure that you are not hitting a known issue. If this is possible, then apply the latest cumulative update package and check if the issue re-occurs. I am cognizant of the fact that this might be an easy option due to change management restrictions on production environments. For such a dependency, my recommendation would be engage CSS to assist with a thorough investigation of the root cause of the issue.

    As you can see from the steps outline above, you can look into a few things before you need to start poking into the exception memory dump using a Debugging tool.

    Happy debugging!

  • Setup – RPC, please be nice to me

    Recently, I had looked into a SQL Server 2008 cluster setup failure where the following information was noted in the Detail.txt file:

    2011-02-21 11:58:37 Slp: Configuration action failed for feature SQL_Engine_Core_Inst during timing ConfigRC and scenario ConfigRC.
    2011-02-21 11:58:37 Slp: The RPC server is unavailable
    2011-02-21 11:58:37 Slp: Configuration action failed for feature SQL_Engine_Core_Inst during timing ConfigRC and scenario ConfigRC.
    2011-02-21 11:58:37 Slp: System.ComponentModel.Win32Exception: The RPC server is unavailable
    2011-02-21 11:58:37 Slp:    at Microsoft.SqlServer.Configuration.Cluster.ClusterResource.UpgradeResourceDLL(String nodeName, String dllPathName)
    2011-02-21 11:58:37 Slp:    at Microsoft.SqlServer.Configuration.SqlEngine.SQLEngineClusterFeature.UpgradeResourceDLL(SQLServiceResource sqlResource)
    2011-02-21 11:58:37 Slp:    at Microsoft.SqlServer.Configuration.SqlEngine.SQLEngineClusterFeature.ConfigureSQLEngineResourceType()
    2011-02-21 11:58:37 Slp:    at Microsoft.SqlServer.Configuration.SqlEngine.SqlEngineSetupPrivate.Patch_ConfigRC(EffectiveProperties properties)
    2011-02-21 11:58:37 Slp:    at Microsoft.SqlServer.Configuration.SqlEngine.SqlEngineSetupPrivate.Patch(ConfigActionTiming timing, Dictionary`2 actionData, PublicConfigurationBase spcb)
    2011-02-21 11:58:37 Slp:    at Microsoft.SqlServer.Configuration.SqlConfigBase.SqlFeatureConfigBase.Execute(ConfigActionScenario scenario, ConfigActionTiming timing, Dictionary`2 actionData, PublicConfigurationBase spcbCurrent)
    2011-02-21 11:58:37 Slp:    at Microsoft.SqlServer.Configuration.SqlConfigBase.SlpConfigAction.ExecuteAction(String actionId)
    2011-02-21 11:58:37 Slp:    at Microsoft.SqlServer.Configuration.SqlConfigBase.SlpConfigAction.Execute(String actionId, TextWriter errorStream)
    2011-02-21 11:58:37 Slp: Exception: System.ComponentModel.Win32Exception.
    2011-02-21 11:58:37 Slp: Source: Microsoft.SqlServer.Configuration.Cluster.
    2011-02-21 11:58:37 Slp: Message: The RPC server is unavailable.

    The RPC Server is unavailable is a pretty generic error and can happen due to a lot of reasons. One of the common reasons that we have seen in CSS while troubleshooting setup issues is with incorrect DNS entries. This can happen if DNS entry for the cluster network name wasn’t configured properly and is pointing to an incorrect IP Address.

    Another point to keep in mind is Windows Firewall. Make sure that the Firewall configuration allows this RPC call through.

    I worked with Shahryar (Twitter) on a similar issue last week and it was identified that a PING request to the cluster name or IP returned no response.

    If all else fails, then network tracing would help in figuring out what is failing and where.

    References:

    Error message when you connect to a cluster virtual server by using the named pipes protocol: "The machines selected for remote communication is not available at this time."
    http://support.microsoft.com/kb/306985/

  • Troubleshooting that darn backup error

    Backup and restore operations even though they are supposed to be a no-brainer, it can leave you wanting to tear your hair out. Considering the different elements that influence the outcome of a successful backup operation like backup media, consistency of the backup, network issues (if backing up to a UNC path), consistency of the database being backed up etc.

    I shall attempt to outline a set of troubleshooting steps specifically for non-native backup/restore related errors for SQL Server databases.

    Any BACKUP command that completes successfully or with errors has associated messages logged in the SQL Server Errorlog.

    A successful backup from the SQL Server Errorlog:

    Database backed up. Database: adventureworks, creation date(time): 2010/05/28(03:00:18), pages dumped: 17291, first LSN: 67:7733:56, last LSN: 67:7761:1, number of dump devices: 1, device information: (FILE=1, TYPE=DISK: {‘F:\adventureworks.bak’}).

    You will see that the backup completion message has the database name, the number of pages that were contained in the backup, the date the backup was created and the number of devices and their type (in this case files). So you can reconstruct the sequence of backups even if your backup information history is missing from the MSDB system tables and you just have your SQL Server Errorlogs to play with. If you want to get real fancy about this, then you could spin up a nifty little Powershell or VBScript to parse through the SQL Errorlogs and provide the backup sequence to you as well.

    Now, let’s look at a failed backup message from the SQL Errorlog.

    Error: 18204, Severity: 16, State: 1.
    BackupDiskFile::CreateMedia: Backup device ‘R:\adventureworks.bak’ failed to create.
    Operating system error 3(The system cannot find the path specified.).
    Error: 3041, Severity: 16, State: 1.
    BACKUP failed to complete the command BACKUP DATABASE adventureworks.

    You will notice above that the Operating System error code associated with the backup failure is reported in the error message. More often than not, the error message is self explanatory. If the error code doesn’t throw back an error text along with it, you can get the windows error code associated with the error code using net helpmsg <error number> from a command prompt window.

    In the above case, there wasn’t any R: drive on my server. Now that I have finished stating the most obvious of troubleshooting methodologies for SQL native backups which was done to set the context for the next part of this post. The troubleshooting methodology for non-native backups.

    Non-native SQL backups of databases use one of the following methods:

    1. Use of APIs exposed through SQLVDI.dll to perform a VDI based backup
    2. Use of VSS framework to perform a snapshot backup of the SQL Server database

    Note: In this post, I shall not be addressing any storage level backup solutions that have options or features to handles SQL database backups.

    This post is aimed at discussing the tackling of VSS/VDI related errors that you face while performing a database backup.

    If a VDI backup fails, then you can try the following sequence of troubleshooting steps:

    1. Attempt a backup to the same location using native SQL backup from a query window or SQLCMD. This might not always be possible as some of the backup tools do not allow any other backup application to connect to the backup share apart from the backup tool’s agents.
    2. The next thing that you can do is to ensure that your SQLVDI.DLL is updated to the latest build. For this you can use the SQL Server Backup Simulator available on Code Gallery using the “Validate VDI Installation” option in the tool. This check in the tool will perform basic checks like current DLL version and additional checks based on root causes of common scenarios that CSS has seen in the past for VDI backup failures. Additional information on the usage of the tool is available here.
    3. Perform a backup of the database using the tool for which the backup is failing (to the same destination if possible). The parameter tweaks at this point are not available in the current version like striped backups, changes to MAXTRANSFERSIZE/BUFFER COUNT etc. but if the backup from this tool is successful, then you know for a fact that the SQLVDI APIs are working as expected. Then it is either an additional piece of logic in the backup software that is failing or there is an external factors like network/backup media or there is a resource crunch on the SQL instance on which the database resides.


    Common errors that you might see during a VDI backup operation failure:

    Error message 1
    BackupVirtualDeviceFile::ClearError: failure on backup device ‘VDI_ DeviceID ‘. Operating system error 995(The I/O operation has
    been aborted because of either a thread exit or an application request.).

    Error message 2
    Error: 18210, Severity: 16, State: 1.
    BackupMedium::ReportIoError: write failure on backup device ‘VDI_ DeviceID ‘. Operating system error 995(The I/O operation has been aborted because of either a thread exit or an application request.)

    Error message 3
    Error: 18210, Severity: 16, State: 1. 
    BackupVirtualDeviceFile::RequestDurableMedia: Flush failure on backup device ‘VDI_ DeviceID. Operating system error 995(The I/O operation has been aborted because of either a thread exit or an application request.)

    The above errors are mostly due to outdated versions of SQLVDI.DLL on SQL Server 2000 or SQL Server 2005 instances. The “Validate VDI Installation” option in the Backup Simulator should be able to identify any known issues with DLL version mismatch for you.


    If you have an application that uses Volume Shadow Service to backup your SQL database and that backup fails, then you your troubleshooting steps would be a bit different. The tell-tale sign of a VSS Snapshot backup is in the I/O Frozen message being written into the SQL Errorlogs for the databases being backed up. In such a failure scenario, take a backup of the database using Windows Server Backup Admin (Windows Server 2008 and above) or NTBackup utility to perform a backup of the database files involved. If this backup is successful, it means that a snapshot backup is successfully completing for the database. Now depending on your backup application’s implementation logic, this might be a resource crunch or a backup storage media incompatibility or even a resource crunch.

    Common errors associated with VSS backups:

    Issue# 1
    Error: 3041, Severity: 16, State: 1.
    Backup      BACKUP failed to complete the command BACKUP DATABASE <database name>. Check the backup application log for detailed messages.
    SubprocessMgr::EnqueueSubprocess: Limit on ‘Max worker threads’ reached.
    This error message is raised when your backup application uses VSS to backup a large number of databases simultaneously. More information around this can be found in this post Volume Shadow barfs with 0x80040e14 code

    Issue #2
    While performing a Bare Metal backup you might run into issues if your SQL Server binaries are located on a different drive other than the C: drive. More information on the same is mentioned here: Location of SQL Binaries can flip out Bare Metal backups

    Issue #3

    Event Type:    Error
    Event Source:    VSS
    Event Category:    None
    Event ID:    6005
    Description:
    Sqllib error: Database %1 is stored on multiple volumes, only some of which are being shadowed.

    The above error occurs when you backup only one of the volumes that contains SQL database data/log files which are spread over multiple volumes. This is explained in detailed in this post: Why is VSS complaining about SQL Data files


    More information on how VSS/VDI work is present in the blog post by Sudarshan: INFORMATIONAL- SHEDDING LIGHT on VSS & VDI Backups in SQL Server

    Previous posts related to Volume Shadow Backups
    IO Frozen messages while taking NT Backup for SQL databases

    Previous posts related to VDI backups
    SQL VDI backup fails with 0×80770007