My Blog

Welcome to OBIEE 12c: Using BI Application Archive (BAR) files

by Paul Cannon on 13th January 2016 24 comments

BI Application Archive (BAR) files are zipped-up copies of the RPD, Catalog and Security model metadata from a Service Instance. When deploying your BI application from one server to another you can now use these BAR files to transfer your metadata rather than transferring the RPD, catalog and security model separately. It’s also a simple method of taking point in time backups of your application.

There is no web based tool for administering BAR files, it’s all done at command line through the Weblogic Scripting Tool (WLST) which is invoked with the following command:

<obiee_home>/oracle_common/common/bin/wlst.sh

(or wlst.cmd for windows)

obiee12c_BAR_image1

A quick aside…to exit from the WLST command line use the exit() command – you must include the two brackets, ‘exit’ by itself doesn’t work!

Also note that all WLST commands are case sensitive and do include both upper and lower case letters, so the listBIServiceInstances command below cannot be spelt listbiserviceinstances.

Before we look at the commands for exporting & importing BAR files, there are some parameters you will need to know before we start.

Domain Home: This is the directory of the domain for your BI Install, this will usually be <obiee_home>/user_projects/domains/bi

Service Instance Key: The instance key of the BI Service you are interacting with. A Domain home can contain many instances and the name of the instance key you create during the installation. The default name is ‘ssi’, bit obviously could be different.

To view all the service instances use the WLST command listBIServiceInstances(domainHome):

listBIServiceInstances('/u01/app/obiee/user_projects/domains/bi')

obiee12c_BAR_image2

So here I have one ServiceInstance and its key is ssi.

You also need a working directory and an export directory. The working directory is where the export command will temporarily store files during its processing. The export directory is where the BAR files will be stored.

I’ve created two new directories for this: /u01/workDir and /u01/exportDir. Anywhere will do, as long as the OS user you are running the scripts under has read/write access.

So to create a BAR file from your service instance use the exportServiceInstance command. This takes the following parameters:

Domain Home: e.g. <obiee_home>/user_projects/domains/bi

Service Instance Key: e.g. ssi

The working directory: e.g. /u01/workDir

The export directory: e.g. /u01/exportDir

There are then three unused parameters, supposedly reserved for future changes to the export command.

Include Catalog Runtime Info: The Runtime info is user-based information, such as the users own folders. By default this parameter is set to ‘false’. Use ‘true’ if you do want user info. This parameter is optional.

Include Credentials: This is a password field to encrypt the database connection credentials in the RPD. This field is optional and if not included the connection credentials are not exported.

With three unused parameters and the final two being option you can run the exportServiceInstance command with just the first four parameters:

exportServiceInstance('/u01/app/obiee/user_projects/domains/bi','ssi','/u01/workDir','/u01/exportDir')

If you do want to specify the last two parameters then use quotes to pass over the three unused parameters, e.g.:

exportServiceInstance('/u01/app/obiee/user_projects/domains/bi','ssi','/u01/workDir','/u01/exportDir','','','',true,'Password1')

obiee12c_BAR_image3

A log file is created of the export, under <obiee_home> /user_projects/domains/bi/bilogs/service_instances/ssi/metadata/ but it just contains the same text displayed on the screen during the export process.

The export file will be called serviceInstanceKey.bar, e.g. ssi.bar in my case, in the export directory.

obiee12c_BAR_image4

At this point I’d usually rename it to something more meaningful to indicate what’s in the export file and the date taken.

Running the export without the user runtime info and credentials parameters does indeed produce a smaller file (only slightly in my case, I don’t have much in my test environment!)

exportServiceInstance('/u01/app/obiee/user_projects/domains/bi','ssi','/u01/workDir','/u01/exportDir')

obiee12c_BAR_image5

Now we can look at importing an Application Archive file. You can import into the same serviceInstance that it was exported from (effectively restoring the metadata), or into a different serviceInstance (on the same server or another).

In the examples below I’m importing into a new OBIEE 12c installation on a different server, although the serviceInstance has the same key of ‘ssi’.

Before importing the files they need to be FTP’d across to the server where they are being imported into. The import command doesn’t need a working directory like the export command and to import you do specify the name of the file (with its full path), it doesn’t have to be named after the serviceInstance Key.

