Sample Header Ad - 728x90

Database Administrators

Q&A for database professionals who wish to improve their database skills

Latest Questions

0 votes
2 answers
332 views
decoding instance_name in sys.dm_os_performance_counters on Azure SQL Database
doing some work with the SQL Perfmon counters and banging my head against the wall trying to work out how to translate the instance_name column to a database name. So if I run a query like the following SELECT top 10 left(counter_name, 25), left(instance_name,40), cntr_value FROM sys.dm_os_performan...
doing some work with the SQL Perfmon counters and banging my head against the wall trying to work out how to translate the instance_name column to a database name. So if I run a query like the following SELECT top 10 left(counter_name, 25), left(instance_name,40), cntr_value FROM sys.dm_os_performance_counters WHERE counter_name = 'Log Bytes Received/sec' I get a resultset like Log Bytes Received/sec _Total 0 Log Bytes Received/sec 100f6a49-cd58-432a-8680-ed0f1069c5ea 0 Log Bytes Received/sec dd7b88c8-43c4-48a8-bf97-e174bb5c5eca 0 Log Bytes Received/sec 7a0dc4f3-b236-4c0f-b42c-357bfd521b16 0 Log Bytes Received/sec 5d527545-4bcc-4c66-b315-e1f8fc653245 0 How do I translate the value of instance_name (100f6a49-cd58-432a-8680-ed0f1069c5ea) to a database_name I thought I could look in sys.databases but no luck
Stephen Morris - Mo64 (4656 rep)
Nov 9, 2021, 07:25 PM • Last activity: Jan 25, 2024, 10:27 AM
11 votes
5 answers
17110 views
How to revive SQL Server 2008 R2 performance counters?
I'm running SQL Server 2008 R2 Developer on Windows 7 x64, as the default instance. For some reason, SQL Server's performance counters seem to have disappeared. `SELECT * FROM sys.dm_os_performance_counters` returns zero rows. I tried running `lodctr /T:perf-MSSQLSERVERsqlctr.ini`. Although it compl...
I'm running SQL Server 2008 R2 Developer on Windows 7 x64, as the default instance. For some reason, SQL Server's performance counters seem to have disappeared. SELECT * FROM sys.dm_os_performance_counters returns zero rows. I tried running lodctr /T:perf-MSSQLSERVERsqlctr.ini. Although it completed without errors, it didn't fix anything, even after restarting the Remote Registry service. In fact, the counters are now missing from perfmon. unlodctr MSSQLSERVER still says that the counters are not installed, but lodctr /Q:MSSQLSERVER says they're present and enabled. Regular Windows and .NET counters are working fine. In the Windows Error log, I'm seeing Error 8317: > Cannot query value 'First Counter' associated with registry key > 'HKLM\SYSTEM\CurrentControlSet\Services\MSSQLSERVER\Performance'. SQL > Server performance counters are disabled. I suspect the problem may have been triggered by an installation of SQL 2012 RC0 that failed. Any suggestions for how to recover, short of reinstalling SQL Server 2008 R2?
RickNZ (351 rep)
Dec 16, 2011, 08:24 AM • Last activity: Jul 20, 2022, 08:02 AM
0 votes
1 answers
1185 views
Why is disk queue length an ineffective measure when there is no latency?
Link: https://social.technet.microsoft.com/wiki/contents/articles/3214.sql-server-monitoring-disk-usage.aspx > You should only use the secondary counters for the drive(s) that have > high latency. If the drive has acceptable latency, there is no point > in moving forward. > > Disk counters that you...
Link: https://social.technet.microsoft.com/wiki/contents/articles/3214.sql-server-monitoring-disk-usage.aspx > You should only use the secondary counters for the drive(s) that have > high latency. If the drive has acceptable latency, there is no point > in moving forward. > > Disk counters that you can monitor to determine disk activity are > divided into the following two groups: > > - Primary > - PhysicalDisk: Avg. Disk sec/Write > - PhysicalDisk: Avg. Disk sec/Read > > - Secondary > - PhysicalDisk: Avg. Disk Queue Length > - PhysicalDisk: Disk Bytes/sec > - PhysicalDisk: Disk Transfers/sec Why is disk queue length an ineffective measure when there is no latency?
variable (3590 rep)
Jul 7, 2022, 01:22 PM • Last activity: Jul 7, 2022, 07:16 PM
3 votes
1 answers
817 views
SQL 2008 Server agent cant see perfmon counters
I am trying to create a new SQL server agent alert to capture "SQLServer:General Statistics|Processes Blocked||>|5' but it looks like alert creation GUI is not able to see any perfmon counters as in the following picture: ![enter image description here][1] The drop downs for Object, counter and inst...
I am trying to create a new SQL server agent alert to capture "SQLServer:General Statistics|Processes Blocked||>|5' but it looks like alert creation GUI is not able to see any perfmon counters as in the following picture: enter image description here The drop downs for Object, counter and instance are empty. I can't even create the alert using TSQL as follows: enter image description here I can see these counters collecting data in perfmon. Any ideas? Thanks in advance...
Manjot (1213 rep)
Jul 12, 2011, 03:42 AM • Last activity: Jun 17, 2022, 08:01 AM
-2 votes
1 answers
1056 views
How to monitor the workers used over a period of time?
Assume I have the default setting of max workers or say I have x number of max worker threads configured. Is there any windows or sql performance counter to monitor the number of workers used over a period of time?
Assume I have the default setting of max workers or say I have x number of max worker threads configured. Is there any windows or sql performance counter to monitor the number of workers used over a period of time?
variable (3590 rep)
May 14, 2022, 12:23 PM • Last activity: May 14, 2022, 08:55 PM
1 votes
0 answers
66 views
Does SSIS `Buffer memory` include `Flat buffer memory` and `Private buffer memory`?
I am looking at ssis perf mon counters to check for memory pressure from running ssis packages. Does SSIS `Buffer memory` include `Flat buffer memory` and `Private buffer memory`?
I am looking at ssis perf mon counters to check for memory pressure from running ssis packages. Does SSIS Buffer memory include Flat buffer memory and Private buffer memory?
variable (3590 rep)
May 7, 2022, 05:33 AM • Last activity: May 7, 2022, 05:51 AM
0 votes
1 answers
364 views
How would %privilege time of sqlsvr instance indicate cpu consumption of other processes?
I am looking at msdn doc to monitor cpu. Link: https://learn.microsoft.com/en-us/troubleshoot/sql/performance/troubleshoot-high-cpu-usage-issues#step-1-verify-that-sql-server-is-causing-high-cpu-usage It says I need to capture the %user time and %privileged time for sqlsvr instance. Then it goes to...
I am looking at msdn doc to monitor cpu. Link: https://learn.microsoft.com/en-us/troubleshoot/sql/performance/troubleshoot-high-cpu-usage-issues#step-1-verify-that-sql-server-is-causing-high-cpu-usage It says I need to capture the %user time and %privileged time for sqlsvr instance. Then it goes to say high %user time means sqlsvr is keeping cpu busy. Where as high %privileges time means other processes or anti-virus is keeping the cpu busy. My question is - how would %privilege time of sqvsvr instance indicate cpu consumption of other processes?
variable (3590 rep)
May 6, 2022, 08:46 PM • Last activity: May 6, 2022, 10:59 PM
3 votes
2 answers
444 views
Whether `SQL Server: Memory Manager: Target Server Memory (KB)` is ideal amount of memory based on recent workload OR the max memory setting?
Link: https://learn.microsoft.com/en-us/sql/relational-databases/performance-monitor/monitor-memory-usage?view=sql-server-ver15 > SQL Server: Memory Manager: Target Server Memory (KB) This counter > indicates an ideal amount of memory SQL Server could consume, based on > recent workload. Compare to...
Link: https://learn.microsoft.com/en-us/sql/relational-databases/performance-monitor/monitor-memory-usage?view=sql-server-ver15 > SQL Server: Memory Manager: Target Server Memory (KB) This counter > indicates an ideal amount of memory SQL Server could consume, based on > recent workload. Compare to Total Server Memory after a period of > typical operation to determine whether SQL Server has a desired amount > of memory allocated. I am getting conflicting definitions on the internet about the SQL Server: Memory Manager: Target Server Memory (KB) counter. MSDN doc definition is as shown in the above quote. Where as other online links say that this is the max server memory that we configure under the sql server options. Example: https://www.mssqltips.com/sqlservertip/6571/perfmon-counters-for-sql-server-memory/ > Target Server Memory (KB) is the amount of memory that SQL Server can > potentially allocate to the buffer pool under its current workload. > The Target Memory (KB) counter would reflect SQL Server "max server > memory (MB)" when it is set as that would be the amount of memory that > SQL Server could and would like to reach. Which definition is correct?
variable (3590 rep)
May 5, 2022, 12:31 PM • Last activity: May 6, 2022, 12:31 PM
0 votes
3 answers
1144 views
What does 0 memory grants pending, but low PLE, high lazy writes/sec and free list stalls/sec indicate?
My server memory is 100GB, of which 90GB is allocated to SQL server via the max memory setting. I am monitoring a sql server that has got 0 memory grants pending. This means no process is waiting for memory. If this was greater than 0 then it will indicate memory pressure which would get resolved up...
My server memory is 100GB, of which 90GB is allocated to SQL server via the max memory setting. I am monitoring a sql server that has got 0 memory grants pending. This means no process is waiting for memory. If this was greater than 0 then it will indicate memory pressure which would get resolved upon increasing the max sql server memory setting. However I am seeing low PLE (page life expectancy), high lazy writes/sec and free list stalls/sec. Does this indicate memory pressure?
variable (3590 rep)
May 5, 2022, 09:33 AM • Last activity: May 6, 2022, 08:29 AM
3 votes
3 answers
985 views
Why is total and target server memory never reaching the configured memory value?
I have sql server with 100GB ram, of which 90GB is allocated to sql server. 2 GB is currently free as shown in task manager. 90GB=92160MB (as seen in the sql server memory settings) I am monitoring the total server memory and target server memory perf monitor counters. I can see that the target serv...
I have sql server with 100GB ram, of which 90GB is allocated to sql server. 2 GB is currently free as shown in task manager. 90GB=92160MB (as seen in the sql server memory settings) I am monitoring the total server memory and target server memory perf monitor counters. I can see that the target server memory never crosses 90150MB, and the total server memory never crosses 89100MB. What could be the reason for this? My understanding was that target memory should always be equal to the setting configured in sql server memory settings. But why is this different in my situation?
variable (3590 rep)
May 5, 2022, 09:41 AM • Last activity: May 6, 2022, 06:01 AM
0 votes
1 answers
656 views
Perfmon Thread Count vs SQL Workers
We are trying to monitor SQL Worker Threads and in the past we used the following query: SELECT SUM(current_workers_count) as [Current worker thread] FROM sys.dm_os_schedulers We are now considering just using the PerfMon counter “Process>Thread Count” for each SQL Server Instance. During our analys...
We are trying to monitor SQL Worker Threads and in the past we used the following query: SELECT SUM(current_workers_count) as [Current worker thread] FROM sys.dm_os_schedulers We are now considering just using the PerfMon counter “Process>Thread Count” for each SQL Server Instance. During our analysis, we noticed that there is a slight difference between the PerfMon Thread Count and the Worker Threads as found in dm_os_schedulers or dm_os_workers. We also compared it to what was found in dm_os_threads and still saw a difference. Does anyone know the difference between what is being tracked in those Microsoft provided DMV’s vs what is being captured by PerfMon? The DMV’s are consistently lower than what is found in the Performance Monitor, so they must be "excluding" something. We need to understand what that something is. For example, the dm_os_threads dmv will show 137 but the perfmon counter will show 141 and the dm_os_scheduler and dm_os_workerss dmv's will show 122 and 123 respectively. We are on SQL Server 2017, CU22; Windows Server 2016
SFDCShark (5 rep)
Jan 25, 2022, 10:49 PM • Last activity: Jan 26, 2022, 05:46 PM
2 votes
1 answers
828 views
What perfmon metric will help me to monitor whether the SQL server memory is under pressure and resulting in usage of page file on disk?
SQL server is assigned 110GB memory. It is consuming the entire memory. I want to understand whether there is memory pressure or not. Usually SQL server will remove old pages from the memory (that it currently doesn't require) and pull in required pages from disk. However, when there is memory press...
SQL server is assigned 110GB memory. It is consuming the entire memory. I want to understand whether there is memory pressure or not. Usually SQL server will remove old pages from the memory (that it currently doesn't require) and pull in required pages from disk. However, when there is memory pressure - (assuming all pages in memory are required and actively used) SQL server will utilize the page file on disk as an alternate memory area. What perfmon metric will help me to monitor whether the SQL server memory is under pressure (that is disk page file is being used)? I know about Memory:Page Fault/sec - but this is not restricted to only SQL server memory pressure. What other perf mon metric can help me?
variable (3590 rep)
Oct 6, 2021, 04:33 AM • Last activity: Oct 6, 2021, 11:36 AM
0 votes
0 answers
78 views
SQL Server 2012 RAM consumption
I'm running SQL Server 2012 (x64) on a Windows 10 (x64) machine with 64GB of RAM. I've allocated 32000MB to SQL Server. When running a Restore with NORECOVERY, RAM hardly gets used and the job takes upwards of 17 hours. I have what seems to be a near identical setup on a different reporting server t...
I'm running SQL Server 2012 (x64) on a Windows 10 (x64) machine with 64GB of RAM. I've allocated 32000MB to SQL Server. When running a Restore with NORECOVERY, RAM hardly gets used and the job takes upwards of 17 hours. I have what seems to be a near identical setup on a different reporting server that runs the job in ~4hours. I've taken a look at some perfmon counters and noticed that while target server memory is at 32GB, total server memory hovers around 1GB. From what I understand, this means there is memory pressure on the server, however, total RAM usage on the box stays between 4%-6%. Any ideas on what could be causing the issue? We've all seen SQL gobble up memory, interesting that I can't get this instance to take any. FWIW, i've also added the NT Service/MSSQLSERVER to 'Gpedit - lock pages in memory' with no improvement. I'm starting to lean towards bad RAM or MOBO. However, Windows and BIOS seem to see the RAM fine, and a memtest comes back clean. Please tell me I'm overlooking something dumb.
KCZAR (1 rep)
Jul 29, 2021, 05:54 PM
3 votes
1 answers
793 views
Availability Group- Redo Rate displayed on AG Dashboard vs Perfmon counter
I am bit confused on checking the metrics for *REDO Rate KB/Sec* from Always on AG dashboard, which for some scenarios matches with perfmon counter *Database replica : Redone Bytes/Sec* ( hopefully it's the correct counter for redo rate via perfmon), and sometimes not at all. Most of the times when...
I am bit confused on checking the metrics for *REDO Rate KB/Sec* from Always on AG dashboard, which for some scenarios matches with perfmon counter *Database replica : Redone Bytes/Sec* ( hopefully it's the correct counter for redo rate via perfmon), and sometimes not at all. Most of the times when there is lot of activity ongoing, my belief is that AG dashboard and DMV shows REDO rate for e.g. 40 MB/Secs at given time which matches with perfmon counter. However, during less activity time or nothing much to send over to sec, REDO Rate on Dashboard and dmv seems to be showing incorrect values compared to perfmon counter. Not able to understand which value is correct and how to analyze. Any idea why or is it bug in dashboard? Screenshot as requested: enter image description here No transactions occurred around that time - no major activity on primary end. I am collecting that perfmon on secondary and primary since after failover new secondary we would still need those counters running. However the data pulled in screenshot perfmon data is from secondary.
BeginnerDBA (2230 rep)
May 12, 2021, 02:32 PM • Last activity: May 14, 2021, 09:01 AM
2 votes
2 answers
2487 views
Reading SQL Performance Counters using PowerShell script
I'm trying create a PS script to read some performance counter about my SQL for my Level 1 partners but I'm having a problem with the instance name. I'm using this code: $computer = "\\\" + $ENV:Computername $instance = $computer + '\MSSQL$SG25DB' write-Host $instance Write-Output -InputObject "Use...
I'm trying create a PS script to read some performance counter about my SQL for my Level 1 partners but I'm having a problem with the instance name. I'm using this code: $computer = "\\\" + $ENV:Computername $instance = $computer + '\MSSQL$SG25DB' write-Host $instance Write-Output -InputObject "Use of Memory Buffer. The expected value must be greater than 80." Get-Counter "$instance:Buffer Manager\Buffer cache hit ratio" and the output is: \\\\[hostname]\\MSSQL$SG25DB <--- Here appears the proper value :) Use of Memory Buffer. The expected value must be greater than 80. Get-Counter : The specified counter path could not be interpreted. At line:5 char:12 + Get-Counter <<<< "$instance:Buffer Manager\Buffer cache hit ratio" + CategoryInfo : InvalidResult: (:) [Get-Counter], Exception + FullyQualifiedErrorId : CounterApiError,Microsoft.PowerShell.Commands.GetCounterCommand I have verified with Write-Host that the value of variable $instance is properly constructed but when I apply it to the Get-Counter command its fails. Do you have any idea? Could be related with the special character $? How can I make run it properly?
Simkin (29 rep)
Jul 15, 2013, 04:30 PM • Last activity: Mar 10, 2021, 02:46 PM
19 votes
3 answers
92428 views
High Disk I/O from sql server or is High disk I/O slowing sql server?
I've been arguing with a DBA and a couple hardware guys about performance issues on our SQL server. Normally everything is fine, however over the past few weeks we have been having huge lag spikes in sql server. Its clear that SQL Server is waiting on disk I/O. But I keep getting told that it is bea...
I've been arguing with a DBA and a couple hardware guys about performance issues on our SQL server. Normally everything is fine, however over the past few weeks we have been having huge lag spikes in sql server. Its clear that SQL Server is waiting on disk I/O. But I keep getting told that it is beacuse SQL Server is asking for abnormally high I/O. Which isn't the case. I can see from what is running that there is nothing out of the normal, and all the DBA cares to look at is what is causing the blocking and so on, which is useless. For instance the major thing we see backing up is operation on the ASPState database, which we are using to manage the ASP Session State on the web servers. These operations are normally never seen on Sp_who2 active results because they occur so quickly. The database is in simple recovery mode and logging is miminal. However during these lag spikes we can see alot select and update operations on the database being blocked or waiting. I'm sure what is going on is that someone or some job is running something that is causing heavey disk usage on the raid arrays used for that databases log and data files. The problem is proving it, since no one wants to admit they are doing something that is killing our website. My question is what performance counters or whatever can I log that will help show that SQL server is waiting on I/O, but not because its asking for more than normaly, instead beacuse the disk is to busy to respond to the requests from sql server as quickly as it normally would?
Edgey (191 rep)
Apr 13, 2012, 06:12 PM • Last activity: May 13, 2020, 07:04 PM
0 votes
2 answers
1474 views
Strangely high writes per second
I'm experiencing some extremely strange behavior on one of our OLTP Servers. Just to provide a bit of background, we have an 'OLTP' which has many large and wide tables. We have 560 tables within it which have more than 100 columns within them, and unfortunately as it is an outsourced application th...
I'm experiencing some extremely strange behavior on one of our OLTP Servers. Just to provide a bit of background, we have an 'OLTP' which has many large and wide tables. We have 560 tables within it which have more than 100 columns within them, and unfortunately as it is an outsourced application there is little I can do with the database design. So, the graphs below show page reads and writes per second. We have a large spike with reads at around 4 Am which is a load to Qlikview which we are aware of. However, page reads on the whole tend to be lowish, I think they are still higher than the 90 page per second threshold, but less of an issue in comparison to writes. Writes on the other hand, as the graph displays is much higher with regular instances where values are higher than 500 pages per second. Since 15/10/2018, for the vast majority of data capture intervals, the below has applied - where Lazywrites per second is greater than 1. - Page life expectancy also is normally very high. We do have instances where the value drops during the morning which we know about (4AM), however with the odd exception, we are almost always above the suggested threshold 7500s (Memory/4)*30. - Buffer Cache Hit Ratio also is very healthy at or around 99%. - Finally, we have had very few if any memory related waits, Resource_Semaphore is at 0 seconds and CMEM_THREAD has accumulated 60seconds since 27/10/2018. - Values for Memory grants pending is 0 and Memory grants Outstanding is 1 with data collected since 27/10/2018. These factors, in my opinion rule out memory pressure being an issue but I can't seem to explain the strange spikes with regards to writes per second. In my opinion, it's related to our database design. We do have extremely wide tables which can be inserted/updated/deleted to frequently. We also have many wide indexes with inefficient data types. From the data and graphs I've provided, are there any signs of what they high writes is attributed to or are there any metrics I can use to explain the spikes? enter image description here enter image description here enter image description here **Version:** > Microsoft SQL Server 2014 (SP2-GDR) (KB4019093) - 12.0.5207.0 (X64) > Jul 3 2017 02:25:44 Copyright (c) Microsoft Corporation Standard > Edition (64-bit) on Windows NT 6.3 (Build 9600: ) (Hypervisor) **Data Source** > - The graphs above are taken from solarwinds, the data I assume is collected from sys.dm_os_performance_counters > - All other counter data which I have references is derived from sys.dm_os_performance_counters, captured at periodic intervals with the wait stats taken from sys.dm_os_wait_stats. Thanks
Krishn (383 rep)
Nov 15, 2018, 03:34 PM • Last activity: Feb 2, 2020, 01:02 PM
0 votes
0 answers
247 views
Get-Counter not accepting array created from SQL
When I try and generate an array from a SQL output, although it's the same data type and content, perfmon doesn't accept these values, whereas it does for a manually created a list. So the first call for Get-Counter returns an error message as seen below, where as the second call with a manually cre...
When I try and generate an array from a SQL output, although it's the same data type and content, perfmon doesn't accept these values, whereas it does for a manually created a list. So the first call for Get-Counter returns an error message as seen below, where as the second call with a manually created list works correctly. How do I resolve this? Get-Counter : Internal performance counter API call failed. Error: c0000bc4. At line:26 char:9 $SQLQueryGetCounters = " DECLARE @PerfmonCounterList VARCHAR(MAX) SELECT TOP 2 PerfmonCounter FROM Perfmon.PerfmonCounterList" $SQLQueryGetCounters = " DECLARE @PerfmonCounterList VARCHAR(MAX) SELECT top 2 ' "' +PerfmonCounter + '"' ItemValue FROM Perfmon.PerfmonCounterList " $Counters = @(Invoke-sqlcmd -ServerInstance Localhost -Database "DatabaseMonitoring" -Query $SQLQueryGetCounters )| select-object -expand ItemValue $List = [System.Collections.ArrayList]@() # New-Object System.Collections.Generic.List[System.Object] # [System.Collections.ArrayList]@() foreach ($Item in $Counters) { $List.Add($Item) } $List = $List.ToArray() Get-Counter -Counter $List $List = "\DATABASE(*)\DATABASE CACHE % HIT","\DATABASE(*)\DATABASE CACHE SIZE (MB)" Get-Counter -Counter $List
Krishn (13 rep)
Jan 17, 2020, 11:04 AM
1 votes
1 answers
1421 views
How to create SQL Server Agent Queued jobs?
There is a perfmon counter "Queued jobs" in perfmon object "SQLAgent:Jobs". How to create a job queue that will reflect in this perfmon counter? Can I get this queued job info from somewhere else like DMV?
There is a perfmon counter "Queued jobs" in perfmon object "SQLAgent:Jobs". How to create a job queue that will reflect in this perfmon counter? Can I get this queued job info from somewhere else like DMV?
Santosh Kale (51 rep)
May 14, 2019, 04:45 AM • Last activity: Oct 19, 2019, 03:00 PM
0 votes
0 answers
352 views
Why are my SQL Perfmon counters returning Zero?
I have set up a Perfmon data collector set on one of our servers with SQL server running on it. I also have a scheduled task which imports this data into SQL (set up by following this open source project: https://github.com/heraflux/BLGtoSQL ). All this runs with one user on the local machine. After...
I have set up a Perfmon data collector set on one of our servers with SQL server running on it. I also have a scheduled task which imports this data into SQL (set up by following this open source project: https://github.com/heraflux/BLGtoSQL ). All this runs with one user on the local machine. After leaving this running for a couple of weeks I have created a report to look at the data gathered so far. All the Perfmon counters EXCEPT the SQL ones work. All the SQL counters return zero - even though I know at least some of these counters CAN'T always be zero (e.g. User Connections, Free Memory KB etc). What's odd is that when I run and import the exact same setup on our development server the SQL counters work as desired. I've checked and the user has the same local permissions on each server. I've also granted the user with the following permissions on the SQL server: Connect Any Database, Connect SQL, View Server State. When looking at the SQL counters live on Perfmon I've found that they also don't seem to be working. I'm pretty stumped as to why they aren't showing anything.
Samantha (81 rep)
Jun 27, 2019, 11:05 AM
Showing page 1 of 20 total questions