Skip to end of metadata
Go to start of metadata

Purpose

Scheduling BPC MS environments (application-set) backup may be really useful for the administration of the BPC platforms.

However, currently, that is not possible through the BPC Server Manager.

This WIKI page shows how to do this via scripts.

Overview

The backup of a BPC 10 MS environment (application-set for the previous versions) consists of the copy of 3 elements :

- FileDB directory

- SQL Database backup

- WebFolder directory

Once saved, these 3 folders are archived within a zip file.

Typically, generating regular backups is an administration task that is MANUALLY done through the BPC Server Manager by a system administrator of the BPC environment.

Note : The scripts used in this WIKI have been created for BPC MS 10 on SQL Server 2008 R2. Some adjustments will be necessary to be usable on the previous versions of the application and SQL.

Prerequisites

The implementation of the following script examples proposed in this WIKI requires the definition of the following parameters :

- ENVIRONMENTNAME : Name of the environment to backup

- BPCDATAFOLDER : Path of the BPC Data Folder

- BACKUPDIRECTORY : Local directory to store backups gneratated

- LOGFILE : path where technical log files will be generated during the script executions

- SQLBIN : SQL Client binary directory

- SQLSERVER : SQL Server name hosting BPC SQL databases

- SQLSERVERINSTANCENAME : The name of the SQL Instance

(If none dedicated SQL instance is used then SQLSERVERINSTANCENAME=SQLSERVER)

- SQLBACKUPFOLDER : SQL Directory where DB backups are stored on the SQL Server (local path)

- REMOTESQLBACKUPFOLDER : The UNC address to the SQL backup folder

Notes :

- The third party software 7zip is used to generate the .zip archives of the 3 directories (FileDB, SQL Database backup, WebFolder). Other tools can be used to create zip archives.

- The following scripts are executed from a BPC server.

Scripting

Script to stop the SAP BPC MS application

The BPC environment backup has to be done while the application is "stopped" (services and COM+ stopped).

To do this we use the script Stop_BPC.bat that also calls the .vbs StopComPlus.vbs

Stop_BPC.bat :

-----------------------------------------------------------------------------------------------------------------------------------

REM -- This script stops services and COM+ components used by BPC application 

REM -------------------------------------------------------------------------

REM ------------------------------------------------------------------------- 

REM -- SCRIPT PARAMETERS

REM ------------------------------------------------------------------------- 

REM -- SCRIPTDIRECTORY: Location of the StopComPlus.vbs script 

REM -- LOGFILE: Location of the log generated by the script execution 

REM -------------------------------------------------------------------------

SET SCRIPTDIRECTORY=E:\BPC_SCRIPTS 

SET LOGDIRECTORY=E:\Log 

SET LOGFILE=%LOGDIRECTORY%\STOP_BPC.log

mkdir %LOGDIRECTORY%

ECHO [%DATE%] [%TIME%] - START of SCRIPT >> %LOGFILE%

ECHO [%DATE%] [%TIME%] - Stop Microsoft IIS Service >> %LOGFILE% 

iisreset /stop >> %LOGFILE%

ECHO [%DATE%] [%TIME%] - Stop SAP BPC Services >> %LOGFILE%

net stop "BPC SendGovernor Service" >> %LOGFILE% 

net stop "BPC CTS ServiceManager Service" >> %LOGFILE% 

net stop "BPC ServiceManager Service" >> %LOGFILE%

ECHO [%DATE%] [%TIME%] - Stop SSIS >> %LOGFILE%

sc stop "MsDtsServer100" >> %LOGFILE%

ECHO [%DATE%] [%TIME%] - Stop COM+ Components >> %LOGFILE%

cscript %SCRIPTDIRECTORY%\StopComPlus.vbs >> %LOGFILE%

ECHO [%DATE%] [%TIME%] - END of SCRIPT >> %LOGFILE%

----------------------------------------------------------------------------------------------------------------------------------- 

StopComPlus.vbs (called by the previous script to stop COM+ components) :

-----------------------------------------------------------------------------------------------------------------------------------

Dim oApplications 'As COMAdminCatalogCollection

Dim oCatalog 'As COMAdminCatalog 

Dim oApp 'As COMAdminCatalogObject

Set oCatalog = CreateObject("ComAdmin.COMAdminCatalog")

Set oApplications = oCatalog.GetCollection("Applications")

oApplications.Populate

