Friday, January 6, 2017

Cannot drop a user that is currently connected - How to drop it

The reason I have this post here in the Hyperion blog is because of the close connection between the EPM environment and the DBA world - coz at times you have to act as an EPM admin as well as a database admin.

Say for example you want to drop/re-create an Oracle user.

Basically the query that you would write would be something like this:

DROP USER NIRMAL CASCADE;

The above syntax does the job of dropping the user "NIRMAL," however, if the user is connected somehow, you will get the error message "cannot drop a user that is currrently connected....."
It implies that one or more session is open for the user, and we need to kill the session before we can drop the user.
The first step is finding the session -

SYNTAX
SELECT SID,SERIAL# FROM V$SESSION WHERE USERNAME = 'NIRMAL'
The output will have the SID and SERIAL#s listed.

Now that we know the SID and SERIAL#s
SYNTAX
alter system kill session '34,4177';  ... etc(whatever the SID/SERIAL# combination)

The above SQL kills the session and disconnects the user.
Now all we need too do is run the DROP USER query again.

DROP USER NIRMAL CASCADE;

ALTERNATE WAY

SYNTAX
SELECT 'ALTER SYSTEM KILL SESSION ''' || SID || ',' || SERIAL# || ''';' FROM V$SESSION WHERE USERNAME = 'NIRMAL';
returns
one KILL statement per session for user 'NIRMAL'


Run the KILL statement and DROP the user.




Thursday, November 3, 2016

How to schedule Business Rule to launch through the Planning Utility

Say you have to schedule a Business rule to run nightly in version 11.1.2.3.700

It being version 11.1.2.3, we have Calc Manager to handle the Business Rules - remember no EAS BRs.

In this version there is a utility - "CalcMgrCmdLineLauncher.cmd" in the Planning1 folder (D:\oracle\Middleware\user_projects\epmsystem2\Planning\planning1)

So, in order to run the Business Rules, we can go to the Planning1 folder and run "CalcMgrCmdLineLauncher.cmd /A:AppName /U:admin /D:DatabaseName /R:BusinessRuleName /Validate"
Validate if optional for validation.
In this case, we will be prompted for a password.
We can also use Password encripted file with "-f" syntax, which would look something like this
CalcMgrCmdLineLauncher.cmd -f:D:\oracle\Middleware\user_projects\epmsystem2\Planning\planning1\passwordFile /A:AppName /U:admin /D:DatabaseName /R:BusinessRuleName

This script can be scheduled by including the lines in a batch script.
Create a batch file and include the lines ---
call D:\oracle\Middleware\user_projects\epmsystem2\Planning\planning1\CalcMgrCmdLineLauncher.cmd -f:D:\oracle\Middleware\user_projects\epmsystem2\Planning\planning1\passwordFile /A:AppName /U:admin /D:DatabaseName /R:BusinessRuleName