What volume to migrate first?

Published Feb 15 2019 02:29 AM 315 Views
First published on TECHNET on Mar 30, 2010

Sid Ramesh wrote a fantastic script that provides great LDM statistics amongst which how many extents a data source uses. This helps to determine which volume to migrate first to reduce extents if there is a need to. Sample output is shown below followed by the actual script.

A companion post on LDM information can be found here.

#begin script

#---------------------------------

#LdmStats.Ps1

param ()
#region queries
#-- Count only extents from dynamic disks
$ExtentCountCmd = "select count(*) as  TotalNumberOfDynamicExtents from tbl_SPM_Extent extent where extent.DiskID in (select DiskID from tbl_SPM_Disk where DiskType = 1) "
#-- Count the number of unique PhysicalReplicas
$PhysReplCountCmd = "select physicalreplicaid as PhysicalReplicaId, COUNT(*) as Count from tbl_PRM_LogicalReplica where physicalreplicaid is not null and datasourceid is not null group by PhysicalReplicaId"
#-- Count the number of datasources
$DScountCmd = "select COUNT(*) as TotalNumberOfDatasources from tbl_IM_Datasource where ProtectedGroupId is not null"
#-- Count the number of volumes
$VolCountCmd = "select COUNT(*) as NumberOfVolumes from tbl_SPM_Volume where VolumeSetID is not null"
#-- Get the LDM alerts
$LDMAlertsCmd = "select AlertId, Type, OccuredSince, Resolution, ResolvedTime from tbl_AHP_Alerts where Type = 63 or Type = 64 order by OccuredSince desc "
#-- Get the datasources with the maximum extents (useful for migration)
$DSwithExtentsCmd = "SELECT (select DataSourceName from tbl_IM_Datasource ds2 where DataSourceId = DS.DataSourceId) as DatasourceName,
(select pg.FriendlyName from tbl_IM_Datasource ds2 join tbl_IM_ProtectedGroup pg on ds2.ProtectedGroupId = pg.ProtectedGroupId
where DataSourceId = DS.DataSourceId) as ProtectionGroupName,
COUNT(Extent.DiskID) as NumberOfExtents, replica.PhysicalReplicaId as PhysicalReplicaId, DS.DatasourceId as DatasourceId
FROM tbl_SPM_Extent Extent WITH (NOLOCK)
JOIN dbo.tbl_SPM_Volume Volume WITH (NOLOCK)
ON Extent.GuidName = Volume.GuidName
JOIN dbo.tbl_PRM_LogicalReplica Replica WITH (NOLOCK)
ON Replica.PhysicalReplicaId = Volume.VolumeSetID
JOIN dbo.tbl_IM_Datasource DS WITH (NOLOCK)
ON Replica.DataSourceId = DS.DataSourceId
GROUP BY DS.DataSourceId, Replica.PhysicalReplicaId
Order by NumberOfExtents desc"
#-- Get all the Replica and SC disk threshold exceeded alerts along with the corresponding datasources
$GetDiskAlertsCmd = "select aa.AlertId, ra.DatasourceId, Type as AlertType, OccuredSince, Resolution, ResolvedTime from tbl_AHP_Alerts aa
JOIN tbl_PRM_ReplicaAlerts ra WITH (NOLOCK)
ON aa.AlertId = ra.AlertId
where Type = 31 or Type = 36"
#endregion
function DisplayAndSelect {
param ($list, $item)
# unified forced select from list by index number
Write-Host ""
Write-Host "Select $($item.toupper()) from list below:"
for ($i = 0; $i -lt $list.count; $i++) {
write-host "`t -> [$i] $($list[$i])"
}
Write-Host ""
$i = – 1
while (($i -lt 0) -or ($i -ge $list.count)) {
$now = (Get-Date).ToString($format)
$i = [int](Read-Host "[$now] Enter index number")
}
write-host "Selected $($list[$i])`n"
return $list[$i]
}
function GetSqlServers {
# return SQL instances that the SQL browser service can find
write-host "Searching for SQL service instances, this may take a while..."
return [System.Data.Sql.SqlDataSourceEnumerator]::Instance.GetDataSources()
}
#START
$version = "1.6"
write-host ""
Write-Host ("=" * 30) -ForegroundColor cyan
Write-Host "LdmStats version $version" -ForegroundColor yellow
Write-Host  ("=" * 30) -ForegroundColor cyan
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO")
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SmoExtended")
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.ConnectionInfo")
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SmoEnum")
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Management.RegisteredServers")
#ensure browser runs
$sb = Get-Service | ? {$_.name -match "sqlbrowser"}
if (!$sb) {Throw "No SQL browser service found!"}
if ($sb.status -ne "running") {$sb.start; sleep 500}
# get sql server list
$SQLinstances = @(GetSqlServers)
$tmplist = @()
# build SERVER\INSTANCE format
$SQLinstances | foreach {$tmplist += "$($_.servername)\$($_.instancename)"}
$SQLinstances = @($tmplist)
$sqlserver = DisplayAndSelect $SQLinstances "SQLserver"
$dpmservername = (&hostname)
Write-Host "Connecting [$sqlserver]..."
$srvr = new-object ("Microsoft.SqlServer.Management.Smo.Server") $sqlserver
$db = $srvr.Databases["DPMDB"]
$ExtentCount =   $db.ExecuteWithResults($ExtentcountCmd).Tables[0].rows[0].TotalNumberOfDynamicExtents
$DSCount =  $db.ExecuteWithResults($DScountCmd).Tables[0].rows[0].TotalNumberOfDatasources
$volcount = $db.ExecuteWithResults($VolcountCmd).Tables[0].rows[0].NumberOfVolumes
$dpmRemaining = [math]::truncate(600 - $volcount)
$diskcount = (Get-DPMDisk $dpmservername).count
Write-Host "Total disks".PadRight(20)  ": $diskcount"
Write-Host "Total volumes".PadRight(20) ": $volcount"
Write-Host "Total extents".PadRight(20) ": $ExtentCount"
Write-Host "Total data sources".PadRight(20) ": $DSCount"
$usedslots = 1 + $diskcount + (2*$volcount) + $ExtentCount
$slotsRemaining = 2960-$usedslots
$volRemaining = [math]::Truncate($slotsRemaining/3)
if ($dpmRemaining -lt $volRemaining) {$dsRemaining = [math]::Truncate($dpmRemaining/2)}
else {$dsRemaining = [math]::Truncate($volRemaining/2)}
Write-Host "Number of non-colocated data sources that can still be added: $dsRemaining"
Write-Host "`nData source extent list..."
$DSwithExtentsTable = $db.ExecuteWithResults($DSwithExtentsCmd).Tables[0]
$DSwithExtentsRows =   $DSwithExtentsTable.rows
$physicalReplicasPrinted = @{}
foreach ($row in $DSwithExtentsRows)
{
if ($physicalReplicasPrinted.Contains($row["PhysicalReplicaId"])) {
$row.Delete()
} else {
$physicalReplicasPrinted[$row["PhysicalReplicaId"]] = 1;
}
}
$DSwithExtentsTable.AcceptChanges()
$DSwithExtentsRows | ft –AutoSize
Write-Host "`nReplica colocation counts..."
$PhysReplCount =   $db.ExecuteWithResults($PhysReplCountCmd).Tables[0].rows
$PhysReplCount | ft –AutoSize
Write-Host "`nLDM alerts list..."
$LDMAlerts =   $db.ExecuteWithResults($LDMAlertsCmd).Tables[0].rows
if ($LDMAlerts.Count -gt 0 ) {
$LDMAlerts | ft –AutoSize
}
else {write-host "None found!" -f white}
Write-Host "`nDone!"
#---------------------------------