Wscript.Echo "Closing " & oApplications.Count & " applications."

For Each oApp In oApplications

      'Must shut down system application last.

         If oApp.Name <> "System Application" Then

               Wscript.Echo "Shutting down " & oApp.Name

               Call oCatalog.ShutdownApplication(oApp.Name)

          End If 

Next 'oApp

Wscript.Echo "Shutting down System Application" 

Call oCatalog.ShutdownApplication("System Application")

Wscript.Echo "Completed shutdown process.  Exiting"

Set oApp = Nothing

Set oApplications = Nothing 

Set oCatalog = Nothing

-----------------------------------------------------------------------------------------------------------------------------------

Script to generate the BPC environment backups

To do this, the script Environment_backup.bat is used :

-----------------------------------------------------------------------------------------------------------------------------------

REM ----------------------------------------------------- 

REM -- Backup SAP BPC 10.0 APPSET 

REM -- Creation Date : DD/MM/YYYY

REM -----------------------------------------------------

REM ----------------------------------------------------- 

REM -- SCRIPT PARAMETERS 

REM ----------------------------------------------------- 

REM -- ENVIRONMENTNAME: Name of the environment to backup 

REM -- BPCDATAFOLDER: BPC Data Folder 

REM -- BACKUPDIRECTORY: Local directory to store backup 

REM -- LOGFILE: Technical log file 

REM -- SQLBIN: SQL Client binary directory 

REM -- SQLSERVER: SQL server name hosting Environment DB 

REM -- SQLSERVERINSTANCENAME: The name of the SQL Instance. 

REM -- SQLBACKUPFOLDER: DB backup folder on SQL Server 

REM -- REMOTESQLBACKUPFOLDER: The UNC address to the DB backup folder 

REM ----------------------------------------------------- 

REM -- Others parameters will be automatically generated 

REM -----------------------------------------------------

SET ENVIRONMENTNAME=Environmentshell 

SET BPCDATAFOLDER=E:\PC_MS\Data 

SET BACKUPDIRECTORY=E:\BackupBPC 

SET LOGFILE=E:\log%ENVIRONMENTNAME%_Backup.log 

SET SQLBIN=C:\Program Files\Microsoft SQL Server\100\Tools\Binn 

SET SQLSERVER=EPM-BPC  SET SQLSERVERINSTANCENAME=EPM-BPC\BPC

SET SQLBACKUPFOLDER=E:\Program Files\Microsoft SQL Server\MSSQL10_50.BPC\MSSQL\Backup 

SET REMOTESQLBACKUPFOLDER=\\%SQLSERVER%\E$\Program Files\Microsoft SQL Server\MSSQL10_50.BPC\MSSQL\Backup

SET BackupDirectoryEnvironment=%BackupDirectory%%ENVIRONMENTNAME% 

SET WebFolderBackupDirectory=%BackupDirectoryEnvironment%\WebFolder 

SET FileDBBackupDirectory=%BackupDirectoryEnvironment%\FileDB 

SET SQLDBBackupDirectory=%BackupDirectoryEnvironment%\SQL

REM ----------------------------------------------------- 

REM -- Batch starting 

REM ----------------------------------------------------- 

ECHO [%DATE%] [%TIME%] - Start backup >> %LOGFILE%

REM ----------------------------------------------------- 

REM -- STEP 1: Clean up old backup if exist 

REM ----------------------------------------------------- 

ECHO [%DATE%] [%TIME%] - CLEAN LAST BACKUP >> %LOGFILE% 

rmdir /S /Q %WebFolderBackupDirectory% 

rmdir /S /Q %FileDBBackupDirectory% 

rmdir /S /Q %SQLDBBackupDirectory%

REM ----------------------------------------------------- 

REM -- STEP 2: Backup "WebFolder" Directory 

REM ----------------------------------------------------- 

ECHO [%DATE%] [%TIME%] - WEBFOLDER BACKUP >> %LOGFILE%

ECHO [%DATE%] [%TIME%] - CREATE BACKUP DIRECTORY >> %LOGFILE% 

mkdir %WebFolderBackupDirectory%

ECHO [%DATE%] [%TIME%] - WebFolder Copy >> %LOGFILE% 

"C:\Program Files\7-Zip\7z" a -tzip %WebFolderBackupDirectory%%ENVIRONMENTNAME%.zip %BPCDATAFOLDER%\Webfolders%ENVIRONMENTNAME% 

