Backup Script vCenter Server & SSO

am Mrz 18, 2013 in batch, Scripting

Ich benutze dieses Script, um die Datenbank (SQL-Express) des vCenter Servers und VMware SSO zu sichern:

@echo off
SET Server=[servername]
REM Archivformat festlegen, 7zip oder zip:
SET ARCHIVFRMT=7z
SET VMWARESSO=vim_sqlexp
SET VMWARESSODEST=C:BKPDBVMwareSSoRSA.bak
SET VMWARESSODESTPATH=C:BKPDBVMwareSSo
SET VMWARESSOSQL=C:Installsrcvmware-sso.sql
set prg64="C:Program FilesMicrosoft SQL Server100ToolsBinnSQLCMD.EXE"
set prg64path="C:Program FilesMicrosoft SQL Server100ToolsBinn"

REM Falls x64-Managementstudio:
c:
cd /d %prg64path%
sqlcmd -E -S %server%%VMWARESSO% -i %VMWARESSOSQL%

move /Y %VMWARESSODEST% %VMWARESSODESTPATH%VMWARESSO-RSA-%date%.bak
"%programfiles%7-Zip7z.exe" a %VMWARESSODESTPATH%VMWARESSO-RSA-%date%.%ARCHIVFRMT% %VMWARESSODESTPATH%VMWARESSO-*.bak
erase %VMWARESSODESTPATH%VMWARESSO-*.bak

SET VMWAREVCENTER=vim_sqlexp
SET VMWAREVCENTERDEST=C:BKPDBvCenterServerVIM_VCDB.bak
SET VMWAREVCENTERDESTPATH=C:BKPDBvCenterServer
SET VMWAREVCENTERSQL=C:Installsrcvmware-vcenter.sql
set prg64="C:Program FilesMicrosoft SQL Server100ToolsBinnSQLCMD.EXE"
set prg64path="C:Program FilesMicrosoft SQL Server100ToolsBinn"


sqlcmd -E -S %server%%VMWAREVCENTER% -i %VMWAREVCENTERSQL%

move /Y %VMWAREVCENTERDEST% %VMWAREVCENTERDESTPATH%VMWAREVCENTER-RSA-%date%.bak
"%programfiles%7-Zip7z.exe" a %VMWAREVCENTERDESTPATH%VMWAREVCENTER-RSA-%date%.%ARCHIVFRMT% %VMWAREVCENTERDESTPATH%VMWAREVCENTER-*.bak
erase %VMWAREVCENTERDESTPATH%VMWAREVCENTER-*.bak
ping -n 30 127.0.0.1 >nul

vmware-sso.sql:

BACKUP DATABASE [RSA] TO  DISK = N'C:BKPDBVMwareSSoRSA.bak' WITH NOFORMAT, NOINIT,  NAME = N'RSA-Vollständig Datenbank Sichern', SKIP, NOREWIND, NOUNLOAD,  STATS = 10
GO

vmware-vcenter.sql:

BACKUP DATABASE [VIM_VCDB] TO  DISK = N'C:BKPDBvCenterServerVIM_VCDB.bak' WITH NOFORMAT, NOINIT,  NAME = N'VIM_VCDB-Vollständig Datenbank Sichern', SKIP, NOREWIND, NOUNLOAD,  STATS = 10
GO
Secured By miniOrange