作者:shawn.penner,现就职于SAP
原文地址(英语):
过去的时间里,已经有一些问题和漏洞会在产生垃圾文件,存放于输入/输出文件资源服务器上(FRS)。这个页面里的脚本旨在创建一个清理FRS服务器的工具,来保证不产生多余的文件来占用空间。
所有的这些脚本都是用VBScript编写的,而且为了BOE XI R2设计,但是一般来讲,它们也会在BOE XI R3上面生效。(尽管他们在BOE XI R3上不被支持)
更多其他的脚本和信息,关于如何运行脚本,可以在这里找到:
这个脚本将会对输入和输出的FRS里面无响应的文件进行扫描,并且删除它们。它同样会删除文件移除后残留的文件夹。它运作的方法是,如果一个相对应的InfoObject存在,假设最低级别的文件夹名字就是这个对象的SI_ID。如果这个有SI_ID的对象存在于Enterprise Server里面,那么这个对象就被假定为有效。
XI R2的默认位置:
"C:\Program Files\Business Objects\BusinessObjects Enterprise 11.5\FileStore\Input"
"C:\Program Files\Business Objects\BusinessObjects Enterprise 11.5\FileStore\Output"
XI R3的默认位置:
"C:\Program Files (x86)\Business Objects\BusinessObjects Enterprise 12.0\FileStore\Input"
"C:\Program Files (x86)\Business Objects\BusinessObjects Enterprise 12.0\FileStore\Output"
例如:%windir%\SysWOW64\cscript.exe scanfrs.vbs
扫描和清理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
' 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 |
接下来的脚本实际上没有使用BusinessObjects的SDK来清理输入和输出FRS。相反它利用了RepoScan工具来鉴定CMS数据库和磁盘上存放的不匹配情况。
·创建一个options.txt文件,我已经把一个示例贴在下面:
-dbdriver mysqldatabasesubsystem
-inputfrsdir "C:\Program Files\Business Objects\BusinessObjects Enterprise 12.0\FileStore\Input"
-outputfrsdir "C:\Program Files\Business Objects\BusinessObjects Enterprise 12.0\FileStore\Output"
-connect UID=sa;PWD=bopassword123;DSN=BOE120;HOSTNAME=MyEnterpriseServer;
-outputdir c:\
-repair false
上面的这些选项鉴别了:文件使用的什么数据库,输入和输出FRS保存位置,数据库连接字符串,生成的日志文件存放在哪里,是否要尝试和修复问题。
·一旦你生成了options.txt 文件,到下面的目录 C:\Program Files\Business Objects\BusinessObjects Enterprise 12.0\win32_x86 (For BOE XI R2)执行命令:
reposcan -optionsfile c:\options.txt
c:\options.txt就是配置文件所在的位置。
·这回生成一个日志文件,名为 "Repo_Scan_<Date and Time>.xml",它会生成在上面特定的输出目录下(在这里是C:\)。
例如:%windir%\SysWOW64\cscript reposcanxmlparser.vbs
解析RepoScan XML |
---|
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 |