Cleaning up Orphaned Files
There have been a couple issues / bugs in the past which have resulted in orphaned files in the input or output file repository servers (FRS). The scripts on this page were created to help clean up the FRS servers so there aren’t any excess files taking up room.
All of these scripts were written in VBScript and designed for BOE XI R2, however they will generally work on BOE XI R3 as well (Although they are not supported when run on BOE XI R3)
Note:
For other scripts and information on how to run these scripts see here:
https://scn.sap.com/people/shawn.penner/blog/2013/06/04/scripts-and-samples
Scan and Clean FRS Servers
This script will scan the input and output FRS for files that do not have corresponding entries in enterprise and delete them. It will also delete the folders left over after removing the orphaned objects. The way it determines if a matching InfoObject exists is by assuming that the folder name at the deepest level is the SI_ID of the object. If an object with that SI_ID exists on the Enterprise Server, then that object is assumed to be valid.
Notes:
- You will need to change the username, password, and CMS name to the values specific to your enterprise server. It is highly recommended that you use the Administrator user as other users may not be able to see all the objects on the enterprise server. And if the script can’t see the object – it assumes that it doesn’t exist and removes the corresponding files.
- This script creates a log file in “C:output.log” which stores the results of the script running
- To run this script in test mode, set the DoDelete variable to false. To take it out of test mode, set the DoDelete variable to True
- This script must be run on the server where the FRS is physically located – or where you have a direct path to the FRS folder location.
- You will need to change the inputFRSRoot and outputFRSRoot to the base folder of your filestores
- Default location for XI R2:
- “C:Program FilesBusiness ObjectsBusinessObjects Enterprise 11.5FileStoreInput”
- “C:Program FilesBusiness ObjectsBusinessObjects Enterprise 11.5FileStoreOutput”
- Default location for XI R3:
- “C:Program Files (x86)Business ObjectsBusinessObjects Enterprise 12.0FileStoreInput”
- “C:Program Files (x86)Business ObjectsBusinessObjects Enterprise 12.0FileStoreOutput”
- Default location for XI R2:
- The path to the input and output FRS must not have a slash at the end or the script will not work.
- If you are running this on a 64-bit OS such as Windows 7, you will need to specify the 32-Bit version of cscript in order to run it succesfully. Otherwise you will encounter the error “ActiveX component can’t create object: ‘CrystalEnterprise.SessionMgr’ “.
e.g.
%windir%SysWOW64cscript.exe scanfrs.vbs
Scan and Clean Input and Output FRS |
---|
Dim DoDelete DoDelete = False ‘ False = Test Mode, True = Actually Delete the Files ‘Declare CMS logon variables CMS = “localhost” ‘Declare variables for Enterprise Session ‘ File IO stuff ‘Open the outputFile for logging. outputFile.WriteLine(“——– Starting Script ——–“) ‘Load the Enterprise Session Manager ‘Logon to the CMS and create iStore object outputFile.WriteLine(“Input FRS Root = ” & inputFRSRoot) ‘ Now that we have the root folders – we need to loop through them and drill down to the deepest level Dim finalOutput ‘ Scan the Input FRS ‘ Scan the Output FRS outputFile.WriteLine(“All Done”) ‘ Clean everything up Function CheckAndDelete(DoDelete, iStore, objFSO, outputFile, fileRoot) ‘ Set it initially to not delete the folder Set boFolder = objFSO.GetFolder(fileRoot) ‘ Get a count of the files in this folder, and a count of the sub-folders ‘ Are there files here – then we need to check if the matching SI_ID exists ‘ If the count is 0 – then this is an orphan ‘ Set the delete flag to true to tell the function one up the recursive stack to remove this folder For Each boSubFolder in boFolder.SubFolders |
Parse RepoScan XML
This next script doesn’t actually use an BusinessObjects SDK’s to clean out the Input and Output FRS. Instead it relies on the use of the RepoScan tool to identify mismatches between the CMS database and what is on disk.
Notes:
- You will need to run the RepoScan tool to generate a log file. To run RepoScan, do the following:
- Create an options.txt file. I have pasted an example below:
-dbdriver mysqldatabasesubsystem
-inputfrsdir “C:Program FilesBusiness ObjectsBusinessObjects Enterprise 12.0FileStoreInput”
-outputfrsdir “C:Program FilesBusiness ObjectsBusinessObjects Enterprise 12.0FileStoreOutput”
-connect UID=sa;PWD=bopassword123;DSN=BOE120;HOSTNAME=MyEnterpriseServer;
-outputdir c:
-repair falseThe above options file specifies what database is used, the location of the input and output FRS, the database connection string, where to store the log file that is generated, and whether or not to try and repair the issues.
- Once you have the options.txt file, go into the folder C:Program FilesBusiness ObjectsBusinessObjects Enterprise 12.0win32_x86 (For BOE XI R2) and execute the command:
reposcan -optionsfile c:options.txt
where c:options.txt is the location of the options file.
- This will generate a log file with a title “Repo_Scan_
.xml” and it will be located in the output directory specified above (in this case c:)
- Create an options.txt file. I have pasted an example below:
- You will need to change the file path in the script to the location of the xml file generated by RepoScan.
- If you are running this on a 64-bit OS such as Windows 7, you may need to specify the 32-Bit version of cscript in order to run it succesfully. Otherwise you might encounter error “ActiveX component can’t create object: ‘Scripting.FileSystemObject’ “.
e.g.
%windir%SysWOW64cscript reposcanxmlparser.vbs
RepoScan XML Parser |
---|
Dim xmlDoc Set filesys = CreateObject(“Scripting.FileSystemObject”) strQuery = “/ScanResults/File” For Each objItem in colItem WScript.Echo “Manually Deleting File: ” + fpath + fname ‘WScript.Echo objItem.nodeName & “: ” & objItem.text |
New NetWeaver Information at SAP.com
Very Helpfull