title: Azure SQL Database DTU Calculator per database not per server
body: <p>I found an <a href="http://dtucalculator.azurewebsites.net/" rel="nofollow noreferrer">amazing script online</a> that will allow everyone of us to determine how much juice do we need on Azure before the migration:</p>
  <pre><code>Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted -Force
  
  $ErrorActionPreference = &quot;Stop&quot;
  $VerbosePreference = &quot;Continue&quot;
  
  cls
  
  Write-Output &quot;Collecting counters...&quot;
  Write-Output &quot;Press Ctrl+C to exit.&quot;
  
  $counters = @(&quot;\Processor(_Total)\% Processor Time&quot;, 
  &quot;\LogicalDisk(_Total)\Disk Reads/sec&quot;, 
  &quot;\LogicalDisk(_Total)\Disk Writes/sec&quot;, 
  &quot;\SQLServer:Databases(_Total)\Log Bytes Flushed/sec&quot;) 
  
  Get-Counter -Counter $counters -SampleInterval 1 -MaxSamples 3600 | 
      Export-Counter -FileFormat csv -Path &quot;C:\sql-perfmon-log.csv&quot; -Force
  </code></pre>
  <p>The problem is that this script is targeting the whole server, not a specific database.</p>
  <p>Is it possible through PowerShell or to run a T-SQL query through PowerShell and retrieve these 4 metrics each second:</p>
  <ul>
  <li>Processor - % Processor Time</li>
  <li>Logical Disk - Disk Reads/sec</li>
  <li>Logical Disk - Disk Writes/sec</li>
  <li>Database - Log Bytes Flushed/sec</li>
  </ul>
  <p>The goal is to collect those 4 metrics for 1 database only.</p>