Since the release of BI 4.0 (and going back as far as XI 3.x and XI R2), we’ve had various issues related to stale user sessions. I’m referring to a user session initiated from the BI Launchpad, CMC or other SDK application that should have expired and been deleted by the CMS hours or days ago, but is somehow still listed in the CMC > Sessions page. These open sessions not only consume a license but also take a small bit of CMS resources as long as they’re kept open. BI4.1 SP3 has a nice new feature that brings us one step closer by offering a way to manually drop a session. But this still leaves it up to the Administrator to manually do this periodically. See screenshot below from prereleased copy of SP3:
As you can see above, here’s a session that has been active for almost a week. The new SP3 feature will now allow you to select one or more sessions and click ‘end session’. This is no doubt a step in the right direction. Prior to BI4.1 SP3, you really had two options: 1.) Recycle the CMS or 2.) run an sdk script to do the delete. I think we can do better than this.
I’d love to be able to solve the real issue(s)… which would be for the BI product to always close the session when it expires (or possibly even sooner, for instance when the user is finished with it). But unless we knew the exact workflow a user followed that led to a stale session, we can’t prevent and fix these types of problems in a patch or code correction. If you find a specific workflow that can cause a session to linger for hours or days after it should have expired, please raise an incident with SAP in the BIP-BI-SRV component and we’ll do our best to resolve it. Also, be sure to read kbase# 1862925 – “Session handling and tuning”. Until the workflows are each identified, I’m offering you more of a reactive approach to this problem.
I’ve seen a few scripts on the SCN offering a way to delete user sessions. But I couldn’t find one that offered a way to automate the task, delete it safely and most of all delete a user session based on its age. The script I created can be uploaded to your BI 4.x environment as a Program File and automated via a recurring schedule or it can be run on from a command line manually on or off the BI server. I’ve tested it under various locale and regional settings and it works well on both Windows and Linux installations. As any program, there are probably flaws so please use at your own risk and let me know if you run into problems.
Due to file format restrictions on the SCN, the ‘biUserSessionKillScript’ (both .biar and .jar) can be downloaded from:
kbase#: 996692 – How to Automate the Cleanup of Stale BI4 User Sessions
Uploading as a Program File:
There’s two ways to insert the Program File into your BI4 environment. You can either add it via CMC as a Program File or import it via Promotion Management via an .lcmbiar file.
CMC insert method:
- Login to the CMC, Navigate to a folder, click on the ‘Manage’ menu and select: ‘Add’ > ‘Program File’
- Browse to the biUserSessionKillScript.jar file and change the ‘Program Type‘ radio button to ‘Java’.
- Select OK
Promotion Management method:
- Log into the CMC and open the Promotion Management page.
- Choose ‘Import’ > ‘Import File’ and select the attached .lcmbiar file.
- After clicking OK, select the destination dropdown and login to your CMS. Click ‘Create’.
- In the next screen, click ‘Promote’.
Scheduling the Program File:
Scheduling a Program File is very similar to scheduling a report. The only difference is you’ll need to specify a few arguments to tell BI how to run the program.
- Right click on the Program File and click ‘schedule’
- Select the ‘Program Parameters’ option on the left
- The only argument the script needs when run within BI is the Age of a Session in Minutes
- Specify this value in the Arguments textbox. For safety reasons, the value must be >= 60. Anything less and you risk deleting an active user session.
- In the ‘Class to run” textbox, type: biUserSessionKillScript
- From here, you can specify any of the other scheduling settings you need like recurrence, notification, etc. and then click ‘Schedule’ to run the job.
- Regardless if the script succeeds, there will be a text file saved to the Output FRS with the results. Click on the instance title to view the output.
Running the jsp outside of BI
Run manually on the server console via cmd line:
- Copy the ‘biUserSessionKillScript.jar’ into the equivilant folder in your BI4 installation directory:
- C:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\java\lib
- If your path is different than above, then you’ll need to also edit the ‘biUserSessionKillScript.bat‘ file so the correct path is referenced.
- Execute the .bat file directly.
- To prevent the cmd window from disappearing at the end ofthe program, open a cmd window first, drag the .bat file into the window and click enter.
- Or you can copy the syntax within the .bat file and paste directly into a cmd window.
Run manually on a non-BI server via cmd line:
The biUserSessionKillScript.jar was compiled without including the BI4 dependency jars. This helps keep the file small and allows for a quick and easy download. Also, when the .jar is scheduled, BI already knows where to find the corresponding dependencies so there is no need to package them. However, if you want to run the script on a pc manually where neither BI4.x nor the client tools are installed, then you will need these depencies inserted into the jar. In this case, follow the steps below.
- On the BI4 Server, open the ‘biUserSessionKillScript.jar’ file with WinRar.
- Navigate to the path ‘C:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\java\lib’ and insert all of the files below into the .jar.
- Prior to adding the jar files into biUserSessionKillScript.jar, it will look like:
- After adding the files, it should look like:
- To Execute the file, open a command prompt and run: