Toolbox3Hi everyone, Mike Jacquet here, and I want to take a minute to talk about an issue we’ve seen a couple times here in product support where DPM tape jobs may take longer than expected or they fail outright with ID 24052.  There are two possible symptoms for this issue depending on whether you have multiple tape drives in your tape library or if you are using a standalone tape drive.

A. If you have a multi-tape drive tape library, when performing tape backups using Data Protection Manager, after a period of time you may notice that the tape backups are taking longer to complete than normal.

B. If you have a single tape drive library, or are using a standalone tape drive, all the tape backup jobs fail with the following job details and alert:

Type: Tape backup
Status: Failed
Description: DPM could not reserve the drive resource because one of required drive resources is not online or it needs cleaning or servicing. (ID 24052)
More information
End time: <time>
Start time: <time>
Time elapsed: 00:00:00
Data transferred: 0 MB
Cluster node -
Source details: D:\
Protection group members: 1
Details
Protection group: test
Library: Sun/StorageTek Library
Tape Label (Barcode): -

ALERT
====

Affected area: -
Occurred since:
Description: The back up to tape job failed for the following reason: (ID 3311)
More information
Detailed Errors View Detailed Errors
Recommended action: Run backup to tape job again...
Resolution: To dismiss the alert, click below
Inactivate alert

The Detail errors shows the following details:

Error Details:
DPM could not reserve the drive resource because one of required drive resources is not online or it needs cleaning or servicing. (ID 24052)
Recommeded action:
1) View and resolve all alerts for the library and its drive(s). Retry the operation after resolving the alerts.
2) Go to the Library tab in the Management pane and click on Rescan. Once the rescan operation has completed successfully, retry the operation.

Cause

A. One or more of the tape drives in the tape library are dirty and need cleaning, or is faulty. Since one or more drives are not being used by DPM, the tape backup jobs take longer to complete. There is no visual indication in the DPM Console that will show you which tape drive needs cleaning, however the drive that is not being used needs to be cleaned or servicing.

B. The standalone tape drive is dirty and needs cleaning or is faulty. There is no visual indication in the DPM Console that will show you the tape drive needs cleaning or is faulty.

Resolution

1) Copy the below into notepad, then save the file as C:\Program Files\Microsoft DPM\DPM\bin\QueryDriveStatus.ps1 and run it from the DPM PowerShell command window.


<************* START COPY BELOW ******************>

param([string] $verbose)
add-pssnapin sqlservercmdletsnapin100
Add-PSSnapin -Name Microsoft.DataProtectionManager.PowerShell
$ConfirmPreference = 'None'
cls
$instance = '.\msdpm2010' # <---- If DPM Database is on a different location, edit this line accordinly
$query = "
use dpmdb
select lib.UserFriendlyName,
td.SerialNo,
td.driveid,
DRV.AccessPath,
TD.DriveStatus,
case TD.DriveStatus
when 0 then 'None'
when 1 then 'Needs Cleaning'
when 2 then 'Needs servicing'
end as drive_status,
GTD.LastCleaningDate,
drv.DriveType,
case DRV.drivetype
when 0 then 'Library'
when 1 then 'Stand Alone'
end as Library_Type
from dbo.tbl_MM_Library lib
join dbo.tbl_MM_Drive drv on lib.LibraryId = drv.LibraryId
join dbo.tbl_MM_TapeDrive td on drv.DriveId= td.DriveId
inner join dbo.tbl_MM_Global_TapeDrive GTD on GTD.DriveId= drv.GlobalDriveId
where TD.DriveStatus > 0 and lib.IsOffline = 0
order by lib.UserFriendlyName"

$result = @(Invoke-Sqlcmd -ServerInstance $instance -Query $query)
if (!$result)
{
write-host "No tape drive(s) found that need cleaning. Exiting..."
exit
}

$count = 1
write-host " For optimum output, set PoweShell Width for screen buffer size to at least 160" -f yellow
write-host " This script will only return tape drives that need cleaning or servicing. Offline library/drives won't show up" -f yellow; write-host
write-host
write-host " UserFriendlyName Serial Number Access Path Drive Status Last Cleaning Date Library Type"
write-host " ------------------------------------------ ------------------------------- ------------------ --------------- ----------------------- ------------"
foreach ($result1 in $result)
{
if ($color -eq 'white') {$color = 'cyan'} else {$color = 'white'}
write-host ("{0,2}"-f $count) -foreground green -nonewline
write-host ( " - {0,-40} {1,33} {2,18} {3,-15} {4,23} {5,-11}" -f $result1.UserFriendlyName, $result1.SerialNo, $result1.AccessPath, $result1.Drive_Status, $result1.LastCleaningDate, $result1.Library_type, $result1.isoffline) -nonewline -f $color
write-host
$count++
}

write-host
write-host "Which drive(s) you want to set as cleaned? `nIf you want to set more than one drive enter numbers separated by space: " -f green -nonewline
$cleandrive = read-host
$cleandrive = $cleandrive -split " "
$executingjob = 0

if ($cleandrive)
{
foreach ($cleaning in $cleandrive)
{
$fireclean = [int]$cleaning
if ($fireclean -gt 0 -and $firejob -lt $count)
{
$query = "use dpmdb
update tbl_mm_tapedrive
set drivestatus = 0
where driveid = '{0}'" -f $result[$cleaning-1].driveid
Invoke-Sqlcmd -ServerInstance $instance -Query $query
}
}
}
write-host "Done..."

<*************** END COPY ABOVE ******************>

2. Identify the drive that needs cleaning from the output of the DPM PowerShell script.  It will provide the library friendly name, serial number, access path, drive status, and last cleaned date/time for the drive so you can identify it in the DPM console.

SAMPLE OUTPUT
=========

clip_image002

3. Clean the tape drive with a tape cleaner cartridge using the following TechNet article below, then rescan the library.

Cleaning tape drives : http://technet.microsoft.com/en-us/library/bb795736.aspx

4. Once the drive is cleaned, re-run the PowerShell script to see if the drive is now in a normal state.

5. If the drive still reports as dirty, run the script and mark it as cleaned manually.

Michael Jacquet | Senior Support Escalation Engineer

Get the latest System Center news on Facebook and Twitter:

clip_image001 clip_image002

App-V Team blog: http://blogs.technet.com/appv/
ConfigMgr Support Team blog: http://blogs.technet.com/configurationmgr/
DPM Team blog: http://blogs.technet.com/dpm/
MED-V Team blog: http://blogs.technet.com/medv/
Orchestrator Support Team blog: http://blogs.technet.com/b/orchestrator/
Operations Manager Team blog: http://blogs.technet.com/momteam/
SCVMM Team blog: http://blogs.technet.com/scvmm
Server App-V Team blog: http://blogs.technet.com/b/serverappv
Service Manager Team blog: http://blogs.technet.com/b/servicemanager
System Center Essentials Team blog: http://blogs.technet.com/b/systemcenteressentials
WSUS Support Team blog: http://blogs.technet.com/sus/

The Forefront Server Protection blog: http://blogs.technet.com/b/fss/
The Forefront Endpoint Security blog : http://blogs.technet.com/b/clientsecurity/
The Forefront Identity Manager blog : http://blogs.msdn.com/b/ms-identity-support/
The Forefront TMG blog: http://blogs.technet.com/b/isablog/
The Forefront UAG blog: http://blogs.technet.com/b/edgeaccessblog/