%3CLINGO-SUB%20id%3D%22lingo-sub-341530%22%20slang%3D%22en-US%22%3EWhat%20volume%20to%20migrate%20first%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-341530%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3E%20First%20published%20on%20TECHNET%20on%20Mar%2030%2C%202010%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CP%3ESid%20Ramesh%20wrote%20a%20fantastic%20script%20that%20provides%20great%20LDM%20statistics%20amongst%20which%20how%20many%20extents%20a%20data%20source%20uses.%20This%20helps%20to%20determine%20which%20volume%20to%20%3CA%20href%3D%22http%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fdd282970.aspx%22%20mce_href%3D%22http%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fdd282970.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%20migrate%20%3C%2FA%3E%20first%20to%20reduce%20extents%20if%20there%20is%20a%20need%20to.%20Sample%20output%20is%20shown%20below%20followed%20by%20the%20actual%20script.%3C%2FP%3E%0A%20%20%3CP%3EA%20companion%20post%20on%20LDM%20information%20can%20be%20found%20%3CA%20href%3D%22http%3A%2F%2Fblogs.technet.com%2Fdpm%2Farchive%2F2010%2F02%2F28%2Fchecking-ldm-database-space-usage.aspx%22%20mce_href%3D%22http%3A%2F%2Fblogs.technet.com%2Fdpm%2Farchive%2F2010%2F02%2F28%2Fchecking-ldm-database-space-usage.aspx%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%20here.%20%3C%2FA%3E%3C%2FP%3E%3CEM%3E%20%3C%2FEM%3E%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F76005iB3448708234D47A0%22%20%2F%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CH2%20id%3D%22toc-hId-1676939074%22%20id%3D%22toc-hId-1767656705%22%3E%3C%2FH2%3E%0A%20%20%3CH2%20id%3D%22toc-hId--875217887%22%20id%3D%22toc-hId--784500256%22%3E%3C%2FH2%3E%0A%20%20%3CP%3E%23begin%20script%3C%2FP%3E%0A%20%20%3CP%3E%23---------------------------------%3C%2FP%3E%0A%20%20%3CP%3E%23LdmStats.Ps1%3C%2FP%3E%0A%20%20%3CP%3Eparam%20()%20%3CBR%20%2F%3E%20%23region%20queries%20%3CBR%20%2F%3E%20%23--%20Count%20only%20extents%20from%20dynamic%20disks%20%3CBR%20%2F%3E%20%24ExtentCountCmd%20%3D%20%22select%20count(*)%20as%26nbsp%3B%20TotalNumberOfDynamicExtents%20from%20tbl_SPM_Extent%20extent%20where%20extent.DiskID%20in%20(select%20DiskID%20from%20tbl_SPM_Disk%20where%20DiskType%20%3D%201)%20%22%20%3CBR%20%2F%3E%20%23--%20Count%20the%20number%20of%20unique%20PhysicalReplicas%20%3CBR%20%2F%3E%20%24PhysReplCountCmd%20%3D%20%22select%20physicalreplicaid%20as%20PhysicalReplicaId%2C%20COUNT(*)%20as%20Count%20from%20tbl_PRM_LogicalReplica%20where%20physicalreplicaid%20is%20not%20null%20and%20datasourceid%20is%20not%20null%20group%20by%20PhysicalReplicaId%22%20%3CBR%20%2F%3E%20%23--%20Count%20the%20number%20of%20datasources%20%3CBR%20%2F%3E%20%24DScountCmd%20%3D%20%22select%20COUNT(*)%20as%20TotalNumberOfDatasources%20from%20tbl_IM_Datasource%20where%20ProtectedGroupId%20is%20not%20null%22%20%3CBR%20%2F%3E%20%23--%20Count%20the%20number%20of%20volumes%20%3CBR%20%2F%3E%20%24VolCountCmd%20%3D%20%22select%20COUNT(*)%20as%20NumberOfVolumes%20from%20tbl_SPM_Volume%20where%20VolumeSetID%20is%20not%20null%22%20%3CBR%20%2F%3E%20%23--%20Get%20the%20LDM%20alerts%20%3CBR%20%2F%3E%20%24LDMAlertsCmd%20%3D%20%22select%20AlertId%2C%20Type%2C%20OccuredSince%2C%20Resolution%2C%20ResolvedTime%20from%20tbl_AHP_Alerts%20where%20Type%20%3D%2063%20or%20Type%20%3D%2064%20order%20by%20OccuredSince%20desc%20%22%20%3CBR%20%2F%3E%20%23--%20Get%20the%20datasources%20with%20the%20maximum%20extents%20(useful%20for%20migration)%20%3CBR%20%2F%3E%20%24DSwithExtentsCmd%20%3D%20%22SELECT%20(select%20DataSourceName%20from%20tbl_IM_Datasource%20ds2%20where%20DataSourceId%20%3D%20DS.DataSourceId)%20as%20DatasourceName%2C%20%3CBR%20%2F%3E%20(select%20pg.FriendlyName%20from%20tbl_IM_Datasource%20ds2%20join%20tbl_IM_ProtectedGroup%20pg%20on%20ds2.ProtectedGroupId%20%3D%20pg.ProtectedGroupId%20%3CBR%20%2F%3E%20where%20DataSourceId%20%3D%20DS.DataSourceId)%20as%20ProtectionGroupName%2C%20%3CBR%20%2F%3E%20COUNT(Extent.DiskID)%20as%20NumberOfExtents%2C%20replica.PhysicalReplicaId%20as%20PhysicalReplicaId%2C%20DS.DatasourceId%20as%20DatasourceId%20%3CBR%20%2F%3E%20FROM%20tbl_SPM_Extent%20Extent%20WITH%20(NOLOCK)%20%3CBR%20%2F%3E%20JOIN%20dbo.tbl_SPM_Volume%20Volume%20WITH%20(NOLOCK)%20%3CBR%20%2F%3E%20ON%20Extent.GuidName%20%3D%20Volume.GuidName%20%3CBR%20%2F%3E%20JOIN%20dbo.tbl_PRM_LogicalReplica%20Replica%20WITH%20(NOLOCK)%20%3CBR%20%2F%3E%20ON%20Replica.PhysicalReplicaId%20%3D%20Volume.VolumeSetID%20%3CBR%20%2F%3E%20JOIN%20dbo.tbl_IM_Datasource%20DS%20WITH%20(NOLOCK)%20%3CBR%20%2F%3E%20ON%20Replica.DataSourceId%20%3D%20DS.DataSourceId%20%3CBR%20%2F%3E%20GROUP%20BY%20DS.DataSourceId%2C%20Replica.PhysicalReplicaId%20%3CBR%20%2F%3E%20Order%20by%20NumberOfExtents%20desc%22%20%3CBR%20%2F%3E%20%23--%20Get%20all%20the%20Replica%20and%20SC%20disk%20threshold%20exceeded%20alerts%20along%20with%20the%20corresponding%20datasources%20%3CBR%20%2F%3E%20%24GetDiskAlertsCmd%20%3D%20%22select%20aa.AlertId%2C%20ra.DatasourceId%2C%20Type%20as%20AlertType%2C%20OccuredSince%2C%20Resolution%2C%20ResolvedTime%20from%20tbl_AHP_Alerts%20aa%20%3CBR%20%2F%3E%20JOIN%20tbl_PRM_ReplicaAlerts%20ra%20WITH%20(NOLOCK)%20%3CBR%20%2F%3E%20ON%20aa.AlertId%20%3D%20ra.AlertId%20%3CBR%20%2F%3E%20where%20Type%20%3D%2031%20or%20Type%20%3D%2036%22%20%3CBR%20%2F%3E%20%23endregion%20%3CBR%20%2F%3E%20function%20DisplayAndSelect%20%7B%20%3CBR%20%2F%3E%20param%20(%24list%2C%20%24item)%20%3CBR%20%2F%3E%20%23%20unified%20forced%20select%20from%20list%20by%20index%20number%20%3CBR%20%2F%3E%20Write-Host%20%22%22%20%3CBR%20%2F%3E%20Write-Host%20%22Select%20%24(%24item.toupper())%20from%20list%20below%3A%22%20%3CBR%20%2F%3E%20for%20(%24i%20%3D%200%3B%20%24i%20-lt%20%24list.count%3B%20%24i%2B%2B)%20%7B%20%3CBR%20%2F%3E%20write-host%20%22%60t%20-%26gt%3B%20%5B%24i%5D%20%24(%24list%5B%24i%5D)%22%20%3CBR%20%2F%3E%20%7D%20%3CBR%20%2F%3E%20Write-Host%20%22%22%20%3CBR%20%2F%3E%20%24i%20%3D%20%E2%80%93%201%20%3CBR%20%2F%3E%20while%20((%24i%20-lt%200)%20-or%20(%24i%20-ge%20%24list.count))%20%7B%20%3CBR%20%2F%3E%20%24now%20%3D%20(Get-Date).ToString(%24format)%20%3CBR%20%2F%3E%20%24i%20%3D%20%5Bint%5D(Read-Host%20%22%5B%24now%5D%20Enter%20index%20number%22)%20%3CBR%20%2F%3E%20%7D%20%3CBR%20%2F%3E%20write-host%20%22Selected%20%24(%24list%5B%24i%5D)%60n%22%20%3CBR%20%2F%3E%20return%20%24list%5B%24i%5D%20%3CBR%20%2F%3E%20%7D%20%3CBR%20%2F%3E%20function%20GetSqlServers%20%7B%20%3CBR%20%2F%3E%20%23%20return%20SQL%20instances%20that%20the%20SQL%20browser%20service%20can%20find%20%3CBR%20%2F%3E%20write-host%20%22Searching%20for%20SQL%20service%20instances%2C%20this%20may%20take%20a%20while...%22%20%3CBR%20%2F%3E%20return%20%5BSystem.Data.Sql.SqlDataSourceEnumerator%5D%3A%3AInstance.GetDataSources()%20%3CBR%20%2F%3E%20%7D%20%3CBR%20%2F%3E%20%23START%20%3CBR%20%2F%3E%20%24version%20%3D%20%221.6%22%20%3CBR%20%2F%3E%20write-host%20%22%22%20%3CBR%20%2F%3E%20Write-Host%20(%22%3D%22%20*%2030)%20-ForegroundColor%20cyan%20%3CBR%20%2F%3E%20Write-Host%20%22LdmStats%20version%20%24version%22%20-ForegroundColor%20yellow%20%3CBR%20%2F%3E%20Write-Host%26nbsp%3B%20(%22%3D%22%20*%2030)%20-ForegroundColor%20cyan%20%3CBR%20%2F%3E%20%5Bvoid%5D%5BSystem.Reflection.Assembly%5D%3A%3ALoadWithPartialName(%22Microsoft.SqlServer.SMO%22)%20%3CBR%20%2F%3E%20%5Bvoid%5D%5BSystem.Reflection.Assembly%5D%3A%3ALoadWithPartialName(%22Microsoft.SqlServer.SmoExtended%22)%20%3CBR%20%2F%3E%20%5Bvoid%5D%5BSystem.Reflection.Assembly%5D%3A%3ALoadWithPartialName(%22Microsoft.SqlServer.ConnectionInfo%22)%20%3CBR%20%2F%3E%20%5Bvoid%5D%5BSystem.Reflection.Assembly%5D%3A%3ALoadWithPartialName(%22Microsoft.SqlServer.SmoEnum%22)%20%3CBR%20%2F%3E%20%5Bvoid%5D%5BSystem.Reflection.Assembly%5D%3A%3ALoadWithPartialName(%22Microsoft.SqlServer.Management.RegisteredServers%22)%20%3CBR%20%2F%3E%20%23ensure%20browser%20runs%20%3CBR%20%2F%3E%20%24sb%20%3D%20Get-Service%20%7C%20%3F%20%7B%24_.name%20-match%20%22sqlbrowser%22%7D%20%3CBR%20%2F%3E%20if%20(!%24sb)%20%7BThrow%20%22No%20SQL%20browser%20service%20found!%22%7D%20%3CBR%20%2F%3E%20if%20(%24sb.status%20-ne%20%22running%22)%20%7B%24sb.start%3B%20sleep%20500%7D%20%3CBR%20%2F%3E%20%23%20get%20sql%20server%20list%20%3CBR%20%2F%3E%20%24SQLinstances%20%3D%20%40(GetSqlServers)%20%3CBR%20%2F%3E%20%24tmplist%20%3D%20%40()%20%3CBR%20%2F%3E%20%23%20build%20SERVER%5CINSTANCE%20format%20%3CBR%20%2F%3E%20%24SQLinstances%20%7C%20foreach%20%7B%24tmplist%20%2B%3D%20%22%24(%24_.servername)%5C%24(%24_.instancename)%22%7D%20%3CBR%20%2F%3E%20%24SQLinstances%20%3D%20%40(%24tmplist)%20%3CBR%20%2F%3E%20%24sqlserver%20%3D%20DisplayAndSelect%20%24SQLinstances%20%22SQLserver%22%20%3CBR%20%2F%3E%20%24dpmservername%20%3D%20(%26amp%3Bhostname)%20%3CBR%20%2F%3E%20Write-Host%20%22Connecting%20%5B%24sqlserver%5D...%22%20%3CBR%20%2F%3E%20%24srvr%20%3D%20new-object%20(%22Microsoft.SqlServer.Management.Smo.Server%22)%20%24sqlserver%20%3CBR%20%2F%3E%20%24db%20%3D%20%24srvr.Databases%5B%22DPMDB%22%5D%20%3CBR%20%2F%3E%20%24ExtentCount%20%3D%26nbsp%3B%26nbsp%3B%20%24db.ExecuteWithResults(%24ExtentcountCmd).Tables%5B0%5D.rows%5B0%5D.TotalNumberOfDynamicExtents%20%3CBR%20%2F%3E%20%24DSCount%20%3D%26nbsp%3B%20%24db.ExecuteWithResults(%24DScountCmd).Tables%5B0%5D.rows%5B0%5D.TotalNumberOfDatasources%20%3CBR%20%2F%3E%20%24volcount%20%3D%20%24db.ExecuteWithResults(%24VolcountCmd).Tables%5B0%5D.rows%5B0%5D.NumberOfVolumes%20%3CBR%20%2F%3E%20%24dpmRemaining%20%3D%20%5Bmath%5D%3A%3Atruncate(600%20-%20%24volcount)%20%3CBR%20%2F%3E%20%24diskcount%20%3D%20(Get-DPMDisk%20%24dpmservername).count%20%3CBR%20%2F%3E%20Write-Host%20%22Total%20disks%22.PadRight(20)%26nbsp%3B%20%22%3A%20%24diskcount%22%20%3CBR%20%2F%3E%20Write-Host%20%22Total%20volumes%22.PadRight(20)%20%22%3A%20%24volcount%22%20%3CBR%20%2F%3E%20Write-Host%20%22Total%20extents%22.PadRight(20)%20%22%3A%20%24ExtentCount%22%20%3CBR%20%2F%3E%20Write-Host%20%22Total%20data%20sources%22.PadRight(20)%20%22%3A%20%24DSCount%22%20%3CBR%20%2F%3E%20%24usedslots%20%3D%201%20%2B%20%24diskcount%20%2B%20(2*%24volcount)%20%2B%20%24ExtentCount%20%3CBR%20%2F%3E%20%24slotsRemaining%20%3D%202960-%24usedslots%20%3CBR%20%2F%3E%20%24volRemaining%20%3D%20%5Bmath%5D%3A%3ATruncate(%24slotsRemaining%2F3)%20%3CBR%20%2F%3E%20if%20(%24dpmRemaining%20-lt%20%24volRemaining)%20%7B%24dsRemaining%20%3D%20%5Bmath%5D%3A%3ATruncate(%24dpmRemaining%2F2)%7D%20%3CBR%20%2F%3E%20else%20%7B%24dsRemaining%20%3D%20%5Bmath%5D%3A%3ATruncate(%24volRemaining%2F2)%7D%20%3CBR%20%2F%3E%20Write-Host%20%22Number%20of%20non-colocated%20data%20sources%20that%20can%20still%20be%20added%3A%20%24dsRemaining%22%20%3CBR%20%2F%3E%20Write-Host%20%22%60nData%20source%20extent%20list...%22%20%3CBR%20%2F%3E%20%24DSwithExtentsTable%20%3D%20%24db.ExecuteWithResults(%24DSwithExtentsCmd).Tables%5B0%5D%20%3CBR%20%2F%3E%20%24DSwithExtentsRows%20%3D%26nbsp%3B%26nbsp%3B%20%24DSwithExtentsTable.rows%20%3CBR%20%2F%3E%20%24physicalReplicasPrinted%20%3D%20%40%7B%7D%20%3CBR%20%2F%3E%20foreach%20(%24row%20in%20%24DSwithExtentsRows)%20%3CBR%20%2F%3E%20%7B%20%3CBR%20%2F%3E%20if%20(%24physicalReplicasPrinted.Contains(%24row%5B%22PhysicalReplicaId%22%5D))%20%7B%20%3CBR%20%2F%3E%20%24row.Delete()%20%3CBR%20%2F%3E%20%7D%20else%20%7B%20%3CBR%20%2F%3E%20%24physicalReplicasPrinted%5B%24row%5B%22PhysicalReplicaId%22%5D%5D%20%3D%201%3B%20%3CBR%20%2F%3E%20%7D%20%3CBR%20%2F%3E%20%7D%20%3CBR%20%2F%3E%20%24DSwithExtentsTable.AcceptChanges()%20%3CBR%20%2F%3E%20%24DSwithExtentsRows%20%7C%20ft%20%E2%80%93AutoSize%20%3CBR%20%2F%3E%20Write-Host%20%22%60nReplica%20colocation%20counts...%22%20%3CBR%20%2F%3E%20%24PhysReplCount%20%3D%26nbsp%3B%26nbsp%3B%20%24db.ExecuteWithResults(%24PhysReplCountCmd).Tables%5B0%5D.rows%20%3CBR%20%2F%3E%20%24PhysReplCount%20%7C%20ft%20%E2%80%93AutoSize%20%3CBR%20%2F%3E%20Write-Host%20%22%60nLDM%20alerts%20list...%22%20%3CBR%20%2F%3E%20%24LDMAlerts%20%3D%26nbsp%3B%26nbsp%3B%20%24db.ExecuteWithResults(%24LDMAlertsCmd).Tables%5B0%5D.rows%20%3CBR%20%2F%3E%20if%20(%24LDMAlerts.Count%20-gt%200%20)%20%7B%20%3CBR%20%2F%3E%20%24LDMAlerts%20%7C%20ft%20%E2%80%93AutoSize%20%3CBR%20%2F%3E%20%7D%20%3CBR%20%2F%3E%20else%20%7Bwrite-host%20%22None%20found!%22%20-f%20white%7D%20%3CBR%20%2F%3E%20Write-Host%20%22%60nDone!%22%20%3CBR%20%2F%3E%20%23---------------------------------%3C%2FP%3E%0A%20%0A%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-341530%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20TECHNET%20on%20Mar%2030%2C%202010%20Sid%20Ramesh%20wrote%20a%20fantastic%20script%20that%20provides%20great%20LDM%20statistics%20amongst%20which%20how%20many%20extents%20a%20data%20source%20uses.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-341530%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESystem%20Center%20Data%20Protection%20Manager%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Version history
Last update:
‎Mar 11 2019 08:25 AM
Updated by: