OBIEE11g
Script metadata generation
After deploying your RPD for a
couple of time you will have noticed the nice versioning OBIEE does:
Problem with this versioning is that you loose your Meta Data Dictionary (MDD) setup every time you deploy a new rpd.
Actually this is good since a new RPD should mean that al your changes end up in the MDD. Especially on development systems where updates are done on & off-line, the MDD will soon be out of sync.
Why not set up a job which simple refreshes the old and adds the new onces.
WARNING This script uses the /Command for the admin tool which is NOT supported (or documented)
Let´s start with a VB script:
On Error Resume Next
Dim fso, folder, files, NewFileP, NewFile, RPDFolder, MDFolder, delfolder, AdminUser, AdminPassword, WshShell
Set fso = CreateObject("Scripting.FileSystemObject")
'Be sure there is no \ at the end of the repository folder
if right(Parameter(0),1) = "\" then
RPDFolder = left(Parameter(0), len(Parameter(0), -1))
else
RPDFolder = Parameter(0)
end if
'Be sure there is no \ at the end of the repository folder
if right(Parameter(1),1) = "\" then
MDFolder= left(Parameter(1), len( MDFolder= Parameter(1), -1))
else
MDFolder= Parameter(1)
end if
AdminUser = Parameter(2)
AdminPassword = Parameter(3)
Set folder = fso.GetFolder(RPDFolder)
Set files = folder.Files
For each folderIdx In files
'loop trough the rpd files
if right(folderIdx.Name,3) = "rpd" then
'Delete the "old" meta data
NewFileP.WriteLine( folderIdx.Name)
set delfolder = fso.GetFolder(MDFolder&"\"&left(folderIdx.Name,len(folderIdx.Name)-4))
delfolder.Delete
Set NewFile = fso.CreateTextFile(RPDFolder&"\nqGenerateMetaData"& left(folderIdx.Name,len(folderIdx.Name)-4) &".txt", True)
'Add instructions to the \nqGenerateMetaData.txt file
NewFile.WriteLine( "Open "& RPDFolder &"\" &left(folderIdx.Name,len(folderIdx.Name)-4) & " " & AdminUser & " "& AdminPassword & " "& AdminPassword)
NewFile.WriteLine( "Hide")
NewFile.WriteLine( "GenerateMetadataDictionary " & MDFolder & "\" )
NewFile.WriteLine( "DescribeRepository " & MDFolder & "\"&left(folderIdx.Name,len(folderIdx.Name)-4) & "\REPOS.XML UTF-8")
'add the closing commands
NewFile.WriteLine( "Close")
NewFile.WriteLine( "Exit")
NewFile.Close
'run the script
Set WshShell = CreateObject("WScript.Shell")
WshShell.run ( "D:\OBIEE\Oracle_BI1\bifoundation\server\bin\AdminTool.exe /command " & RPDFolder& "\nqGenerateMetaData"& left(folderIdx.Name,len(folderIdx.Name)-4) &".txt")
Set NewFileD = fso.CreateTextFile("d:\xslcopy" & left(folderIdx.Name,len(folderIdx.Name)-4) &".bat", True)
NewFileD.WriteLine ( "MD " & MDFolder & "\" & left(folderIdx.Name,len(folderIdx.Name)-4)& "\xsl")
NewFileD.WriteLine( "COPY D:\OBIEE_REP\Scripts\MetaDataDictionary\xsl\*.* " & MDFolder & "\" & left(folderIdx.Name,len(folderIdx.Name)-4)& "\xsl")
NewFileD.close
WshShell.run ("d:\xslcopy" & left(folderIdx.Name,len(folderIdx.Name)-4) &".bat")
End if
Next
Put it in a file called “AutomateMetaDir.vbs”
The GenerateMetadataDictionary
command in 11g doesn’t created the proper XSL directory from the command line.
Create one from a manual export and put it in your script directory so you can
copy it when needed.
Create a new job to refresh every thing once every x hours.
Don’t forget the parameters:
No comments:
Post a Comment