holsthn
Goto Top

Backupscript erkennt manchmal Pools nicht korrekt

Seit einiger Zeit funktioniert unser Backupscript nicht mehr einwandfrei

Hi
Ich nutze zur Sicherung unserer Server ein Backup-Script. Dieses Backup-Script guckt unter anderem, ob sich das Medium im richtigen Pool befindet. Seit neuestem habe ich die verrückte Situation, dass das Band im richtigen Pool ist, mir das Script aber ausgibt es wäre im falschen.
Um genauer zu werden: Das Script gibt mir im Logfile aus
ERROR: The media "ACB5EA429A5B46AFAFA337317423DA94" is already allocated to another pool.   
ERROR: Backup process aborted, no data was backed up.

Jetzt sehe ich unter Computerverwaltung -> Datenspeicher -> Wechselmedien nach und muss feststellen, dass sich das Band im richtigen Pool befindet.
Ich gebe das Band frei und machs verfügbar und verschiebe es wieder in den richtigen Pool.
Führe ich jetzt die batch-Datei erneut aus funktioniert es einwandfrei.

Woran kann dieses Verhalten liegen

Hier mein Script:

rem a batch script to perform a incremental backup

rem set some values first
rem the GUID of our Tape Library / Tape Drive
SET TapeLibGUID=060DA28570B947F4B5DB680A954EC3C2
rem the GUID of the "Free Media" pool  
SET FreeMediaGUID=3996979234374147B6A988B76125B944
rem the GUID of the "Unrecognized Media" pool  
SET UnrecMediaGUID=4DE170DEF31640B397F60B8BA74D8191
rem the GUID of the "Backup\incremental" pool  
SET IncrementalGUID=BF4FE3B10F994359B1EF22868135179C
rem The directory which we write our log files to.
SET OurLogDir=C:\Backup\log
rem full path to the backup selection file
SET BackupSelection=C:\Backup\Backup_i.bks

rem Determine the expected / desired name for the media
SET MediaName="Incremental %date%"  

rem set the name of our log file
SET logfile=%OurLogDir%\messages-%date%.log

rem The directory, where NTBACKUP will save its log files 
SET BackupLogDir=c:\backup\log

:start
rem force a library refresh
rsm.exe refresh /LG%TapeLibGUID%
rem rem wait for completion
sleep 30

rem determine the name and guid of the media inserted
FOR /F " usebackq delims==" %%i IN (`rsm view /Tphysical_media /CG%TapeLibGUID% /B /GUIDDISPLAY`) DO set medGUID=%%i  
FOR /F " usebackq delims==" %%i IN (`rsm view /Tphysical_media /CG%TapeLibGUID% /B`) DO set medName=%%i  

echo INFO: Incremental Backup procedure %date% started >> %logfile%

rem do we have a tape at all?
IF "%medGUID%"=="" GOTO NoMedia  

rem is the inserted media part of the "free media" pool?  
FOR /F " usebackq delims==" %%i IN (`rsm view /Tphysical_media /GUIDDISPLAY /CG%FreeMediaGUID% /B`) DO IF %%i==%medGUID% GOTO Free  

rem is it an unrecognized media?
FOR /F " usebackq delims==" %%i IN (`rsm view /Tphysical_media /GUIDDISPLAY /CG%UnrecMediaGUID% /B`) DO IF %%i==%medGUID% GOTO Unrecognized  

rem is the inserted media part of the "\backup\incremental" pool?  
FOR /F " usebackq delims==" %%i IN (`rsm view /Tphysical_media /GUIDDISPLAY /CG%IncrementalGUID% /B`) DO IF %%i==%medGUID% GOTO Incremental  

rem if none of the above, handle it appropiately
goto SomeOther

:NoMedia
echo ERROR: No media present in tape drive >> %logfile%
echo ERROR: Backup process aborted, no data was backed up >> %logfile%
goto end

:Free
rem Everything's fine, log and proceed  
echo INFO: Media "%medName%" taken from the "Free Media" pool >> %logfile%  
goto doBackup

:Unrecognized
rem Everything's fine, although media is unrecognized. Log & proceed  
echo INFO: Media "%medName%" taken from the "Unrecognized Media" pool >> %logfile%  
goto doBackup

:Incremental
rem Everything's fine, tape is rotating, log and proceed  
echo INFO: Media "%medName%" taken from the "Backup\Incremental" pool >> %logfile%  
goto doBackup

:SomeOther
rem Log that the inserted tape was in the wrong media pool and exit
echo ERROR: The media "%medName%" is already allocated to another pool. >> %logfile%  
echo ERROR: Backup process aborted, no data was backed up. >> %logfile%
goto end

:doBackup
rem start the backup process
echo INFO: backup process starting >> %logfile%
echo INFO: The inserted media "%medName%" is empty or already used for a incremental backup >> %logfile%  
echo INFO: It will be re-initialized as "%MediaName%" >> %logfile%  
echo INFO: It will be assigned to the media pool Backup\Incremental >> %logfile%
start /wait C:\windows\system32\NTBACKUP.EXE backup "@%BackupSelection%" /d "Set %date%" /v:yes /r:no /rs:no /hc:on /m normal /j "Incremental" /l:s /p "Incremental" /UM  

if errorlevel 1 goto backuperror

rem log success
echo INFO: backup process terminated gracefully >> %logfile%
goto endbackup

:backuperror
rem log errors
echo ERROR: backup process has thrown errors, inspect the backup log >> %logfile%
goto endbackup

:endbackup
rem log eject & eject
echo INFO: ejecting media >> %logfile%
rsm eject /PG%medGUID% /ASTART >> %logfile%
goto end

:end
rem determine the log file with the latest change
FOR /F "tokens=*" %%i IN ('dir /B /OD /TW "%BackupLogDir%\*.log"') DO set backuplog=%%i  

Für jede Hilfe bin ich dankbar

Viele Grüße

Content-Key: 149336

Url: https://administrator.de/contentid/149336

Printed on: April 26, 2024 at 13:04 o'clock