When importing a BAR file you can choose whether to import all three components (RPD, catalog, security model), or just selected elements.  To import a BAR file you need to use the importServiceInstance command. This takes the following parameters:

Domain Home: e.g. <obiee_home>/user_projects/domains/bi

Service Instance Key: Of the service you are importing into, which may be different to the one it was exported from.

BAR file to import: The full path and filename of the BAR file

Import the RPD?: Should the RPD be imported from the BAR file. The default value is true, change to false if not wanted.

Import the WebCat?: Should the Web Catalog be imported from the BAR file. The default value is true, change to false if not wanted.

Import the Security model: Should the security model be imported from the BAR file. The default value is true, change to false if not wanted.

Include Credentials: This is the password used to encrypt the database connection credentials in the RPD. If not provided the connection credentials will not be imported.

Now according to the System Administrators guide for OBIEE 12c, there are two more parameters, one for to determine if user run-time info should be imported and another asking for the include credentials password again. These are not required and will produce an error if used. The importServiceInstance command can only have a maximum of seven parameters.

Only the first three parameters are compulsory, the others are all optional, however you must include all parameters up to the last one you specify (you can’t for instance include the credentials password without the three content import options before it).

So an example of the shortest form of the command would be:

importServiceInstance('/u01/app/obiee/user_projects/domains/bi','ssi','/u01/importDir/ssi.bar')

This would import the RPD, catalog and security model, but not the user runtime info. The connection credentials would not be imported(if they are even in the file)

And the longest form:

importServiceInstance('/u01/app/obiee/user_projects/domains/bi','ssi','/u01/importDir/ssi.bar',true,true,true,'Password1')

In this case everything is imported. In most cases when you’re using a frequently used script for deploying content, say from development to production, the following command is probably best:

importServiceInstance('/u01/app/obiee/user_projects/domains/bi','ssi','/u01/importDir/ssi.bar',true,true,false,'Password1')

This imports the RPD (with connection credentials) and the catalog but not the security model or the user run-time information.

So an example of running it produces the following:

obiee12c_BAR_image6

The import has completed and appears to have been successful…and indeed it has, but initially things look a little odd…my user (paulc in the screenshots below) can see the new dashboard that was in the export and the dashboard has data, so the RPD must have loaded too (with the connection credentials):

obiee12c_BAR_image7

Also the catalog is showing the run-time user info (i.e. the reports I had saved into my folder) and I can see the Revenue Reports shared folder.

obiee12c_BAR_image8

But…my user paulc is an administrator and had full admin rights…but no I don’t have the Administration option in the menu bar and I can’t create new Analyses, filters or prompts!

obiee12c_BAR_image9

 

Even weirder, if I load the Admin tool and connect on-line only the Sample App metadata is there (which I deleted), there’s no sign of my revenue data metadata even though the revenue reports are working on the dashboard!

obiee12c_BAR_image11

Clearly something hasn’t been completed. The importServiceInstance seems to import things ok, but it doesn’t perform a restart of the OBIEE services and this is clearly what’s needed.

So after performing a full restart using the normal stop & start scripts I now have my admin permissions back and the on-line RPD does show my metadata:

obiee12c_BAR_image13

So the answer is always restart OBIEE after performing a BAR import. You needed to when deploying an RPD in 11g via the enterprise manager, so it’s no worse than before.

The real improvement is the ease with which you can now include catalog and user run-time info and that it can now be scripted rather than manually working through the enterprise manager screens – a big tick in the box from me!

Enjoy!

READ MORE:

Paul CannonWelcome to OBIEE 12c: Using BI Application Archive (BAR) files

Related Posts

Take a look at these posts

24 comments

