Archival of old OBIEE RPD File

Archival of old OBIEE RPD File
Every time a modified RPD is promoted through weblogic or WLST and python scripts, a new version of the RPD file get’s created with a version number suffix (for example, SampleApp_bi001.rpd). This version number is incremented each time repository is uploaded. Depending on RPD modification changes, we have seen more than 100 versions of the RPD files in a year in DEV env.

Another major issue we noticed that after certain version number ( Oracle couldn’t provide settings where max version number is set), after promoting new RPD, the version number resets back to some random value and old RPD file get’s deployed.

To avoid old RPD getting deployed and to keep RPD folder (\\\instances\instance1\bifoundation\OracleBIServerComponent\coreapplication_obis1\repository)clean, I have developed a python script which keeps 3 latest versions of RPD and archives rest of the versions.

RPDArichival.py


import shutil
import os

# Change path of the source folder
path="/oracle/middle/instances/instance1/bifoundation/OracleBIServerComponent/coreapplication_obis1/repository"

source = os.listdir(path)

largest=None
smallest=None

# Calculate min and max version numbers of the RPD file
# RPD name SampleApp_BI0013.rpd

for files in source:
  if len(files) > 7:
          num=int(files[12:16])
   if largest is None:
        largest = num
    elseif num > largest:
        largest = num

    if smallest is None:
         smallest = num
   elseif num < smallest:
         smallest = num

# Initialize a counter to count number of files moved to archive folder

j=0
# Keeping latest 3 RPD version files
for i in range (smallest, largest-2):
    for files in source:
        if len(files) > 7:
          mmn=int(files[12:16])
         if i == mmn:
               j=j+1
               src = path +"/"+files
               dst = "/oracle/middle/instances/instance1/bifoundation/OracleBIServerComponent/coreapplication_obis1/repository/archive"+"/"+files
                shutil.move(src, dst)
print j, "files are moved"
 

Leave a Comments

Your browser doesn't support the canvas element - please visit in a modern browser.

(new shape)