BOXI3 - Automatic BIAR generation

BOXI3 - Automatic BIAR generation

Posted By: pmietlicki

Published to Business Objects on Jun 23, 2017

Script available inside this archive file : export_biar.zip

A java program (biarengine.jar) offers the possibility to generate automatically BIAR files. And that's much more convenient than a backup of the database that you must do offline in conjunction with the backup of the entire file repository... I included this biarengine.jar inside a VBS script in order to generate periodically a complete backup of your referential, it is easier to restore in case of a problem. Moreover, you can select part of your repository to restore, for example, you could choose to restore only a Web Intelligence file along with the universe associated to it thanks to the "import tool".

This script generates an "export.properties" file (in the same place where the script is located) and then launch the biarengine to generate the BIAR files in the place you want thanks to the sDiskSav and sRepSav variables. By default, it will keep the last 7 days backups but you can change this value.

Don't forget to change this part by putting the administrator password. The administrator access is mandatory to generate a BIAR file.

objFile.WriteLine("password=password")

Here's the source code :

'export_biar.vbs - Expor the BO referential in BIAR files
'© Pascal MIETLICKI - 02/02/2011 16:04
'@Param :
'sRepLib : java library folder of BO
'sDiskSav : backup disk for writing BIAR files
'sRepSav : backup folder where writing BIAR
 

Set oShell = CreateObject("WScript.Shell")
Set oProcEnv = oShell.Environment("PROCESS")
'Pour recuperer le chemin de ProgramFiles
sProgramFiles = oProcEnv("ProgramFiles")
'The folder where the java libraries of BO and the biarengine.jar are located
sRepLib = "\Business Objects\common\4.0\java\lib"
'Backup disk
sDiskSav = "S:"
'The folder where to export backups located inside the backup disk
'If this folder does not exist, it will be created
sRepSav = "BIAR"
 
today = year(Date) & _
 right("0" & month(date), 2) & _
 right("0" & day(date), 2)
 
strFile = "export.properties"
 
' Create the File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(strFile)
objFile.WriteLine("#To export a biar of all files of your BO server")
objFile.WriteLine("exportBiarLocation=" & sDiskSav & "/" & sRepSav & "/" & today &"_REF_BACKUP.biar")
objFile.WriteLine("action=exportXML")
objFile.WriteLine("userName=Administrator")
 
'You must indicate the administrator password and the connection to your CMS below (@clustername or @ip or DNS name of your server)
objFile.WriteLine("password=password")
objFile.WriteLine("CMS=@cluster")
objFile.WriteLine("authentication=secEnterprise")
objFile.WriteLine("exportDependencies=true")
objFile.WriteLine("includeSecurity=true")
objFile.WriteLine("exportQuery1=select TOP 1000000 * from ci_Infoobjects")
objFile.WriteLine("exportQuery2=select TOP 1000000 * from ci_Appobjects")
objFile.WriteLine("exportQuery3=select * from ci_Systemobjects")
objFile.WriteLine("exportQueriesTotal=3")
objFile.Close
 
if sDiskSav = "" then wscript.quit(0)
if sRepSav = "" then wscript.quit(0)
set oFSO = CreateObject("Scripting.FileSystemObject")
 
'This part will keep the last 7 days of backup
'Change this number if you prefer to keep more (or less) backups
If oFSO.FolderExists(sDiskSav & "\" & sRepSav) Then
 For each oFile in oFSO.GetFolder(sDiskSav & "\" & sRepSav).Files
 if datediff("d",oFile.DateCreated, Now()) > 7 Then
 oFile.Delete
 end if
 next
end if
 
'MsgBox "java.exe -jar " & chr(34) & sProgramFiles &sRepLib & "\biarengine.jar" & chr(34)
Set objShell = CreateObject("WScript.Shell")
Set objWshScriptExec = objShell.Exec("java.exe -jar " & chr(34) & sProgramFiles & sRepLib & "\biarengine.jar" & chr(34) & " export.properties")
Set objStdOut = objWshScriptExec.StdOut
strOutput = objStdOut.ReadAll
'WScript.Echo strOutput
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objFileOutput = objFS.CreateTextFile(sDiskSav & "\" & sRepSav & "\" & today & "_logs.txt")
objFileOutput.WriteLine(strOutput)
objFileOutput.Close
 
set oShell = nothing
set oProcEnv = nothing
set sProgramFiles = nothing
set sRepLib = nothing
set sDiskSav = nothing
set sRepSav = nothing
set strFile = nothing
set objFSO = nothing
set objFile = nothing
set oFSO = nothing
set objShell = nothing
set objWshScriptExec = nothing

Tags: BIAR, BO, BOXI, BOXI3, vbs

Archive