Join the conversation
  • Kennedy KK - 5th June 2016 reply

    After BAR upload I’m not able to edit analysis. The menus are gone. Anyone with a solution?

    Paul Cannon - 13th June 2016 reply

    Hi Kennedy,

    did you upload a BAR file that was exported from another OBIEE install? I’ve seen issues when doing this when the security model is also imported – it seems to overlay the new security model over the old model, but not properly and you lose privileges. Do you have a old archive BAR export from the same server you could re-import to set the security back, then just import the RPD and Webcat from the BAR file you are using?

    Paul

  • Noyan Kaan Suslu - 13th June 2016 reply

    Hi, I’m trying to export but got error. Do you have any suggestion?
    [2016-06-13T10:53:59.587+03:00] [bi] [ERROR] [] [oracle.bi.bar.jazn.JaznFileExport] [tid: 1] [ecid: e9bc4125-61ad-40e6-9832-165f930db680-00000002,0] Error while reading application-role.

    Paul Cannon - 13th June 2016 reply

    Sorry Noyan, I’ve not seen that error before. I did see a thread on my oracle support recently that talked about updating one of the jar files used by the export routine to overcome a different problem – may be that’ll sort your issue as well, see this thread:

    https://community.oracle.com/thread/3915924?start=0&tstart=0

    Paul.

  • Ganesh - 22nd June 2016 reply

    Hello Paul,

    When I try to export the RDP I am receiving the below error. Not sure what is causing the problem:

    WARNING: Log file provided by plugin = /app001/app/obi12c/product/fmw/user_projects/domains/bi/bilogs/metadata/datamodel/RpdMetadataManagerPlugin2016-06-22_07-55-14AM.log
    Jun 22, 2016 7:55:28 AM oracle.bi.bar.si.framework.ServiceInstanceFrameWorkImpl exportServiceInstance
    SEVERE: Error during export service instance for handler oracle.bi.bar.si.framework.handler.RpdServiceInstanceHandler
    Jun 22, 2016 7:55:28 AM oracle.bi.bar.si.ServiceInstanceLifeCycleImpl exportServiceInstance
    SEVERE: Failed in running all the handlers during export service instance.
    Jun 22, 2016 7:55:28 AM oracle.bi.bar.log.LogUtils removeServiceInstanceODLHandler
    INFO: Path from ODL Handler = /app001/app/obi12c/product/fmw/user_projects/domains/bi/bilogs/service_instances/ssi/metadata/si20160622_075202.log
    Jun 22, 2016 7:55:28 AM oracle.bi.bar.log.LogUtils removeServiceInstanceODLHandler
    INFO: Removing odl handler after completion of the run for log file /app001/app/obi12c/product/fmw/user_projects/domains/bi/bilogs/service_instances/ssi/metadata/si20160622_075202.log
    Problem invoking WLST – Traceback (innermost last):
    File “/app001/bibackup/scripts/backup_command.py”, line 1, in ?
    File “/app001/app/obi12c/product/fmw/bi/lib/bi-bar.jar!/wlstScriptDir/ServiceInstanceLifeCycle.py”, line 84, in exportServiceInstance
    at oracle.bi.bar.si.ServiceInstanceLifeCycleImpl.exportServiceInstance(ServiceInstanceLifeCycleImpl.java:470)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)

  • Sourodeep - 17th October 2016 reply

    Anybody face the below error

    I am trying to import a Bar from a 11g installation.

    File “”, line 1, in ?
    File “/obieeuat/Middleware_Home/Obiee12c/bi/lib/bi-bar.jar!/wlstScriptDir/ServiceInstanceLifeCycle.py”, line 63, in importServiceInstance
    at oracle.bi.bar.si.ServiceInstanceLifeCycleImpl.importServiceInstance(ServiceInstanceLifeCycleImpl.java:290)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)

    oracle.bi.bar.si.exception.ServiceInstanceLifeCycleException: oracle.bi.bar.si.exception.ServiceInstanceLifeCycleException: Failed in import service instance oracle.bi.bar.exceptions.InvalidBarException: BAR has only empty folders, Atleast one file should exist in one of metadata folder

    Paul Cannon - 26th October 2016 reply

    Sourodeep,

    the error is implying that the bar file you are importing is empty, so you need to look at how you are creating/running the bi migration jar file – are you running this in the right location or is it generating any errors?

    Paul.

    Paul.

  • NMOFONSECA - 7th December 2016 reply

    Hi everyone, excelent article thank you so much for the article. Has anyone got errors while importing.Traceback (innermost last):
    File “”, line 1, in ?
    File “/u01/oracle/Middleware/Oracle_Home/bi/lib/bi-bar.jar!/wlstScriptDir/ServiceInstanceLifeCycle.py”, line 63, in importServiceInstance
    at oracle.bi.bar.si.ServiceInstanceLifeCycleImpl.importServiceInstance(ServiceInstanceLifeCycleImpl.java:453)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)

    oracle.bi.bar.si.exception.ServiceInstanceLifeCycleException: oracle.bi.bar.si.exception.ServiceInstanceLifeCycleException: Failed in running all the handlers during import service instance.

    I have exported the bar file from another OBIEE 12 instance.

    Thanks.
    Nuno

    NMOFONSECA - 7th December 2016 reply

    Hi, Meanwhile I change the import to be like this importServiceInstance(‘/Oracle_Home/user_projects/domains/bi’,’ssi’,’/u01/oracle/importDir/ssi.bar’,true,false,false,’mypassword’) and it worked.

    However I don’t understand completely what in this case is not doing.

    If someone can explain me it will be lovelly.
    Thanks
    Nuno

    Paul Cannon - 7th December 2016 reply

    Hi Nuno,

    You’ve not specified what your original importServiceInstance command was. The example that worked is correct and matches the example in the blog, so what where you doing differently before?

    Paul.

  • NMOFONSECA - 8th December 2016 reply

    Hello Paul,

    It only fails when I import with the catalog, it seems that is failing applying policies.

    The original command is: importServiceInstance(‘/Oracle_Home/user_projects/domains/bi’,’ssi’,’/importDir/ssi.bar’,true,true,true,’mypassword’)

    I am trying to create all the required groups that the source OBIEE 12c instance has and try to match the application roles and policies to try.

    Thank you.

    Kind regards,
    NF

  • NMOFONSECA - 8th December 2016 reply

    Hi Paul,

    Just to add this is what I see when i run the import:

    INFO: Executing importServiceInstance for WEBCAT plugin oracle.bi.migration.webcat.WebcatMetadataManagerGenericPluginImpl
    Dec 08, 2016 12:09:47 PM oracle.bi.bar.si.framework.handler.WebcatServiceInstanceHandler importServiceInstance
    SEVERE: Failed in running importServiceInstance for plugin oracle.bi.migration.webcat.WebcatMetadataManagerGenericPluginImpl
    Dec 08, 2016 12:09:47 PM oracle.bi.bar.si.framework.handler.ServiceInstanceHandlerHelper logErrorMessages
    SEVERE: Failed to migrate application policy.
    Dec 08, 2016 12:09:47 PM oracle.bi.bar.si.framework.ServiceInstanceFrameWorkImpl importServiceInstance
    SEVERE: Error during import service instance for handler oracle.bi.bar.si.framework.handler.WebcatServiceInstanceHandler
    Dec 08, 2016 12:09:47 PM oracle.bi.bar.si.ServiceInstanceLifeCycleImpl importServiceInstance
    SEVERE: Failed in running all the handlers during import service instance.
    Dec 08, 2016 12:09:47 PM oracle.bi.bar.shared.MetadataType getMetadataManagerPlugin
    INFO: Plugin Found in Service Loader: oracle.bi.jazn.bar.plugin.JaznMetadataManagerGenericPluginImpl
    Dec 08, 2016 12:09:47 PM oracle.bi.bar.shared.MetadataType getMetadataManagerPlugin

  • Sudheep Divakar - 13th December 2016 reply

    Hi,
    First and foremost, excellent article.
    I think BAR file is the exact match for our requirement. We want to send the applications metadata with each build.

    As I understood, with this approach all the applications or dashboards in the instance will get archived into the file. A dev instance will have lot of test projects which need not be promoted to higher environments. How can we select a set of required reports to be archived ?

    Thanks,
    Sudheep

    Paul Cannon - 19th December 2016 reply

    Sugheep,

    Sorry, you can’t. this method of backup the catalog will only perform a full backup of the entire catalog. What we’ve done for some clients is control how the devevelopers store their objects in the shared folders – usually beneath a single ‘developer’ folder, with sub-folders per developer. Then set the permissions on these folders so that normal users have no access to them. Then it doesn’t matter when they get included in the deployment to production as users can’t see them and if they really were not wanted in production it’s only one folder to manually delete as part of the deployment process.

    Paul.

  • Rick - 14th December 2016 reply

    Thanks for this: Super blog that is so much clearer and more to the point than the documentation by Oracle.

  • Rick - 14th December 2016 reply

    However after restart of my BI-Server I am Service Administrator, but I still don’t see Admin-options… Any ideas?

  • Rick Brobbel - 15th December 2016 reply

    Hi Paul,
    Excellent post.
    However even after restarting the BI Services my administrative users don’t see the administrative options (such as Administration and New – Analytics).
    I have logged a case at Oracle Support for assistance, but if you have any hints I would be grateful.
    Kind regards
    Rick

  • sathya - 16th December 2016 reply

    Dear All,
    i would like to know how to take the backup of catalog and BAR file as schedule as daily

    Regards
    sathyanarayana

    Paul Cannon - 19th December 2016 reply

    Sathyanarayana

    I blogged about this earlier in the year: http://www.redstk.com/welcome-to-obiee12c-scripting-bat-file-backups/

    Paul.

  • Vaibhav - 6th January 2017 reply

    I am getting following error while importing the BAR file.

    INFO: Removing odl handler after completion of the run for log file /home/oracle/Oracle/Middleware/Oracle_Home/user_projects/domains/bi/bilogs/service_instances/ssi/metadata/si20170106_141521.log
    Traceback (innermost last):
    File “”, line 1, in ?
    File “/home/oracle/Oracle/Middleware/Oracle_Home/bi/lib/bi-bar.jar!/wlstScriptDir/ServiceInstanceLifeCycle.py”, line 63, in importServiceInstance
    at oracle.bi.bar.si.ServiceInstanceLifeCycleImpl.importServiceInstance(ServiceInstanceLifeCycleImpl.java:361)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)

    oracle.bi.bar.si.exception.ServiceInstanceLifeCycleException: oracle.bi.bar.si.exception.ServiceInstanceLifeCycleException: Failed in running all the handlers during backing up of service instance.

    Any solution on this issue?

  • BM - 9th January 2017 reply

    Hi,

    Do you know if you can pass as an argument that you only want a part of the catalog? I want to pas two out of three folders between systems and leave the other one as it is.

    Thanks!

    Paul Cannon - 10th January 2017 reply

    Hi Marga,

    no you can’t – a BAR file export will always take the entire catalog. If you only want to deploy certain catalog folders between different environments then probably the best option is to use the archive facility in the catalog screen or catalog manager rather than using BAR files – the archive facility allows you to archive and restore specific folders in the catalog.

    Paul.

  • NMF - 24th January 2017 reply

    Hello Paul,

    I have used the process described to export everything and used the BAR to import in a new server.

    The import worked fine at least I did not received any errors during the execution in WLST, after that I have restart completly OBIEE used the Administration Tool to connect to the RPD to have a quick look I noticed that most of the PRD content was not imported.

    I had to use a different method , which was using the command line tools that comes with the developer client tool data-model-cmd downloadrpd and uploadrpd.

    As this happened to you previously Paul?

    Thank you in advance.

    Kind regards,

    NMF

  • Peter - 31st March 2017 reply

    Hello Paul,

    After following the steps in exportServiceInstance command I received an error :

    Mar 31, 2017 3:57:20 PM oracle.bi.bar.log.LogUtils removeServiceInstanceODLHandler
    INFO: Removing odl handler after completion of the run for log file C:\Oracle\Middleware\OBIEE_12c\user_projects\domains\DEMO\bilogs\service_instances\ssi\metadata\si20170331_155720.log
    Traceback (innermost last):
    File “”, line 1, in ?
    File “/C:/Oracle/Middleware/OBIEE_12c/bi/lib/bi-bar.jar!/wlstScriptDir/ServiceInstanceLifeCycle.py”, line 84, in exportServiceInstance
    at oracle.bi.bar.util.FileUtils.ensureDir(FileUtils.java:285)
    at oracle.bi.bar.si.ServiceInstanceLifeCycleImpl.exportServiceInstance(ServiceInstanceLifeCycleImpl.java:456)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)

    java.lang.RuntimeException: java.lang.RuntimeException: Failed to create directory: C:\Windows\system32ackup\work\exportSICustomization\ssi\metadata

    Any solution to this issue?

    Regards,
    Peter

Join the conversation