When users leave a company or change departments or even have a name change, it becomes necessary to change the ownership of catalog objects to maintain consistency across the catalog.

Changing Ownership via Script Using the runcat Command

Managing users and their content in Oracle Analytics Cloud (OAC) can be an overwhelming task—especially when users leave the organization or their roles change. One common challenge administrators face is the need to reassign catalog item ownership across large numbers of reports and folders.

Manually updating ownerships? Not scalable. That’s where automation comes in.

We created a script you can use to change the ownership of catalog objects in Oracle Analytics. The script uses two runcat commands. In case you are unaware, runcat.sh/cmd is a very useful utility for making multiple types of changes to the Oracle Analytics catalog. One such option is to change the ownership of a catalog object.

The runcat command line utility is included as part of the Oracle Analytics Client Tools for both Windows and Linux and is part of the Oracle Analytics Server install.  

What Does This Script Do?

Before running this script, make sure you have an up-to-date snapshot as a backup.

This script automates the process of:

  • Generating a full catalog report of all items under the /shared folder
  • Filtering catalog items by user ownership, excluding system-specific content (like _portal folders)
  • Generating per-user reports of user-owned content
  • Preparing and printing commands to reassign ownership to new users based on an input CSV file

The script runs the Oracle Analytics runcat command twice using different options. The first option generates a list of owners and the objects they own. The second changes the ownership of those objects.

There’s some initial setup before running the script which involves creating several variables, some of which are used as input for runcat:

  • catalogPath: The path to the location of Oracle’s runcat.sh script
  • oacURL: The endpoint for the Oracle Analytics environment
  • userFile: CSV file containing user mappings in the format UserID,Email

For example:

catalogPath = ‘/scratch/AdminTool/bi/bitools/bin’
oacURL = ‘https://oracleAnalytics-id-ia.analytics.ocp.oraclecloud.com/analytics-ws/saw.dll’
userFile = ‘/scratch/amar/report/finalScript/python/activeUsers.csv’

The input file, in this case activeUsersC.csv, must also be created.  The input file is a one column file that contains two values separted by a comma.  The two values are UserID or old owner and email or new owner.  If a user no longer exists, that user will be ignored.  The format of the input file is:

OldUser1,NewUser1@xyz.com
OldUser2,NewUser2@xyz.com
OldUser3,NewUser3@xyz.com

 

The report command will generate an output file for each old user listing the objects to be changed.  After the report step, the command will list the new users and a corresponding output file containing the list of objects to be renamed.  The script will pause at this point giving you the option to stop the script and review the output files or continue on with the setOwnership command.  After reviewing the changes to be made, simply rerun the script but this time let it continue instead of stopping it.

The two runcat options are ‘report’, to generate the ownership list, and ‘setOwnership’ to change the owner.

The structure of the report command is:

runcat.sh -cmd report -online "https://OACinstance.ocp.oraclecloud.com/analytics-ws/saw.dll"
-excelFormat -delimiter "," -forceoutputFile "/scratch/tmp/Object.xls" -folder "/shared" -type "All" -fields "Owner:Path" -recursionDepth 19 -credentials "/scratch/tmp/boot.txt"

The arguments for the command are:

  • -cmd                     
    The runcat command that’s being used, in this case report.
  • -online                   
    The Oracle Analytics URL. This is the oacURL variable.
  • -excelFormat         
    The output will be in an Excel acceptable format
  • -delimiter               
    The delimiter between fields in the report.
  • -forceoutputFile    
    If the output file already exists, it will be overwritten. This is the userFile variable.
  • -folder                   
    The path of the catalog file to report on.
  • -type                     
    The catalog object type to report on.
  • -fields                   
    The catalog elements to report on.
  • -recursionDepth   
    The maximum catalog folder level to report on.
  • -credentials           
    The path of the credentials file.

The structure of the setOwnership command is:

runcat.sh -cmd setOwnership -online "https://OACinstance.ocp.oraclecloud.com/analytics-ws/saw.dll" -ownername <owner> -accountType user -itemFromFile "/scratch/tmp/Object.xls" -recursive false -credentials "/scratch/tmp/boot.txt "

Some of the arguments are the same as those used for the ‘report’ command. The different arguments are:

  • -ownername      
    The account name to be set as the owner.
  • -accountType    
    The account type. For example, user, application role, or group.
  • -itemFromFile   
    A file containing the paths of the catalog objects targeted for ownership changes. This is the userFile variable and output of the report command.
  • -recursive         
    Determines if the ownership is recursively set on child objects.  Recursive is being set to false because there may be objects with different owners under a parent folder.  We don’t want to set the ownership for all objects, just those that belong to the owner we’re changing.

A credentials file is required and must be in a specific format with the first line as the login and the second line the password. The format is:

login=<userid>
pwd=<password>

 

The script can be found at Downloads.

Changing Ownership in the Oracle Analytics Console

In addition to running the above script to change the owner of a catalog object, you can also use Content Management in the Oracle Analytics Console.

Image 1 - Console Content Management
Image 1 – Console Content Management

 

You must have the BIServiceAdministrator application role in order to use Content Management.

When you open Content Management, a list of all objects displays in the catalog.

You can sort by Name, Owner, or Modified date. You can sort in the sort box in the upper left or by clicking one of the column names. 

Image 2 - Content Management list
Image 2 – Content Management list

 

You can filter on a specific object type or owner. * is the wildcard character.

Image 3 - Filter options
Image 3 – Filter options

 

To change the owner, click the row, item, or items you want to change ownership of and click Change Ownership.

  • The Change Ownership buttion won’t activate until you select an object.
  • Selected objects are highlighted.
  • Use the Shift and Ctrl keys to select multiple objects.

In this example, four workbooks owned by admin are selected.

Image 4 - Click Change Ownership
Image 4 – Click Change Ownership

 

When you click Change Ownership, a dialog displays to show you how many objects are selected, as well as ownership change options. You can select yourself or select another user or role to change the ownership to. Once a name is selected, the OK button is enabled.

Image 5 - Change Ownership dialog
Image 5 – Change Ownership dialog

 

Changing the ownership of an object via the script is more versatile than using Content Management in that you can change multiple owners in a single transaction. With Content Management, you can only change one owner at a time.

Troubleshooting

If you try to change the ownership of an object to the current owner, you’ll get a warning that the user you’re trying to change to already owns the object. You’ll receive a warning for each object where the new owner and the old owner are the same. Hover over the message to see the specific warnings.

Image 6 - Ownership warning
Image 6 – Ownership warning

Call to Action

Now that you’ve read this article, try it yourself and let us know your results in the Oracle Analytics Community, where you can also ask questions and post ideas.