We are using OBI EE 10.1.3.4. The catalog folder in our environments is keep growing and it almost reached 4GB. On analysis, we found that this unusual growth is linked to Alerts in dashboard. We raised SR with oracle and there is no config settings / workaround for deleting old files.
We found that all files under \_delivers or \_deliveries are taking lot of space. Finally we came with a simple vb script which deletes all the file (except _deliveries.atr) of 60 day old.
It reduced catalog folder size from 4GB to 2.8 GB(almost 1.2 GB )
Here is the script..
'==========================================================================
Option Explicit
On Error Resume Next
'==========================================================================
'DECLARATION OF VARIABLES
'==========================================================================
Dim sDirectoryPath, objFSO, oLogFile
Public pLogFile, pTabspace, pDaysOld, pFolderName, pextndpath, pFilenamelen
'==========================================================================
'Setting of Arguments
'==========================================================================
If WScript.Arguments.Count = 3 then
sDirectoryPath = wscript.arguments(0)
pLogFile = wscript.arguments(1)
pDaysOld = wscript.arguments(2)
pFolderName = Ucase("_delivers")
pextndpath = Ucase("_deliveries")
pTabspace = chr(9) & chr(9)
pFilenamelen = 100
else
Set objFSO = CreateObject("Scripting.FileSystemObject")
If not objFSO.fileexists( Replace(WScript.ScriptFullName, WScript.ScriptName, "") & "FileDeletionScript_ERROR.Log") Then
objFSO.CreateTextFile(Replace(WScript.ScriptFullName, WScript.ScriptName, "") & "FILEDELETIONSCRIPT_ERROR.Log")
End if
set oLogFile = objFSO.OpenTextFile(Replace(WScript.ScriptFullName, WScript.ScriptName, "") & "FileDeletionScript_ERROR.Log",8,True)
oLogFile.WriteLine(now() & " " & "Error Executing script - Insufficient Arguments supplied(3 Needed, but " & WScript.Arguments.Count & " supplied)")
oLogFile.Close
wscript.quit
end if
'==========================================================================
'MAIN PROGRAM
'==========================================================================
Set objFSO = CreateObject("Scripting.FileSystemObject")
If not objFSO.fileexists(pLogFile) Then
objFSO.CreateTextFile(pLogFile)
set oLogFile = objFSO.OpenTextFile(pLogFile,8,True)
oLogFile.WriteLine("*****************" & ptabspace & "*********" & ptabspace & "******************" & pTabSpace & "****************")
oLogFile.WriteLine("Time of Execution" & ptabspace & "File Name" & ptabspace & "Last Modified Date" & pTabSpace & "Path Of the File")
oLogFile.WriteLine("*****************" & ptabspace & "*********" & ptabspace & "******************" & pTabSpace & "****************")
oLogFile.Close
End if
Call ShowFolderList (sDirectoryPath)
Wscript.Echo "End Of Execution"
WScript.Quit
'==========================================================================
'FUCTION TO ACCESS FOLDERS & ITS SUB FOLDERS (RECURSIVE)
'==========================================================================
Function ShowFolderList(sDirectoryPath)
on error resume next
'wscript.echo "Showfolderlist " & sDirectoryPath
Dim oFSO, oFolder, OSubfolders, folder
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder(sDirectoryPath)
Set OSubfolders = oFolder.SubFolders
For Each folder in OSubfolders
if strcomp(UCase(folder.name),pFolderName) = 0 Then
Call ATRFileList (folder.path)
if ofso.folderexists (folder.path & "\" & pextndpath) then
Call ShowFileList (folder.path & "\" & pextndpath)
end if
exit function
else
Call ShowFolderList (folder.path)
end if
Next
' GARBAGE COLLECTION OF VARIABLES
'==========================================================================
Set oFSO = Nothing
Set oFolder = Nothing
Set OSubfolders = Nothing
Set folder = Nothing
End Function
'==========================================================================
'FUNCTION DECLARATION TO ACCESS/DELETE FILES WITHIN _DELIVERIES FOLDER & TO LOG THE EVENT IN A LOG FILE
'==========================================================================
Function ShowFileList(sDirectoryPath)
on error resume next
'wscript.echo "show FILE list " & sDirectoryPath
Dim oFSO, oFolder, oFileCollection, oFile, oLogFile
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder(sDirectoryPath)
Set oFileCollection = oFolder.Files
If oFileCollection.Count > 0 Then
For each oFile in oFileCollection
If oFile.DateLastModified < (Date() - pDaysOld) Then set oLogFile = oFSO.OpenTextFile(pLogFile,8,True) oLogFile.WriteLine(now() & ptabspace & oFile.Name & Space(pFilenamelen-len(ofile.name)) & ptabspace & oFile.DateLastModified & pTabSpace & oFile.path) oLogFile.Close oFile.Delete(true) End If Next End If ' GARBAGE COLLECTION OF VARIABLES '========================================================================== Set oFSO = Nothing Set oFolder = Nothing Set oFileCollection = Nothing Set oFile = Nothing Set oLogfile = Nothing End Function '========================================================================== 'FUNCTION DECLARATION TO ACCESS/DELETE ATR FILES WITHIN _DELIVERS FOLDER & TO LOG THE EVENT IN A LOG FILE '========================================================================== Function ATRFileList(sDirectoryPath) 'wscript.echo "show FILE list " & sDirectoryPath Dim oFSO, oFolder, oFileCollection, oFile, oLogFile Set oFSO = CreateObject("Scripting.FileSystemObject") Set oFolder = oFSO.GetFolder(sDirectoryPath) Set oFileCollection = oFolder.Files If oFileCollection.Count > 0 Then
For each oFile in oFileCollection
If (oFile.DateLastModified < (Date() - pDaysOld)) AND (strcomp(UCase(oFile.name),UCase("_deliveries.atr"))<>0) Then
set oLogFile = oFSO.OpenTextFile(pLogFile,8,True)
oLogFile.WriteLine(now() & ptabspace & oFile.Name & Space(pFilenamelen-len(ofile.name)) & ptabspace & oFile.DateLastModified & pTabSpace & oFile.path)
'wscript.echo oFile.Name& pTabSpace & oFile.path
oLogFile.Close
oFile.Delete(true)
End If
Next
End If
' GARBAGE COLLECTION OF VARIABLES
'==========================================================================
Set oFSO = Nothing
Set oFolder = Nothing
Set oFileCollection = Nothing
Set oFile = Nothing
Set oLogfile = Nothing
End Function
'==========================================================================
Thanks
About Big Data (1)
10 hours ago
0 comments:
Post a Comment