* >> %LOGFILE%

REM ----------------------------------------------------- 

REM -- STEP 3: Backup "FileDB" Directory 

REM ----------------------------------------------------- 

ECHO [%DATE%] [%TIME%] - FILEDB BACKUP >> %LOGFILE% 

ECHO [%DATE%] [%TIME%] - CREATE BACKUP DIRECTORY >> %LOGFILE% 

mkdir %FileDBBackupDirectory%

ECHO [%DATE%] [%TIME%] - FileDB Copy >> %LOGFILE% 

"C:\Program Files\7-Zip\7z" a -tzip %FileDBBackupDirectory%%ENVIRONMENTNAME%.zip %BPCDATAFOLDER%\FileDB%ENVIRONMENTNAME% 

* >> %LOGFILE%

REM ----------------------------------------------------- 

REM -- STEP 4: Backup SQL DataBase 

REM ----------------------------------------------------- 

ECHO [%DATE%] [%TIME%] - SQLDB BACKUP >> %LOGFILE% 

ECHO [%DATE%] [%TIME%] - CREATE BACKUP DIRECTORY >> %LOGFILE% 

mkdir %SQLDBBackupDirectory%

ECHO [%DATE%] [%TIME%] - Full BackupFile Creation handled by SQL Server >> %LOGFILE% 

"%SQLBIN%\osql.exe" -S %SQLSERVERINSTANCENAME% -E -Q "BACKUP DATABASE %ENVIRONMENTNAME% TO DISK='%SQLBACKUPFOLDER%%ENVIRONMENTNAME%.bak' WITH FORMAT"

>> %LOGFILE%

xcopy "%REMOTESQLBACKUPFOLDER%%ENVIRONMENTNAME%.bak" "%SQLDBBackupDirectory%" >> %LOGFILE% 

del "%REMOTESQLBACKUPFOLDER%%ENVIRONMENTNAME%.bak" >> %LOGFILE%

REM -----------------------------------------------------

REM -- STEP 5: Create the Archive File for Environment 

REM ----------------------------------------------------- 

SET ZIPFile=%DATE:4%%DATE:10,-8%%DATE:~-7,-5%_%ENVIRONMENTNAME%.zip

ECHO [%DATE%] [%TIME%] - Create ZIP ARCHIVE >> %LOGFILE% 

"C:\Program Files\7-Zip\7z" a -tzip %BackupDirectory%%ZIPFile% %BackupDirectoryEnvironment% >> %LOGFILE%

ECHO [%DATE%] [%TIME%] - End Backup >> %LOGFILE%

-----------------------------------------------------------------------------------------------------------------------------------

Script to start the SAP BPC MS application

This script Start_BPC.bat is used to restart the services used by BPC:

-----------------------------------------------------------------------------------------------------------------------------------

REM -- This script makes the BPC application available 

REM --------------------------------------------------- 

REM -- SCRIPT PARAMETERS 

REM ------------------------------------------------------------------------- 

REM -- LOGFILE: Location of the log generated by the script execution 

REM -------------------------------------------------------------------------

SET LOGFILE=E:\log\START_BPC.log

ECHO [%DATE%] [%TIME%] - START of SCRIPT >> %LOGFILE%

ECHO [%DATE%] [%TIME%] - Starting BPC Services >> %LOGFILE% 

net start "BPC SendGovernor Service" >> %LOGFILE% 

net start "BPC CTS ServiceManager Service" >> %LOGFILE% 

net start "BPC ServiceManager Service" >> %LOGFILE%

ECHO [%DATE%] [%TIME%] - start SSIS >> %LOGFILE% 

sc start "MsDtsServer100" >> %LOGFILE% 

sc start "ReportServer" >> %LOGFILE%

ECHO [%DATE%] [%TIME%] - Start Microsoft IIS Service >> %LOGFILE%

iisreset /start >> %LOGFILE%

ECHO [%DATE%] [%TIME%] - END of SCRIPT >> %LOGFILE%

-----------------------------------------------------------------------------------------------------------------------------------

Conclusion

The scripts provided as examples can be amended according to environments/needs, they can be put together in a unique file etc..

Once implemented, simple Windows scheduled tasks allow to automate the script executions and thus having the BPC backup generated automatically.

Related Content

Related Documents 

[CPM:Best Practices for Backup on BPC for Microsoft]