Count the number of users logged in to the OBIEE Application

Thanks to Kurt Wolff on IT Toolbox - Oracle-BI group who gave an excellent solution.

I thought let us implement the logic with some modifications. Here it is .

Create a table in the database.


CREATE TABLE USERS(USERNAME VARCHAR2(20),CDATE TIMESTAMP WITH LOCAL TIME ZONE,COUNTER NUMBER);

COMMIT;

Create a row level insert trigger Q1 

CREATE OR REPLACE TRIGGER Q1

BEFORE INSERT ON USERS
FOR EACH ROW
DECLARE numrows INTEGER;
BEGIN
SELECT G1.NEXTVAL INTO numrows FROM dual;
:NEW.COUNTER := numrows;
END;

COMMIT;

Create a sequence G1


CREATE SEQUENCE G1
  START WITH 1
  MAXVALUE 1E27
  MINVALUE 1
  NOCYCLE
  CACHE 20
  NOORDER;

COMMIT;

Make sure the trigger and sequence is valid and enabled.


Import this USERS table in the RPD.















Create a session initialization block NOOFUSERS with the session variable USERLOGGING.














 Save the changes.

 I have now logged in to OBIEE front end application few times with user weblogic and with some other user names. So now let us go to database and see the USERS data.














Observations :

There are total 5 users logged in to the application as of now. 
The last logged in user was AZIFF.

You can query this table in a different ways in order to get various combinations

Thanks.

No comments: